Ticket #619 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

Bad tone quality when floating point is disabled (thanks Olle Frimanson for the report)

Reported by: bennylp Owned by: nanang
Priority: normal Milestone: release-1.0-rc3
Component: pjmedia Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp) (diff)

Issues with the tone generator:

  1. The sine approximation algorithm especially for the fixed point version is not good enough, causing aliasing frequencies to occur
  2. The volume perhaps can be made louder
  3. The volume is different between float and fixed point version
  4. There is a thump noise at the beginning and end of a tone (more noticeable at the end), due to the sharp transition between off-on and on-off (tone wave signal being terminated before it is fully complete).

Change History

comment:1 Changed 10 years ago by bennylp

  • Description modified (diff)

In r2281:

  • Added PJMEDIA_TONEGEN_FORCE_FLOAT to force the tone generator to use floating point calculation even when floating point is disabled, to improve the tone quality.
  • Added PJMEDIA_TONEGEN_FADE_IN_TIME and PJMEDIA_TONEGEN_FADE_OUT_TIME to control tone fade-in and fade-out feature. Default value is 1 msec and 2 msec respectively.

comment:2 Changed 10 years ago by bennylp

In r2284:

  • Fixed the volume difference between fixed and floating point tone generation algorithm (the fixed point was significantly quieter)
  • Added PJMEDIA_TONEGEN_VOLUME setting to control the default tone volume.
  • Increased default tone volume by 50% (from approx -12dB to approx -8dB)

comment:3 follow-up: ↓ 4 Changed 10 years ago by bennylp

In r2292: Large reorganization of the tonegen:

  • Deprecate the automatic selection of algorithm. The old PJMEDIA_USE_HIGH_QUALITY_TONEGEN macro and the newly introduced PJMEDIA_TONEGEN_FORCE_FLOAT macro are now deprecated and new algorithm selection is introduced (see below)
  • Introduced various constants for tonegen backends in config.h:
    • PJMEDIA_TONEGEN_SINE
    • PJMEDIA_TONEGEN_FLOATING_POINT
    • PJMEDIA_TONEGEN_FIXED_POINT_CORDIC
    • PJMEDIA_TONEGEN_FAST_FIXED_POINT
  • Introduced PJMEDIA_TONEGEN_ALG setting to control which algorithm to be used. With this macro, user can override which algorithm to be used.
  • Some fixes to the floating-point approximation backend:
    • the sine signal started with 1 while it should start with 0.
    • Use float rather than double for better performance.
  • Updated the benchmark results in tonegen.c

comment:4 in reply to: ↑ 3 Changed 10 years ago by bennylp

Additional info:

  • the r2292 also introduced new fixed-point tone generation backend based on Cordic algorithm.

comment:5 Changed 10 years ago by bennylp

In r2294:

  • changed default Cordic loop from 8 to 10 to gain more accuracy, and
  • updated tonegen.c with the results fro m ARM9 tests

comment:6 Changed 10 years ago by bennylp

  • Status changed from new to closed
  • Resolution set to fixed

Done.

More documentation can be found in Analyzing the PJMEDIA Tone Generator Algorithms Performance

comment:7 Changed 10 years ago by bennylp

  • Description modified (diff)
  • Summary changed from Bad tone quality generated by the tone generator when floating point is disabled (thanks Olle Frimanson for the report) to Bad tone quality when floating point is disabled (thanks Olle Frimanson for the report)

comment:8 Changed 10 years ago by bennylp

In r2305:

  • disable fade-in and fade-out if the tone off duration is zero. We assume that application wants to play continuous tone in this case, and the fade in/out feature will cause click noise to be generated

comment:9 Changed 10 years ago by bennylp

  • Description modified (diff)
Note: See TracTickets for help on using tickets.