Linear fade-in/out of audio

 

The line~ object is useful for providing a control signal. It interpolates linearly sample-by-sample to a new signal value over a specified period of time, then stays at that new value until it is instructed to change. It expects to receive a transition time in its right inlet (a ramp time), followed by a destination value in its left inlet. Alternatively, you can provide both values as a single two-item list. Its initial default value is 0. In this example, we use line~to provide a control signal (multiplier) to the *~ object in order to turn the amplitude of a sine wave up and down. When line~ receives the message 1 1000 it progresses to 1 over the course of 1 second, and when it gets the message 0 1000 it ramps back down to 0 in one second.