From Lawrence D'Oliveiro@21:1/5 to All on Tue Mar 4 05:57:54 2025
XPost: comp.os.linux.misc
A command I came up with for using ffmpeg to convert an audio file for
playback through the Asterisk telephony engine. The sample rate has to
be 8kHz, so to make sure there are no aliasing artifacts, you have to
make sure there are no frequency components above about 3kHz. To
achieve this, I apply a first-order low-pass filter 16 times in a row,
to produce a “brick wall” cutoff at that frequency:
ffmpeg -i in.wav -f s16le -acodec pcm_s16le -ar 8000 \
-af $(sep=""; for i in $(seq 16); do echo -n ${sep}lowpass=f=3000; sep=","; done) \
out.slin
Note the use of the “.slin” extension. This is automatically appended
by Asterisk when you give it the file name for playback.