Adding a release tail to a sample

I’m still struggling with how to neatly use sections from a longer cycle. If I do as below, the envelope at the end of the sample is very short indeed, and you get a distinct click at the end:

d1 $ s "bev" # n 0 # begin (0/16) # end (1/16)

If I do as below, then it does not do what I would expect, which would be to play up to the ‘end’ and then add a release tail. Instead of being a ‘release’, it’s more like the ‘decay’ of an up-and-down a/d envelope:

d1 $ s "bev" # n 0 # begin (0/16) # end (1/16) # release 0.5

In the slicing sampler I use in SC, I have a fast attack but a release tail at the end of the sample of 0.1, which I find works well. How can I do that in Tidal? Do I need to hack SuperDirt?

Let’s see… in core-synths.scd I found a SynthDef called dirt_gate with an argument fadeTime. So… where does that value come from? An Event presumably?

Yes, looks like fadeTime comes from DirtEvent.scd but I can’t understand how it is defined there:

~fadeTime = min(~fadeTime.value, sustain * 0.19098);

But… unless I’m missing something here, it seems to me that SuperDirt is just not doing what most digital musicians would call a ‘release’. Adding a ‘release’ to a note should lengthen it: in SuperDirt, it (kind of) shortens it.

This terminology comes from SuperCollider. The standard there is: sustain is the total duration of a sound.

The release parameter is just an envelope effect, it doesn’t affect the total sustain.

The fadeTime parameter doesn’t affect the total sustain either, it is subtracted from it. I suppose for adding an extra tail, you’d have to modify DirtEvent a little:

Untested, maybe like this:

~fadeInTime = ~fadeInTime ?? { if(~begin != 0) { ~fadeTime } { 0.0 } };
~sustain = sustain - (~fadeTime + ~fadeInTime) + (~tail ? 0);

Then you can then send a tail from tidal that matches fadeTime, and also a fadeInTime sepeately.

1 Like

I will try the code you suggest.

It’s true that in SC the sustain is the length of the event, like the gate time in an analog synth. But, if you add a release to an SC envelope, the sound gets longer:

SynthDef(\blip, { |out= 0, freq = (60.midicps), nharm = 10, gate = 1, amp = 0.1, pan = 0.0, release = 0.01|
	var sig = * ((-2..2)/500 + 1), nharm); // five channels, detuned
	var env = release), gate, doneAction:2);
	sig = sig * env;,, center:pan) * amp)

// sound lasts for two beats
(instrument: \blip, sustain: 2, dur: 2, release: 0).play
// sound lasts for four beats
(instrument: \blip, sustain: 2, dur: 2, release: 2).play

Yes – release time is not subtracted from the gate.

In SC, sustain in an event means the number of beats between the note’s onset and the time when the gate is set to zero. The release phase happens after this time, and the release duration is added.

It’s possible that SuperDirt implements its envelopes differently (I do have SynthDefs in my setup that subtract the release time, but those are non-gated envelopes so they aren’t related to the Event meaning of sustain).