Generate an audio signal specified by an expression.
This source accepts in input one or more expressions (one for each channel), which are evaluated and used to generate a corresponding audio signal.
It accepts the syntax: exprs[::options]. exprs is a list of expressions separated by ":", one for each separate channel. The output channel layout depends on the number of provided expressions, up to 8 channels are supported.
options is an optional sequence of key=value pairs, separated by ":".
The description of the accepted options follows.
- duration, d
-
Set the minimum duration of the sourced audio. See the function
av_parse_time()
for the accepted format. Note that the resulting duration may be greater than the specified duration, as the generated audio is always cut at the end of a complete frame.If not specified, or the expressed duration is negative, the audio is supposed to be generated forever.
- nb_samples, n
-
Set the number of samples per channel per each output frame, default to 1024.
- sample_rate, s
-
Specify the sample rate, default to 44100.
Each expression in exprs can contain the following constants:
- n
-
number of the evaluated sample, starting from 0
- t
-
time of the evaluated sample expressed in seconds, starting from 0
- s
-
sample rate
Examples
-
Generate silence:
aevalsrc=0
-
Generate a sin signal with frequency of 440 Hz, set sample rate to 8000 Hz:
aevalsrc="sin(440*2*PI*t)::s=8000"
-
Generate white noise:
aevalsrc="-2+random(0)"
-
Generate an amplitude modulated signal:
aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
-
Generate 2.5 Hz binaural beats on a 360 Hz carrier:
aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) : 0.1*sin(2*PI*(360+2.5/2)*t)"