Skip to content

Options

Here is an overview of all options for an envelope (same for the adsr function and the Adsr class).

type AdsrOpts = Partial<{
attackDuration: number;
decayDuration: number;
releaseDuration: number;
initialLevel: number;
peakLevel: number;
releaseLevel: number;
sustainLevel: number;
attackBend: number;
decayBend: number;
releaseBend: number;
retrigger: boolean;
shouldLoop: boolean;
}>

All values are optional, meaning you only have to provide the ones you want.

PropertyDetails
DurationDuration values are given in milliseconds. These are the length of each stage. They are the most common things to change.
LevelLevel properties are 0..1, representing the maximum value at each stage.
BendBend values run from -1 to 1. A value of 0 means there is no bend (ie. straight line), -1 pulls curve down, and 1 pushes it outward.
Etcretrigger means a retriggered envelope continues its value from what it is at the point of retrigger. By default, as retrigger is false, envelope always start 0 (or whatever initialLevel is set to). shouldLoop: if true envelope will repeat. Default: false.