Continuing the discussion from What is tidal doing with SynthDef envelopes?:
I have also noticed the same thing: it can be hard to get the sustain to ring out nicely on note events, and it feels like the synth instance gets freed before its doneAction if the doneAction would come after the end of an event's arc.
Coming back to TidalCycles from Strudel, I also realized this is part of the reason that I (subjectively) prefer the sound of Strudel.
Compare something like this pattern in strudel where the notes resonate nicely
note("<g [d,a] <d!5 g> - <- <g f e>@2>>*8").sound("piano")
.off(3/8, x=>x.add(note("7")).fast(2).gain(0.25).color('red'))
To this in tidal cycles, where the notes don't resonate out:
d1
$ off (3/8) ((# gain 0.8) . (fast 2) . (+ note 7))
$ note "<g [d,a] <d!5 g> - <- <g f e>@2>>*8"
# sound "superpiano"
Of course, it is possible to add # sustain 2, but then how would I go about writing a synthdef
which uses an ADSR envelope? I'd like for legato/sustain to control the S part of the ADSR,
but still let the release play out.
I could maybe do some math on the begin and end arguments in the SynthDef, but this feels awkward compared to just doing the natural thing and letting the event's arc/time act
like a gate, with a different parameter for the release.
I started digging around in SuperDirt to try to understand what the exact behavior is, but I haven't quite figured out what I would need to change if I wanted to customize this behavior.
I see where events get their parameters here:
And how an event calculates its duration here:
But it's not immediately clear to me how this frees/ends sounds that might play out longer.