Question regarding the use of mplayer with different options

Hi altogehter, :wave:

I´m using a tts-script (text-to-speech) I wrote quite a while ago. The only thing that bugs me is the muffled audio.

I don´t want to power up a graphical equalizer just for that (although I´ve installed pulseeffects).

As I use “mplayer” for playback within my script I found a phantastic option. Mplayer supports an equalizer option natively.

The command
mplayer -af equalizer=0:0:0:0:0:0:0:0:10:10 sound-file.wav
works just fine. It produces much crisper audio. Splendid for tts.

But: Some wav-files have a sample-rate that is too low for that process. Terminal says:

[equalizer] Limiting the number of filters to 8 due to low sample rate.

So the equalizer option has no effect. :neutral_face:

On MPlayer - The Movie Player I found an interesting comment:

Sample Rate Conversion:

If the audio sample rate in the original file is not the same as required by the target format, sample rate conversion is required. This is achieved using the -srate option and the -af lavcresample audio filter together.

This is the example they give:

DVD:

-srate 48000 -af lavcresample=48000

Now I´m not dealing with a DVD here but a mere audio-file. So I tried two different commands:

mplayer -srate 44100 -af equalizer=0:0:0:0:0:0:0:0:10:10 sound-file.wav
and
mplayer -srate 44100 -af lavcresample=44100 -af equalizer=0:0:0:0:0:0:0:0:10:10 sound-file.wav

Both work equally well and produce an exit code of “0”. And both have the desired effect of making the equalizer kick in. :slightly_smiling_face:

So my question is:

What do you think, which syntax is the correct one and which should I use :question:

Thanks so much in advance.

Many greetings.
Rosika :slightly_smiling_face:

2 Likes

Hi all, :wave:

for anyone interested: I found out the solution to my “problem” with the help of some helpful people from the mplayer mailing list (to which I subscribed).

A short recap:

I wanted to achieve the following:

I´m using the mplayer command within my tts script.
The goal was to make the sound crisper (with the help of the equalizer-option as an audio-filter)

PLUS:

setting up the speed (slightly; if needed). :wink:

Therefore I had to combine several filters/options.

Now I´ve learnt that setting more than one -af (audio-option-filter) like
“-af […] -af […]” is NOT the correct syntax as the second one was overriding the value I set with the previous one, so in the end only the latest was being applied. :neutral_face:

However the following IS correct:

video and/or audio filters can be combined with commas between individual filters.

OR: making use of the -af-add option to add more audio filters.

So basically these 2 commands work equally well:

mplayer -af scaletempo=scale=1.2:speed=pitch,lavcresample=44100,equalizer=0:0:0:0:0:0:0:0:7:7 -srate 44100 test.wav

and

mplayer -af scaletempo=scale=1.2:speed=pitch -srate 44100 -af-add lavcresample=44100 -af-add equalizer=0:0:0:0:0:0:0:0:7:7 test.wav

BTW:

These commands include the option to playback the file not only at faster speed (1.2 times as fast as normal) but also not setting the pitch higher but letting it remain on normal level.
Very nice :wink:

Perhaps these notes may be of help to others as well. :blush:

Many greetings from Rosika :slightly_smiling_face:

1 Like