|
-
using sox to trim silence from the end of wav files
Well, I've hit a little speedbump here.
I've got a 60 minute wav file, with 20 minutes of silence at the end of it.
What I'd like to do is use sox to trim off the 20 minutes of silence, leaving me with the 40 minutes of sound. This has to require no user input during the operation, as it is part of a script, so I can't use anything like audacity to do this.
So, according to the sox manpage:
Code:
silence above_periods [ duration threshold[ d | % ]
[ below_periods duration
threshold[ d | % ]]
Removes silence from the beginning or end of a
sound file. Silence is anything below a speci_
fied threshold.
When trimming silence from the beginning of a
sound file, you specify a duration of audio that
is above a given silence threshold before audio
data is processed. You can also specify the
count of periods of none-silence you want to
detect before processing audio data. Specify a
period of 0 if you do not want to trim data from
the front of the sound file.
When optionally trimming silence form the end of
a sound file, you specify the duration of audio
that must be below a given threshold before
stopping to process audio data. A count of
periods that occur below the threshold may also
be specified. If this options are not specified
then data is not trimmed from the end of the
audio file. If below_periods is negative, it is
treated as a positive value and is also used to
indicate the effect should restart processing as
specified by the above_periods, making it suit_
able for removing periods of silence in the mid_
dle of a sound file.
Duration counts may be in the format of time,
hh:mm:ss.frac, or in the exact count of samples.
Threshold may be suffixed with d, or % to indi_
cated the value is in decibels or a percentage
of max value of the sample value. A value of
'0%' will look for total silence.
So what I did was:
Code:
sox dump.wav out.wav silence 0 0 2% 2 00:05:00 2%
Which, as I understand it, should remove all periods of silence of at least 5 minutes from the end of dump.wav, while leaving the beginning untouched, and put the remaining data into out.wav. Unfortunately, I must not be understanding the syntax proplerly, because the generated out.wav is a barebones 4 kb wave file...
I've done some serious googling, but no one seems to want to give any good syntax examples for this little operation. I'm starting to pull my hair out on this one , as I've tried at least 50 different variations of the above command. It's getting old....
Can anyone shed light on this for me? Please?
~psi42
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|