home/ atoms/ sample-auto-sustain

Sample envelopes auto-set sustain to remaining sample length unless overridden

Unlike synth envelopes where sustain defaults to 0, sample envelopes set sustain automatically to however much of the sample is left after attack, decay and release are subtracted. This lets release: 0.75 fade out the last 0.75 beats of the sample without calculating sustain manually. Setting sustain: 0 explicitly overrides auto-sustain, restricting the sample to only the attack+release window. The envelope can reduce but never extend a sample beyond its natural length.

Examples

sample :drum_cymbal_open, attack: 0.01, sustain: 0, release: 0.1

percussive stab from open cymbal

Assessment

Use auto-sustain to add a 0.5-beat fade-in and 0.3-beat fade-out to :loop_amen. Then use sustain: 0 to create a 0.1-beat snare stab.

“sustain value defaults to an _automagical_ value - the time left to play the rest of the sample”
corpus · sonic-pi-built-in-tutorial · chunk 7