<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
Alfs Kurmis wrote:
<blockquote cite="mid:1299620686.4d76a34e61122@mail.inbox.lv"
type="cite">Hi experts.<br>
<br>
I have started my small project - mp3 database for radio.<br>
<a class="moz-txt-link-freetext" href="http://martini.pudele.com/radio/mp3_database/mp3_database.html">http://martini.pudele.com/radio/mp3_database/mp3_database.html</a><br>
<div id="sig_upper"><br>
How do i normalize by peak [not RMS] and trim silences in begin
and end of WAV files ?<br>
Silences somewhere in middle of file i wanna leave untouched.<br>
</div>
</blockquote>
For normalization you can look at normalize [1] (aka normalize-audio
on some distributions) it has a --peak option.<br>
<br>
Lorenzo.<br>
<br>
[1] <a class="moz-txt-link-freetext" href="http://normalize.nongnu.org/README.html">http://normalize.nongnu.org/README.html</a><br>
<blockquote cite="mid:1299620686.4d76a34e61122@mail.inbox.lv"
type="cite">
<div id="sig_upper"><br>
<span class="short_text" id="result_box" lang="en"><span
class="hps" title="Zur Anzeige alternativer Übersetzungen
klicken">I wanna in first step detect MAX sample in whole
WAV file.<br>
</span></span> For example we gotta<span class="short_text"
id="result_box" lang="en"><span class="hps" title="Zur Anzeige
alternativer Übersetzungen klicken"> MAX sample 10 000, then
Apmliefier_coefficient will be 32 000/10 000 = 3,2 .</span></span><br>
<br>
In second step i wanna trim silences at begin and below -80 dB
[or 2 bit noise]<br>
For this in same file each sample multiple by <span
class="short_text" id="result_box" lang="en"><span class="hps"
title="Zur Anzeige alternativer Übersetzungen klicken">Apmliefier_coefficient
, and see - resul</span></span>t is over -80 dB or not.<br>
If not, then first N samples will not written in trimmed file,
but first sample that is over -80 dB [in any channel] ,<br>
and all further samples written in new file.<br>
Now we must just follow which sample [in any channel] is over
-80 dB.<br>
After write is complete, we can just truncate after last sample
that was over -80 dB, and write header.<br>
<br>
<br>
So far i have found SOX vanna reverse da file for end silence
trim, and for each step produce tmp file.<br>
<br>
Is here C API , program, script, way to do so what without any
temporary files ? <br>
<br>
I have written script for normalize, but what ir best way for
normalize ?<br>
What about mp3 and ogg automatic normalize and frames trim ?<br>
<br>
Tnx in advance<br>
Alf<br>
<br>
====<br>
<br>
#!/bin/bash<br>
<br>
for i in *.wav; do<br>
<br>
val=${i%.wav}<br>
echo "** Check peak for $i **"<br>
<br>
ampl=`sox "$i" -t wav /dev/null stat -v 2>&1`<br>
waveaus=${i%.wav}.wave<br>
<br>
wert1="1.1"; wert2=$ampl;<br>
wahr=$(echo "$wert1 > $wert2" | bc)<br>
if [ $wahr = 1 ]; then<br>
echo " $wert1 > $wert2 , Do Nuthin"<br>
else<br>
echo " $wert1 <= $wert2 , Do process"<br>
echo "** Amplifying volume by -=$ampl=- to fake a
normalize $val.wav -- $waveaus"<br>
ampl2=$(echo $ampl*0.9995 | bc -l)<br>
echo "ampl2 = $ampl2"<br>
sox -v $ampl2 "$i" -t wav "$waveaus"<br>
fi<br>
<br>
echo ""<br>
<br>
done<br>
<br>
<br>
<br>
----</div>
<br>
<div id="sig_lower"> </div>
<!-- &n
bsp; -->
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Linux-audio-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Linux-audio-dev@lists.linuxaudio.org">Linux-audio-dev@lists.linuxaudio.org</a>
<a class="moz-txt-link-freetext" href="http://lists.linuxaudio.org/listinfo/linux-audio-dev">http://lists.linuxaudio.org/listinfo/linux-audio-dev</a>
</pre>
</blockquote>
</body>
</html>