[LAD] Normalize and Cut Wav
kallipygos at inbox.lv
Tue Mar 8 21:44:46 UTC 2011
I have started my small project - mp3 database for radio.
How do i normalize by peak [not RMS] and trim silences in begin and
end of WAV files ?
Silences somewhere in middle of file i wanna leave untouched.
I wanna in first step detect MAX sample in whole WAV file.
For example we gotta MAX sample 10 000, then Apmliefier_coefficient
will be 32 000/10 000 = 3,2 .
In second step i wanna trim silences at begin and below -80 dB [or 2
For this in same file each sample multiple by Apmliefier_coefficient
, and see - result is over -80 dB or not.
If not, then first N samples will not written in trimmed file, but
first sample that is over -80 dB [in any channel] ,
and all further samples written in new file.
Now we must just follow which sample [in any channel] is over -80
After write is complete, we can just truncate after last sample that
was over -80 dB, and write header.
So far i have found SOX vanna reverse da file for end silence trim,
and for each step produce tmp file.
Is here C API , program, script, way to do so what without any
temporary files ?
I have written script for normalize, but what ir best way for
What about mp3 and ogg automatic normalize and frames trim ?
Tnx in advance
for i in *.wav; do
echo "** Check peak for $i **"
ampl=`sox "$i" -t wav /dev/null stat -v 2>&1`
wahr=$(echo "$wert1 > $wert2" | bc)
if [ $wahr = 1 ]; then
echo " $wert1 > $wert2 , Do Nuthin"
echo " $wert1 <= $wert2 , Do process"
echo "** Amplifying volume by -=$ampl=- to fake a normalize
$val.wav -- $waveaus"
ampl2=$(echo $ampl*0.9995 | bc -l)
echo "ampl2 = $ampl2"
sox -v $ampl2 "$i" -t wav "$waveaus"
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Linux-audio-dev