Anthony Minessale wrote:
2) the macro is designed to fight clipping: When a sample exceeds the max size of the datatype we set it to the max value then cut the volume in half of that sample so it does not make too much noise. if we divide everything by 2 then all the volume would be reduced even on samples that fell inside the proper range. Hi Anthony, all, this is, in my opinion, actually going to give you far far uglier audio artefacts than simply hard limiting the samples. Rather than try and describe the resulting distortion, it's easier to just listen to it in action...
Each of the following files is about 100kb. Original file (extracted from freeswitch-sounds-en-us-callie-8000-1.0.7.tar.gz): http://www.vadacom.co.nz/engineering/ivr-sample_submenu.wav After 30dB gain and hard limiting samples to between -32768 and 32767: http://www.vadacom.co.nz/engineering/ivr-sample_submenu-hardlimited.wav After 30dB gain and switch_normalize_to_16bit(): http://www.vadacom.co.nz/engineering/ivr-sample_submenu-switch_normalize_to_... Cheers, Nic. -- Nic Bellamy, Head Of Engineering, Vadacom Ltd - http://www.vadacom.co.nz/