Absolute vs relative note length

I am pretty sure sustain sends an absolute value, regardless of the note length.

for example, in SuperCollider:

SynthDef (\drip) {
	arg out = 0, sustain = 1, freq = 440, pan = 0, amp = 0.2;
	var env, sig;

	env = Env.perc (0.02, sustain - 0.02);
	env = EnvGen.kr (env, doneAction: 2);

	sig = SinOsc.ar (freq * (2 ** (1 - env)), 0, env);
	sig = Pan2.ar (sig, pan, amp);

	OffsetOut.ar (out, sig);

^ the synth's audible duration is sustain seconds

in Tidal:

setcps (120 / 60 / 4)

d1 $ n "0!1" # s "drip"
# sustain "1"

evaluating this pattern at this tempo should make it clear that the sustain value being sent to the synth is 1, regardless of the actual length of the note event. In the above example, the note last for 2 seconds (the whole cycle), but the synth only lasts for 1 second.

similarly, with this pattern:

d1 $ n "0!4" # s "drip"
# sustain "1"

here we can see that the note event has a length of 0.5 seconds, but the synth's audible duration is 1 second still, causing the sounds to overlap each other.

I was wondering how to access the relative note length, ie. the length of the note event after all manipulations / subdivisions have been applied, and how this could be made visible to a custom synthesiser in SuperCollider?

I think you want legato

1 Like
d1 $ n "0!16" # s "drip"
# sustain 1 # legato 1

^ this, for example is still giving an audible synthesised note length of 1 second rather than the length of a semiquaver. Changing the argument given to legato to 0, and 10 and 100 doesn't seem to affect the sound in any way. Giving a negative value to legato throws an error.

however, it is quite likely that I am trying to use it completely wrong - very much a beginner in haskell land

Leaving sustain in the mix is what's messing you up

legato changes the note length, relative to the event length.

sound "superhammond"
# legato 1

Will have no effect, because 1 refers to the full value of the event length.

sound "superhammond"
# legato 0.5

Will contain the note length to half of the event length (in this case, half a cycle)

It is relative to event length, so if you add more events of different length...

struct "< t*4 t*2 t*1 t(3,8) >"
$ sound "superhammond"
# legato 0.5

brilliant - thanks @cleary :pray: