[asterisk-dev] addons/format_mp3.c - why is OUTSCALE 4096?

Walter Doekes walter+asterisk-dev at osso.nl
Mon Sep 26 02:48:36 CDT 2011


On 23/09/11 16:16, Tony Mountifield wrote:
> On some of my systems, we compress call recordings from wav to mp3
> using sox/lame. I have been experimenting with playing back the mp3
> files directly using the format_mp3 module.
>
> I found that while playing back the wav file was at normal volume,
> playing back the mp3 file was very quiet.
>
> On investigation, I discovered that was because of the following line
> in format_mp3.c:
>
> #define OUTSCALE 4096
>
> Now mpglib.h suggests the default value of outscale is 32768. If I change
> the #define to 32768 instead and rebuild, mp3 files then play at the same
> volume as other formats.
>
> So my questions are: Why the setting of 4096? Can it be changed to make
> format_mp3 consistent with all the other formats?

Out of curiosity, I decided to check the repository.

markster added the format_mp3 code in r22.

anthm changed the code on 2004-09-08 in r23 with comment "Add changes by 
Chris Stenton to support stereo and non-8khz mp3".

There he changed make_decode_tables() to make_decode_tables_scale() and 
replaced 32767 with 4096.

It doesn't come with an explanation why though. He also changed GAIN 
from 2 to -4 (4 to 0.25), but I have no idea where GAIN is supposed to 
be used -- now or then.

My best guess is that he had some really loud mp3's ;)

Regards,
Walter Doekes



More information about the asterisk-dev mailing list