[Asterisk-Dev] Voicemail sound level threads?

Steven Critchfield critch at basesys.com
Sun Nov 28 17:42:28 MST 2004


On Sun, 2004-11-28 at 15:39 -0800, Kris Boutilier wrote:
> Can't say - but I do notice a significant difference between just the linear
> (wav) and gsm compressed (WAV) files you provided... I just checked a
> voicemail off of my system (CVS-v1-0-11/03/04) and I notice I'm getting the
> same effect, though I'd not realised it before. Although my attenuation
> seems less severe than yours you can really visualise the drop in energy
> levels by putting the different files through Sonogram
> (http://www.dfki.de/~clauer/programming.html)

As I keep mentioning to people, in format_wac.c, asterisk writes data
with a bit shift. From wav_write.c around line 479,
     /* Volume adjust here to accomodate */
                for (x=0;x<f->datalen/2;x++) {
                        tmpf = ((float)tmpi[x]) * ((float)(1 << GAIN));
                        if (tmpf > 32767.0)
                                tmpf = 32767.0;
                        if (tmpf < -32768.0)
                                tmpf = -32768.0;
                        tmp[x] = tmpf;
                        tmp[x] &= ~((1 << GAIN) - 1);
#if __BYTE_ORDER == __BIG_ENDIAN
                        tmp[x] = (tmp[x] << 8) | ((tmp[x] & 0xff00) >> 8);
#endif

                }


I have at line 64 in the same file that GAIN = 2.
You will also see in wav_read that if you have no data in the lower bits
that asterisk assumes it had pushed the data up and will shift it back
down. 
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-dev mailing list