Re: [ecasound] triming silence in sound files

From: Kai Vehmanen <kvehmanen@email-addr-hidden>
Date: Sun Aug 07 2005 - 13:48:11 EEST

Hi again,

On Sun, 7 Aug 2005, Kai Vehmanen wrote:
> # remove silence at start
> sh> ecasound -i foo.wav -o tmp.wav -ge:1,0,0
> # reverse, remove silence at start sh> ecasound -i reverse,tmp.wav -o
> tmp2.wav -ge:1,0,0
> # reverse to get the original direction
> sh> ecasound -i reverse,tmp2.wav -o foo-cropped.wav

doh, stupid me, the 3rd step is of course unnecessary, two runs
will do. Here's a complete script:

ecatrimsilence.sh
--cut--
#!/bin/sh
#
# description: removes silence from the beginning and the end
# of a file
# version: 20050807-1
# usage: ecatrimsilence.sh <inputfile>

tmp=ecatrimsilence-tmp.wav

if test -e $tmp ; then
   echo "error: temp file $tmp exists, unable to continue..."
   exit 1
fi

if test ! -e $1 ; then
   echo "error: input file $tmp does not exist, unable to continue..."
   exit 2
fi

format=`ecalength -sf $1`

echo "Trimming file ${1}."
echo "Removing silence at the end..."
ecasound -q -f:${format} -i reverse,${1} -o ${tmp} -ge:1,0,0 -b:256
rm -f ${1}
echo "Removing silence at the beginning..."
ecasound -q -f:${format} -i reverse,${tmp} -o ${1} -ge:1,0,0 -b:256
rm -f ${tmp}
echo "Done."
--cut--

-- 
  http://www.eca.cx
  Audio software for Linux!
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Ecasound-list mailing list
Ecasound-list@email-addr-hidden
https://lists.sourceforge.net/lists/listinfo/ecasound-list
Received on Sun Aug 7 16:15:06 2005

This archive was generated by hypermail 2.1.8 : Sun Aug 07 2005 - 16:15:06 EEST