[ecasound] Confusion about Fading Amplification

From: Mark Armendariz <lists@email-addr-hidden>
Date: Fri Aug 05 2011 - 04:30:32 EEST

* Note: I assume attachments are not kosher on this list, so I posted
this question on StackOverflow as so you can see my resulting


I want to fade a track in and out as specific time codes. For
example, I would like to take an audio file, and:

Start it at 100% Volume,
Fade it to 20% at 2 seconds
Fade it to 100% at 4 seconds
Fade it to 20% at 6 seconds
Fade it to 100% at 8 seconds
Fade it to 20% at 10 seconds
Fade it to 100% at 12 seconds
Fade it to 0 at 14 seconds.

I've been testing this with a constant tone generated by ecasound so
that I can open the resulting file in Audacity and see the results
visually. As far as I can tell, increasing the amplitude is relative,
while decreasing it is not. It seems that if I fade the amplitude up
that it affects the volume of the whole track and not just at the
specific time I set the fade, which is where I'm getting lost.

Note: I seem to have figured out the "why" as I was coming up with
examples, but I'm still hoping you can explain if this is correct or
if there is a "better" way.

An example of what has me scratching my head

# generate the tone
ecasound -i tone,sine,880,20 -o:tone.wav

# Just the test to see that i can fade start it at 100 and fade it to 20.
ecasound -a:1 -i tone.wav -ea:100 -kl2:1,100,20,2,1 -a:all -o:test_1.mp3

# Fade it out and in
ecasound -a:1 -i tone.wav -ea:100 -kl2:1,100,20,2,1 -ea:100
-kl2:1,20,100,4,1 -a:all -o:test_2.mp3

# Fade it out and in with a peak of 500
ecasound -a:1 -i tone.wav -ea:100 -kl2:1,100,20,2,1 -ea:100
-kl2:1,20,500,4,1 -a:all -o:test_3.mp3

# Fade it out from 500, out, and then back to 500
ecasound -a:1 -i tone.wav -ea:100 -kl2:1,500,20,2,1 -ea:100
-kl2:1,20,500,4,1 -a:all -o:test_4.mp3

# Fade it out from 500, out to a low of 10, and then back to 500
ecasound -a:1 -i tone.wav -ea:100 -kl2:1,500,10,2,1 -ea:100
-kl2:1,10,500,4,1 -a:all -o:test_5.mp3

# Fade it out from 1000, out to a low of 10, and then back to 1000
ecasound -a:1 -i tone.wav -ea:100 -kl2:1,1000,10,2,1 -ea:100
-kl2:1,10,1000,4,1 -a:all -o:test_6.mp3

# The eventual result I'm looking for
ecasound -a:1 -i tone.wav -ea:100 -kl2:1,500,20,2,1 -ea:100
-kl2:1,20,500,4,1 -ea:100 -kl2:1,500,20,6,1 -ea:100 -kl2:1,20,500,8,1
-ea:100 -kl2:1,500,20,10,1 -ea:100 -kl2:1,20,500,12,1 -ea:100
-kl2:1,500,0,14,4 -a:all -o:test_7.mp3


The best I can tell from these results is that the amplitude of the
whole track is relative to the difference between the low and the peak
of all the fading effects. I'm not sure if this result is expected,
but it's very confusing.

Also, in the last result, the fades are no longer taking a full second
each. In order to figure out why that may be, I took the final
fade-to-zero off and the durations were back to normal. This does not
seem like expected behavior.


# "Fixing" the fade durations
ecasound -a:1 -i tone.wav -ea:100 -kl2:1,500,20,2,1 -ea:100
-kl2:1,20,500,4,1 -ea:100 -kl2:1,500,20,6,1 -ea:100 -kl2:1,20,500,8,1
-ea:100 -kl2:1,500,20,10,1 -ea:100 -kl2:1,20,500,12,1 -a:all


As a side note, I've also tried changing the -ea values to the
"current" amplitude with every line. It didn't make any difference (no
matter what I set -ea to)

I have the very latest installed from git (2.8.1+dev). I had these
same issues with 2.7.0, which is why I upgraded and eventually found
myself here.

Am I doing this wrong?

Thank you for your time.

BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
Ecasound-list mailing list
Received on Fri Aug 5 08:15:01 2011

This archive was generated by hypermail 2.1.8 : Fri Aug 05 2011 - 08:15:01 EEST