Re: [LAD] Normalize and Cut Wav

From: Lorenzo Sutton <lsutton@email-addr-hidden>
Date: Wed Mar 09 2011 - 10:55:32 EET

Hi,

Alfs Kurmis wrote:
> Hi experts.
>
> I have started my small project - mp3 database for radio.
> http://martini.pudele.com/radio/mp3_database/mp3_database.html
>
> 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.
For normalization you can look at normalize [1] (aka normalize-audio on
some distributions) it has a --peak option.

Lorenzo.

[1] http://normalize.nongnu.org/README.html
>
> I wanna in first step detect MAX sample in whole WAV file.
> For example we gottaMAX 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
> bit noise]
> 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 dB.
> 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 normalize ?
> What about mp3 and ogg automatic normalize and frames trim ?
>
> Tnx in advance
> Alf
>
> ====
>
> #!/bin/bash
>
> for i in *.wav; do
>
> val=${i%.wav}
> echo "** Check peak for $i **"
>
> ampl=`sox "$i" -t wav /dev/null stat -v 2>&1`
> waveaus=${i%.wav}.wave
>
> wert1="1.1"; wert2=$ampl;
> wahr=$(echo "$wert1 > $wert2" | bc)
> if [ $wahr = 1 ]; then
> echo " $wert1 > $wert2 , Do Nuthin"
> else
> 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"
> fi
>
> echo ""
>
> done
>
>
>
> ----
>
>
> _______________________________________________
> Linux-audio-dev mailing list
> Linux-audio-dev@email-addr-hidden
> http://lists.linuxaudio.org/listinfo/linux-audio-dev

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Wed Mar 9 12:15:02 2011

This archive was generated by hypermail 2.1.8 : Wed Mar 09 2011 - 12:15:02 EET