volume

Crossfade video and audio

You can make a crossfade between two videos or betwen two sounds by multiplying the amplitude of one of them by values going progressively from 1 to 0 while you multiply the other by values going progressively from 0 to 1. In this example, we use a slider object that outputs values from 0 to 1 to control the volume of two movie soundtracks, using the vol attribute of jit.qt.movie (or jit.movie).

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.

Non-UI version of live.gain~

The live,gain~ object is terrific for volume control of audio signals. It allows you to attenuate the volume down to -70 dB (by default), at which point it turns the volume completely to 0. In addition to the user-interface fader that live,gain~ provides, you can set the volume with a float message, in decibels, and it will quickly interpolate (in 10 ms by default) to the new volume to avoid clicks due to sudden changes.