Re: Confusion about Fading Amplification

Mark Armendariz <[email protected]>
Newsgroups gmane.comp.audio.ecasound.general
Message-ID <CAJ9ureCcfEM-ZWr=nO7eaM-HEgXwV2bL1t0XcTS9i-dNTks8ZQ@mail.gmail.com>
On Fri, Aug 5, 2011 at 1:34 AM, Joel Roth <[email protected]> wrote:
> On Thu, Aug 04, 2011 at 09:30:32PM -0400, Mark Armendariz wrote:
>> * Note: I assume attachments are not kosher on this list, so I posted
>> this question on StackOverflow as so you can see my resulting
>> waveforms:
>> http://stackoverflow.com/questions/6950482/how-do-multiple-amplitude-fades-work-on-ecasound
>>
>> -----
>>
>> 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 see you've been using multiple -kl2 and -ea operators.
>
> While that may be possible, you may find it simpler
> to create a single envelope using -klg. For the above example (not
> tested) you could try this:
>
> ecasound -a:1 -i:tone.wav -ea:100 \
> -klg:1,0,100,7,1,2,0.20,4,1,6,0.20,8,1,10,0.20,12,1,14,0 \
> -o:test.mp3
>
> The arguments for -klg are:
>
> fx-parameter, low value, high value, count (no. of pairs),
> pos1, value1, pos2, value2,...
>
> The values are specified between 0 and 1.
>
> Hope this helps...
>

Joe,

Thanks so much for your response.  I had JUST figured out the issue
with kl2 when your email came in, so I tried out your approach as
well.

Your example didn't quite work, but it got me started.   Here's the
actual command line that did what I described in my previous email:

ecasound -a:1 -i:tone.wav -ea:100 \
-klg:1,0,100,14,2,1,3,0.20,4,0.20,5,1,6,1,7,0.20,8,0.20,9,1,10,1,11,0.20,12,0.20,13,1,14,1,15,0
\
-o:test.mp3

The main difference is that it specifies the "from" points - the end
of the spaces between the fades (better illustrated on SO).

As for using kl2 (for the record), I realized that the "from"
parameter on kl2 should be 100 every time, and if increasing the
amplitude, the "to" parameter needed to be (100 / from * to).  So if
going from 20% to 100%: 100 / 20 * 100 = 500.  If going from 45% to
90%: 100 / 45 * 90.  Of course, now if you drop to 20% of the current
amplitude, it's actually 18% (.20 * 90), so going back to 100 would be
100 / 18 * 100 = 555.56

I explained the whole solution (with the final correct screenshot) as
an answer on StackOverflow

http://stackoverflow.com/questions/6950482/how-do-multiple-amplitude-fades-work-on-ecasound/6952211#6952211

Joel, I think I may end up using klg in my scripts as that seems to be
easier to dynamically generate without having to think about the
relative amplitude for each effect.  I really appreciate your help.

Mark

>
>> 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
>
> Hi,
>
>
>
>> -------------------------------
>>
>> 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
>> -o:test_8.mp3
>>
>> -------------------------------
>>
>>
>> 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!
>> http://p.sf.net/sfu/rim-blackberry-1
>> _______________________________________________
>> Ecasound-list mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/ecasound-list
>
> --
> Joel Roth
>

------------------------------------------------------------------------------
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!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Ecasound-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecasound-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.