We have just finished some refactoring in the PJMEDIA tone generator, due to some problems identified by ticket 619. The main problem was the bad quality tone generated by the fixed-point sine generator algorithm, causing some failed detections by the remote end. While fixing this, we also addressed other problems such as noticeable thump noise at the beginning and the end of a tone, and difference in audio level produced by the fixed point compared to the floating point generator.
The results are these enhancements to the tone generator, implemented by ticket 619:
- introduced a new fixed-point sine generator backend, based on the CORDIC algorithm. While this algorithm is generally slower than the existing fixed-point backend (although it is still faster than the floating-point algorithm on platforms that lack FP support), it does produce more precise output, and more importantly, the precision is tuneable so that application can balance between precision and speed.
- made the backend algorithm selectable via compile time setting.
- added fade-in and fade-out to the tone generation to eliminate/reduce the thump noise.
To verify these, we analyzed the performance (in terms of both speed and precision) of the various backends. To see the result, please see the Analyzing the PJMEDIA Tone Generator Algorithms Performance in our wiki page.