# Re: [sc-dev] Event's sustain

At Sun, 30 Nov 2014 15:34:20 +0100,
yota morimoto wrote:
> But I was talking legato's relation to tempo and not faster rhythm in terms of subdivision.

At risk of flogging the proverbial dead horse... tempo is largely irrelevant here. The only thing that is relevant is the relationship between the "inter-onset interval" between notes (in Events, the \delta time converted into seconds, i.e. ~delta / thisThread.clock.tempo) and the envelope's attack and release phases. Tempo only *seems* to be relevant because it changes the inter-onset interval in seconds, but it isn't the only thing that changes the inter-onset interval. So, a "fix" for the issue that involves only the clock's tempo is not a valid fix.

To prove it, here's a version of the default SynthDef with a variable release time.

s.boot;

(
SynthDef(\default2, { arg out=0, freq=440, amp=0.1, pan=0, gate=1, releaseTime = 0.3;
var z;
z = LPF.ar(
Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3, 0.3)),
XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)
) * Linen.kr(gate, 0.01, 0.7, releaseTime, 2);
OffsetOut.ar(out, Pan2.ar(z, pan, amp));
)

/*
And, here's an event prototype that adjusts sustain time according to the clock's tempo.
*/

e = Event.default.put(\sustain, #{ ~dur * ~legato * ~stretch / thisThread.clock.tempo });

/*
When you play this at tempo = 1 beat per second, indeed, you can hear separation between the notes. I think this is more like portato rather than staccato, though.
*/

p = Pbind(\instrument, \default2, \dur, 1, \legato, 0.5).play(protoEvent: e);

p.stop;

/*
Same thing, but changing the note value without changing tempo. This reproduces exactly the behavior you observed before: the notes overlap. The proposed fix hasn't done anything for this scenario because the tempo is unchanged. What has changed is the relationship between envelope times and IOI. Formerly, (attack + release) / IOI was 0.31; now it's 2.48. The release alone is more than twice the IOI -- of course the notes overlap.
*/

p = Pbind(\instrument, \default2, \dur, 0.125, \legato, 0.5).play(protoEvent: e);

p.stop;

/*
Now, replace the 300 ms default release time with 40 ms, and the notes are again clearly separated. (Attack + release) / IOI = 0.4.
*/

p = Pbind(\instrument, \default2, \dur, 0.125, \legato, 0.5, \releaseTime, 0.04).play(protoEvent: e);

p.stop;

hjh

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/