[MPlayer-users] Audio equalizer problem

Darabos Edvárd Konrád nil at hippy.csoma.elte.hu
Sat Oct 11 22:02:32 CEST 2003


Hi all!

  I found an interesting problem with the audio equalizer. Let's se what I
did and what happened:

$ mplayer -af some.mp3

The sound was perfect.

$ mplayer -af equalizer=0:0:0:0:0:0:0:0:0:0 some.mp3

The sound was very quiet.

The equalizer works with floating point variables, so I think the possible
reason would be something related to that lines in the output:
...
audio_setup: sample format: Unsigned 8-bit (requested: Floating Point)
...
Building audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/8bit...
...

I searched in the source for the 1st output and found it in
libao2/ao_oss.c.  The problem (as I think) is that the ioctl call in the
init() function gives back AFMT_U8 because the floating point cannot be
configured as playback format. I hacked the libao2/ao_oss.c:135 (init
function, ac3_retry label), addedd the following lines:

ac3_retry:
ao_data.format=format; // <--- left unchanged
if(format==AFMT_FLOAT) // <--- inserted these
#ifdef WORDS_BIGENDIAN
  ao_data.format=AFMT_S16_BE;
#else
  ao_data.format=AFMT_S16_LE;
#endif

So if the input is in floating point format it will try the signed 16bit
format first for the dsp. I compiled mplayer and tried to play some.mp3
again:

$ mplayer -eq 0:0:0:0:0:0:0:0:0:0 some.mp3

The sound was as quiet as earlier. The output was:
...
audio_setup: sample format: Signed 16-bit (Little Endian) (requested:
Floating Point)
...
Building audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
...

The problem is not solved, but it is nice to have 16bit sound as the
output of the equalizer. :-) I think the newly added equalizer feature
doesn't produce the stream in the correct range. I did a hack in the
libaf/af_format.c:470 (float2int function / switch(bps) / case 2 / inside
for):

Original line:
((int16_t*)out)[i]=(int16_t)lrintf(SHRT_MAX*((float*)in)[i]);
Modified line:
((int16_t*)out)[i]=(int16_t)lrintf(32*SHRT_MAX*((float*)in)[i]);

Compiled and tried:

$ mplayer -eq 0:0:0:0:0:0:0:0:0:0 some.mp3

The volume of the playback was correct.

--------------------------------------

This letter wants to be a bugreport. I don't know well the mplayer source,
so I cannot tell for sure where the problem is. I can send the very
verbose outputs if they are needed. (But as I think, anyone can reproduce
this case easily, and the other lines of the output are not important.)

MPlayer RuLeZ!

Thanks, bye: Nil.



More information about the MPlayer-users mailing list