Score

level(...) and xfade(...) --- A Fader for Each Sound

Every sound has a fader, named as the sound is. level() moves it -- at once, or over beats, along a curve -- and xfade() moves two at once, one down and one up. The sound keeps running at any level: bring it back with another level(). (hush() is the one that stops it.)

Syntax

level(NAME, TO, BEATS, CURVE) level([NAME, NAME], TO, BEATS) level(all, TO, BEATS) xfade(FROM_NAME, TO_NAME, BEATS, CURVE)

Parameters

param required description
names ✔ The sound's uid (noise), a list ([noise, bass]), or all (every sound playing, and every one given a level before). Or uid: with one or a list.
to ✖ The level: 1 as the sound was written (its own amp), 0 silent, up to 2. Second positional, or to:. 1 if left out.
beats ✖ How long the move takes; 0 or left out: at once. Third positional, or dur:.
curve ✖ lin (the default), exp2, exp3, exp4, log, sqrt -- the curves of follow(), bent so the quiet end lasts: exp3 falls fast and lingers low going down, and starts slowly coming up, as fades are heard. Or curve:.

For xfade, the first sound goes to 0 and the second to 1 over the beats (4 if left out). Without a curve the two cross at equal power, so the middle does not dip.

Examples

level(noise, 0, 12) noise fades out over 12 beats and keeps running level(noise, 1, 4) ... and back level([noise, bass], 0.5, 8, exp3) two at once, along a curve level(all, 0, 24, exp3) the end of the piece

A level going up on a sound not yet heard fades it in from silence -- the line and the level together, in either order:

synth(uid:noise, wave:pink, amp:1) level(noise, 1, 12, exp3) noise fades in over 12 beats

Run before the sound, level() waits for it to start: not a moment of it is heard before the fade. Run just after (within half a second, with no voice of it playing before), it takes the fader to 0 and brings it up from there -- but the sound has started at its own level, and that moment is heard. So in a #$ block, or with Ctrl+Shift+Enter, the console runs a level() that fades in before the other lines, wherever it is written. Run line by line, run the level() first. On a sound that has been playing, it moves the fader from where it is, as always.

A sound can also start silent, to be crossfaded in later:

level(bass, 0) synth(uid:bass, wave:saw, freq:Pwhite(40, 90), dur:0.25) xfade(noise, bass, 8)

Notes

Solo — solo()

Everything cut but one sound, as a musical event: the wall of noise drops and a single sine is left alone, then the wall slams back.

solo(sine) everything else cut, now solo(sine, 4) for 4 beats, then everything back solo(sine, 4, quant:4) the cut on the next bar, back 4 beats later solo(sine, 4, boost:2) the sine twice as loud while it is alone solo(sine, 4, fade:2) a duck over 2 beats instead of a cut solo(sine, 0.5, trig:every(16, beat.hit)) a half-beat hole every 16 beats synth(uid:sine, ..., trig:wait) the sine waits for its solo: run with its block, silent solo([sine, kick], 2) several -- or a group solo(off) all back now (and a trig: solo no longer comes round)

See also

Tip: use ← → or ↑ ↓ to navigate the docs