Re: [linux-audio-user] batch sample editing

From: Kai Vehmanen <kvehmanen@email-addr-hidden>
Date: Sun Aug 07 2005 - 14:04:26 EEST

Hello,

On Sat, 6 Aug 2005, John Mulholland wrote:

> I have a large amount of aiff samples that have a predecing second or two of
> ambient silence. To trim this out of each file is going to take a very long
> time. Is there a program that can do this for me?

here's yet another way to this (with ecasound this time). First a script
to trim one file:

ecatrimsilence.sh:
--cut--
#!/bin/sh
#
# description: removes silence from the beginning and the end
# of a file
# version: 20050807-2
# 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 $1 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--

You can apply this to multiple files by doing for example something
like (in the directory where the *.aif files are):

bash> for i in `find . -type f -name \*.aif` ; do ../ecatrimsilence.sh $i ; done

-- 
  http://www.eca.cx
  Audio software for Linux!
Received on Sun Aug 7 16:15:06 2005

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