Subject: Re: [ecasound] Fade in and fade out
From: Kai Vehmanen (k_AT_eca.cx)
Date: Mon Nov 03 2003 - 20:46:26 EET
On Mon, 3 Nov 2003, Julian Dobson wrote:
> My guess is that fade-out is a lot more difficult to do than fade-in or
> fade-out after x secs. I've got the Madplay source as was thinking of
> implementing the function for them (along the lines of buffering y secs
> of output, where y is the fade-out length, and when the buffer starts to
> empty start fading). I was kind of hoping that I didn't need to write
> this code though, and that there was a way of doing it in ecasound now.
There's no direct option to fade-out the last x secs of a file, but it's
quite easy to make a script that does this:
--cut--
#!/bin/sh
if test x${1} = x -o x${2} = x; then
echo "Error! Usage: fade.sh <file> <tailfadesecs>"
exit 1
fi
file=${1}
fadelen=${2}
len=`ecalength -s ${file} 2>/dev/null |cut -d. -f1`
fadestart=$(($len-$fadelen))
echo "fadestart=${fadestart}"
mv -v ${file} tmp.${file}
ecasound -i tmp.${file} -o ${file} -ea:100 -kl2:1,100,0,${fadestart},${fadelen}
rm -fv tmp.${file}
--cut--
More difficult thing is making the script more robust (checking that
ecalength returns sane values, making sure tmp-file is not written over
existing files, etc, etc. But it does work.
PS I don't recommended using this on mp3-files, as you will then
end up decoding and re-encoding just to add the tail-fade -
in other words you lose in quality. Prefer to work on
uncompressed files and only at the end convert to mp3.
-- http://www.eca.cx Audio software for Linux!
This archive was generated by hypermail 2b28 : Mon Nov 03 2003 - 20:49:12 EET