Sound: Fade in...

A command to gradually increase the amplitude of a selected Sound.

Settings

Channel
determines whether you want to fade all channels or only a selected channel.
Time (s)
determines where the fade-in will take place. If time is earlier than the start time of the sound, the start time of the sound wil be used.
Fade time (s)
determines the start point and the endpoint of the fade-in with respect to the time argument. Depending on the sign of fadeTime, time is either the start or the end position of the fade-in. If fadeTime is positive, fade-in will take place between time and time+fadeTime. If fadeTime is negative, fade-in wil take place between time+fadeTime and time.
Silent from start
when on, makes the sound silent before the fade-in starts. When off, the sound before the fade-in starts will not be changed.

Algorithm

Multiplication with the first half period of a (1-cos(x))/2 function.

Cross-fading two sounds

The following script cross-fades two sounds s1 and s2 at time 1 second and leaves the result in s2.

       crossFTime = 0.5
       t = 1
       s = Create Sound from formula: "s1", 1, 0, 2, 44100, ~ sin(2*pi*500*x)
       Fade out: 0, t-crossFTime/2, crossFTime, "yes"
       Create Sound from formula: "s2", 1, 0, 2, 44100, ~ sin(2*pi*1000*x)
       Fade in.: 0, t-crossFTime/2, crossFTime, "yes"
       Formula: ~ self + object [s]

© djmw 20170829