Hi all,
I spent a very long time trying to get the multi band processor shown in man sox to work.
It seems the manual is older then the code which has changed.
I needed a processor that would take audio from various not so great sources, adjust the dynamic range to suit a talk radio stream, and try and correct the frequency balance. One source consistently has poor room acoustics. Another has levels that vary wildly and a range of audio frequency bandwidths.
compand works as advertised. Perhaps not that clearly.
mcompand does not work as implied. It does some of what mcompand does but not all.
The manual could do with a makeover. Happy to help but I only know what the code does by trial and error so there may be stuff in there I have missed.
This code works, and I share it in the interest of others in like situations looking for a sledge hammer to fix bad audio or a way to try and make the audio sound consistent. This is a SPEECH processor. Do not use it for music!
I would encourage comments suggestions and improvements.
I also have sox putting an intro and outro on the processed audio using splice so that items are produced complete. This is just the processing engine.
============================ snip ======================================
#! /bin/bash
# the delay option is not available when mcompand is called by sox
# doing this as a function makes it easy to switch on and off
function bandmod {
sox -V leveled.wav mcompanded.wav mcompand\
"$f1_process" $f1_crossover\
"$f2_process" $f2_crossover\
"$f3_process" $f3_crossover\
"$f4_process" $f4_crossover\
"$f5_process" $f5_crossover\
"$f6_process" $f6_crossover\
"0,0.8 -38,-38,-28,-28,-0,-6" gain 10 highpass 22 highpass 22 sinc -n 255 -b 16 -12000
}
# set up band pass processing
#first band
f1_crossover='120'
f1_process='0,0.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -21 -15'
# attack1,decay1{,attack2,decay2} [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2} [gain [initial-volume-dB [delay]]]
#second band
f2_crossover='360'
f2_process='0,0.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -15'
#third band
f3_crossover='1080'
f3_process='0,1.2 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -15'
#fourth band
f4_crossover='3240'
f4_process='0,1.2 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -19'
#fifth band
f5_crossover='5000'
f5_process='0,2.0 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -24 -19'
#sixth band
f6_crossover='10000'
f6_process='0,1.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -48 -19'
#for next loop makes it easy to set up for multiple files
for i in $1
do
#take spaces out of filename
newfile=$(mv "$i" "${i// /}")
#now work with new name
#get the filename for later use
filename=$(basename $1)
echo $filename
filename="${filename%.*}"
echo $filename
# lets get the dynamic range sorted before band processing
# files are processed as wav so there is no loss of quality
sox -V $newfile leveled.wav compand 0,1.2 -60.1,-inf,-60,-160,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -18 -6
sleep 2
bandmod
# the processed audio replaces the original audio
mv mcompanded.wav $filename.wav
rm leveled.wav
done
exit 0
============================ snip ======================================
regards
Robert
_______________________________________________ Sox-users mailing list Sox-users@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/sox-users