lichen-community-systems / Flocking

Flocking - Creative audio synthesis for the Web
GNU General Public License v2.0
695 stars 60 forks source link

flock.ugen.asr does not support very fast attack or release times #200

Closed colinbdclark closed 7 years ago

colinbdclark commented 7 years ago

The flock.ugen.asr unit generator seems to output silence when a user specifies a very short attack time. In informal testing, anything faster than about 0.0001 seconds will cause the envelope to not correctly trigger. Here's an example:

flock.synth({
    synthDef: {
        ugen: "flock.ugen.sinOsc",
        freq: 440,
        mul: {
            ugen: "flock.ugen.asr",
            attack: 0,
            sustain: 0.25,
            release: 0.1,
            gate: {
                ugen: "flock.ugen.mouse.click"
            }
        }
    }
});

Similarly, fast attack times cause the envelope to never fully close:

flock.synth({
    synthDef: {
        ugen: "flock.ugen.sinOsc",
        freq: 440,
        mul: {
            ugen: "flock.ugen.asr",
            attack: 0.01,
            sustain: 0.25,
            release: 0,
            gate: {
                ugen: "flock.ugen.mouse.click"
            }
        }
    }
});

This means, among other things, that square envelopes aren't possible.