Re: [ecasound] Fade in and fade out

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [ecasound] Fade in and fade out
From: Julian Dobson (
Date: Mon Nov 03 2003 - 21:47:54 EET

I was hoping to avoid having to use an external program to measure the
playtime of the file before-hand, as I've had problems doing this due to
VBR in the source (for example ecalength reports 1529.861s for a song
which is only 254s actual length - and mp3check reports 382s; MP3::info
correctly reports 254s, at least for this song). And this is why I was
hoping that there was some way of processing ecasound's internal buffer
or secondary buffer.

I guess I may have to look into writing a LADSPA plug-in to do this.


Kai Vehmanen wrote:
> 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: <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.

New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Nov 03 2003 - 21:45:03 EET