Envelope options
import { Envelopes } from 'https://unpkg.com/ixfx/dist/modulation.js';
import { IterableAsync } from 'https://unpkg.com/ixfx/dist/util.js';
const opts = {
attackDuration: 1000,
releaseDuration: 1000,
sustainLevel: 1,
attackBend: 1,
decayBend: -1
};
// Add data to array
// Sample an envelope every 20ms into an array
const data = await IterableAsync.toArray(Envelopes.adsrIterable(opts, 20));
// Iterate with `for await`
// Work with values as sampled
for await (const v of Envelopes.adsrIterable(opts, 5)) {
// Work with envelope value `v`...
}
Creates and runs an envelope, sampling its values at
sampleRateMs
. Note that if the envelope loops, iterator never returns.