[LAD] Normalize and Cut Wav

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-dev@...>
Date: Tuesday, March 8, 2011 - 9:44 pm

---moq129962068635292f6e376d45afba9a7fb679b7016b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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.
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 =3D 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
=3D=3D=3D=3D
#!/bin/bash
for i in *.wav; do
val=3D${i%.wav}
echo "** Check peak for $i **"
ampl=3D`sox "$i" -t wav /dev/null stat -v 2>&1`
waveaus=3D${i%.wav}.wave
wert1=3D"1.1"; wert2=3D$ampl;
wahr=3D$(echo "$wert1 > $wert2" | bc)
if [ $wahr =3D 1 ]; then
echo " $wert1 > $wert2 , Do Nuthin"
else
echo " $wert1 <=3D $wert2 , Do process"
echo "** Amplifying volume by -=3D$ampl=3D- to fake a normalize =20
$val.wav -- $waveaus"
ampl2=3D$(echo $ampl*0.9995 | bc -l)
echo "ampl2 =3D $ampl2"
sox -v $ampl2 "$i" -t wav "$waveaus"
fi
echo ""
done
----
---moq129962068635292f6e376d45afba9a7fb679b7016b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi experts.I have started my small project - mp3 database for r=
adio.http://martini.pudele.com/radio/mp3_database/mp3_database.htmlHow do i normalize by peak [not RMS] and tr=
im silences in begin and end of WAV files ?Silences somewhere in midd=
le 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 A=
pmliefier_coefficient will be 32 000/10 000 =3D 3,2 .In second step i wanna trim silences at begin and below -80 dB [or 2 bi=
t noise] For this in same file each sample multiple by Apmliefier_coefficient , =
and see - result is over -80 dB or not.If not, then fi=
rst N samples will not written in trimmed file, but first sample that is ov=
er -80 dB [in any channel] ,and all further samples written in new f=
ile.Now we must just follow which sample [in any channel] is over =
-80 dB.After write is complete, we can just truncate after last sampl=
e that was over -80 dB, and write header. So far i hav=
e found SOX vanna reverse da file for end silence trim, and for each step p=
roduce tmp file. Is here C API , program, script, way to do so=
what without any temporary files ? I have written script for n=
ormalize, but what ir best way for normalize ?What about mp3 and ogg&=
#160; automatic normalize and frames trim ?Tnx in advance=
Alf=3D=3D=3D=3D#!/bin/bashfor i in *.wa=
v; do val=3D${i%.wav} echo "** Check peak for $=
i **"  ampl=3D`sox "$i" -t wav /dev/null stat -v 2>&amp=
;1`  waveaus=3D${i%.wav}.wave  wert1=3D"1.1";&#=
160; wert2=3D$ampl;  wahr=3D$(echo  "$wert1 >  $wer=
t2" | bc)  if  [ $wahr =3D 1 ]; then  &#160=
; echo "  $wert1 > $wert2 , Do Nuthin"  else =
   echo "  $wert1 <=3D $wert2 , Do process" &#=
160;  echo "** Amplifying volume by  -=3D$ampl=3D-  to fake =
a normalize   $val.wav  --  $waveaus"  =
  ampl2=3D$(echo $ampl*0.9995 | bc -l)    echo "a=
mpl2 =3D $ampl2"    sox -v $ampl2  "$i"  -t =
wav  "$waveaus"  fiecho ""done ----  
=0A
---moq129962068635292f6e376d45afba9a7fb679b7016b--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] Normalize and Cut Wav, Alfs Kurmis, (Tue Mar 8, 9:44 pm)
Re: [LAD] Normalize and Cut Wav, Lorenzo Sutton, (Wed Mar 9, 8:55 am)