EnvGen releases incorrectly for early gate #1063
Comments
|
Actually, what happens in the first example is that Supercollider initialize the synth with gate=0 and not 1, probably because the message arrives before the synth starts. It behaves like this:
Supercollider creates synths that cannot be freed, because never received the message "gate:1->0", so they are waiting for any gate message. This is why Impulse.kr makes it work fine. Probably we should say to the program to accept n_set only when the Synth has started, but I don't know if it is a good idea. |
|
If I remember correctly, the problem persists when gate = 1 already in the definition:
So it is not about |
|
As I have certainly pointed out before: there is no solution to this problem without a way to distinguish between these two cases:
The issue keeps recurring, on the mailing list and in the issue tracker, in slightly different guises but I don't remember any of these cases where somebody proposed a concrete solution to this problem. So my opinion is, provisionally, that people like to complain about this behavior but not actually resolve the ambiguity... and that leaves the complaints in the territory of idle griping but not much more. IMO (and this is only my opinion), if you want the gate to be open at the start of the synth, it's your responsibility as a user to make sure this is the case. If there is a solution that allows the latter of the above two options to be the default -- without precluding the former -- I'm listening, but so far, I see only grousing about the current behavior but no viable proposal that doesn't kill the option of creating a synth whose gate you can open later. |
|
Wouldn't the general solution look like the following:
? |
|
Yes, I avoided on purpose n_set message, just to point that ... is interpreted like ... This just because the n_set message arrives to the Synth before the Synth has started, so strangely it seems to me that (but this is just a theory that I cannot prove):
I don't know if this is realistic, but it would explain the behaviour. And so the reason because the synths do not free in a so little time is that their initial gate was already 0 when created. For this reason the impulse works. % If I remember correctly, the problem persists when gate = 1 already in the definition: Yes, because in my opinion, a so rapid n_set doesn't care about the initial values of args. |
|
Even if you send the messages in a bundle, the notes hang, so I don't think this is the reason:
Btw. also my above solution doesn't work, because the
will have hanging notes, too. |
|
As James pointed out, the difficulty is that the control is set first to 1 and then to zero before any calculation has even happened. So the UGen, when it is initialized, only sees the last value that has been set. It is like coming into a dark room and trying to know whether the light had been on a second ago and switched off, or whether it has always been off. What we need in sclang is a way to clearly distinguish the two use cases: start at |
|
One could say that: If you intend to make the envelope wait until the gate is explicitly set to 1, you should initialize the gate with 0. Otherwise, sclang will add an In code:
We could leave it to the user, but the trick is very indirect and hard to understand (as this whole discussion shows). |
|
OK, here the suggestion:
|
… is set to 0 too early. This fixes problems with hanging notes (fixes #1063). But this fix changes behaviour: a gate with default = 1 won't be able to be set to 0 at init time (which one would want to do in order to open the gate later on). A gate with default = 0 will work as expected, however, so this patch may be a good solution even if it is a little risky.
|
I've added this to a branch |
|
I measured the delta time between init and release, and in the range I see the argument that you want to be able to start a synth with |
|
|
Or better:
|
|
This problem is fixed by 1e34f62. |
… is set to 0 too early. This fixes problems with hanging notes (fixes supercollider#1063). But this fix changes behaviour: a gate with default = 1 won't be able to be set to 0 at init time (which one would want to do in order to open the gate later on). A gate with default = 0 will work as expected, however, so this patch may be a good solution even if it is a little risky.
This bug might be related to #1023, and also to the discussion here: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/EnvGen-bug-td7599058.html
Here is a reproducer, creating three hanging synths:
Replacing the SynthDef by the following is a remedy, but not a really beautiful one:
The text was updated successfully, but these errors were encountered: