The default envelope in Dittytoy is the ADSR (attack, decay, sustain, duration, release) envelope.
dittytoy.net/syntax#envelopes
#dittytoy #tutorial
Log in to post a comment.
// #14 ADSR Envelope. DittyToy 2022. // The MIT License. // // https://dittytoy.net/ditty/34e1600f63 // // The default envelope in Dittytoy is the ADSR (attack, decay, sustain, duration, release) envelope. // Note: attack, decay and release are in seconds, duration in ticks. // // adsr envelope: https://dittytoy.net/ditty/34e1600f63 // adsr2 envelope: https://dittytoy.net/ditty/0f2e4c2cdd // segmented envelope: https://dittytoy.net/ditty/ce63852ccf // // https://dittytoy.net/syntax#envelopes // input.attack = 0.1; // min=0, max=0.2, step=0.001 input.decay = 0.2; // min=0, max=2, step=0.001 input.duration = 1.0; // min=0, max=2, step=0.001 input.sustain = 0.5; // min=0, max=1, step=0.001 input.release = 0.5; // min=0, max=2, step=0.001 input.curve = -2; // min=-9, max=9, step=0.1 // signalProbe - by athibaul const signalProbe = filter.def( class { process(input) { debug.probe('signal', input[0]+input[1], 2, 1); return input; } }); loop( () => { sine.play(c, { attack: input.attack, // attack in seconds decay: input.decay, // decay in seconds sustain: input.sustain, release: input.release, // release in seconds curve: input.curve, // you can also set an array [0, -3, -3] with different curves for the attack, decay and release phase duration: input.duration, // duration in ticks! env: adsr }); sleep( Math.max(second_to_tick(input.attack + input.decay), input.duration) + second_to_tick(input.release) + 1); }, { name: 'ADSR envelope' }).connect( signalProbe.create() );;