[FFmpeg-devel] Fun with aevalsrc + audio testing

Clément Bœsch ubitux at gmail.com
Fri May 18 13:24:21 CEST 2012

Hi there,

I had a look to how we could test a bit the audio filter chain with
aevalsrc as suggested by Stefano now that we have -af.

But compared to audiogen, a simple sin(440*PI*2*t) is a bit limited, so I
was thinking of generating something more interesting: in order to test
pan filter, it would be nice to have a 5.1 input stream for example (with
each channel having a different kind of signal).

So I had fun with aevalsrc and tried to "compose" some random sounds. Here
is the result that could be used for 1 of the 6 channels of that potential
input stream:

    % cat expr
    # floor(t): 0 0 0 0 0 ... 1 1 1 1 1 ... 2 2 2 2 2
    #  => set a random key when floor(t) changes

    # the next value to compare floor(t) with

    # mod(t,1) makes t always in the range [0;1) for each key

    # 0.6*... + 0.4*... for "echo" effect
    # exp() to mitigate the sound according to the time

And to test it:

    % ./ffplay -f lavfi -i "aevalsrc=$(grep -v '^#' expr|tr -d '\n'|sed 's/\([,;]\)/\\\1/g'),aformat=sample_fmts=s16"

Note: I don't know why I need the aformat=... at the end of the
filtergraph, and it seems like a regression to me (it was using s16 by
default a while again AFAIK, and now it uses u8 even if s16 is available).

Anyway, it might be overkill to use such thing for the audio filtering
tests, but that was fun to do. If anyone wants to propose more stuff like
this, I'd be happy to hear about it :)

Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120518/ec315a66/attachment.asc>

More information about the ffmpeg-devel mailing list