{"action":"created","issue":{"url":"https://api.github.com/repos/supercollider/supercollider/issues/2343","repository_url":"https://api.github.com/repos/supercollider/supercollider","labels_url":"https://api.github.com/repos/supercollider/supercollider/issues/2343/labels{/name}","comments_url":"https://api.github.com/repos/supercollider/supercollider/issues/2343/comments","events_url":"https://api.github.com/repos/supercollider/supercollider/issues/2343/events","html_url":"https://github.com/supercollider/supercollider/issues/2343","id":177555211,"number":2343,"title":"Lag can magically init to the wrong value","user":{"login":"jamshark70","id":318301,"avatar_url":"https://avatars3.githubusercontent.com/u/318301?v=4","gravatar_id":"","url":"https://api.github.com/users/jamshark70","html_url":"https://github.com/jamshark70","followers_url":"https://api.github.com/users/jamshark70/followers","following_url":"https://api.github.com/users/jamshark70/following{/other_user}","gists_url":"https://api.github.com/users/jamshark70/gists{/gist_id}","starred_url":"https://api.github.com/users/jamshark70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamshark70/subscriptions","organizations_url":"https://api.github.com/users/jamshark70/orgs","repos_url":"https://api.github.com/users/jamshark70/repos","events_url":"https://api.github.com/users/jamshark70/events{/privacy}","received_events_url":"https://api.github.com/users/jamshark70/received_events","type":"User","site_admin":false},"labels":[{"id":4413795,"url":"https://api.github.com/repos/supercollider/supercollider/labels/bug","name":"bug","color":"fc2929","default":true},{"id":11974270,"url":"https://api.github.com/repos/supercollider/supercollider/labels/comp:%20server%20plugins","name":"comp: server plugins","color":"F4FF75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":28,"created_at":"2016-09-17T04:34:03Z","updated_at":"2018-03-26T13:13:23Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Another UGen init case. I would expect the first plot to hold 880 for 0.1 seconds, and then lag down to 220, and I'd expect the second to do the opposite. \n\nThat is, expected initial state: Impulse == 1.0 --> Trig1 == 1.0 --> Select initially outputs the second array item.\n\nIn fact, what happens is that both Lags seem to be initialized with the _first_ array items. The first plot ramps up from 220 to 880, and back down.\n\n```\n{\n    var trig = Trig1.kr(Impulse.kr(0), 0.1),\n    f = Select.kr(trig, [220, 880]);\n    Lag.kr(f, 0.2)\n}.plot(duration: 0.2);\n\n{\n    var trig = Trig1.kr(Impulse.kr(0), 0.1),\n    f = Select.kr(trig, [880, 220]);\n    Lag.kr(f, 0.2)\n}.plot(duration: 0.2);\n```\n\nMoreover, if you reverse the array items and invert the trigger, it still starts with the wrong item -- this plot is identical to the first above.\n\n```\n{\n    var trig = Trig1.kr(Impulse.kr(0), 0.1),\n    f = Select.kr(trig <= 0, [880, 220]);\n    Lag.kr(f, 0.2)\n}.plot(duration: 0.2);\n```\n\nThe most likely explanation is: I expect, initially, Impulse == 1.0 --> Trig1 == 1.0, but Impulse_Ctor is actually setting `ZOUT0(0) = 0.f;` -- so Lag then initializes as if the gate were off, even though the gate is open during the first calculation cycle. Impulse _must_ init to 0, or triggers won't work -- so Lag is making a mistake to initialize `unit->m_y1 = ZIN0(0);` in its Ctor.\n\nOh well, another one for the \"everything I try in SuperCollider is cursed\" file. I only wanted to pass in the previous frequency and get Lag behavior at the beginning of a Synth. Well, SC says I can't use Lag for this. I have to find something else (that will sound different). (Remember, this is me _backing away_ from exotic techniques and sticking to what I know... and I'm still screwed.)\n"},"comment":{"url":"https://api.github.com/repos/supercollider/supercollider/issues/comments/376160875","html_url":"https://github.com/supercollider/supercollider/issues/2343#issuecomment-376160875","issue_url":"https://api.github.com/repos/supercollider/supercollider/issues/2343","id":376160875,"user":{"login":"ssfrr","id":734386,"avatar_url":"https://avatars1.githubusercontent.com/u/734386?v=4","gravatar_id":"","url":"https://api.github.com/users/ssfrr","html_url":"https://github.com/ssfrr","followers_url":"https://api.github.com/users/ssfrr/followers","following_url":"https://api.github.com/users/ssfrr/following{/other_user}","gists_url":"https://api.github.com/users/ssfrr/gists{/gist_id}","starred_url":"https://api.github.com/users/ssfrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssfrr/subscriptions","organizations_url":"https://api.github.com/users/ssfrr/orgs","repos_url":"https://api.github.com/users/ssfrr/repos","events_url":"https://api.github.com/users/ssfrr/events{/privacy}","received_events_url":"https://api.github.com/users/ssfrr/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T13:13:23Z","updated_at":"2018-03-26T13:13:23Z","author_association":"NONE","body":"Another way to define a `PreSample` UGen would be to take an input signal that determines its output for `n >= 0`, so you'd use it like: `Lag.kr(PreSample.kr(1, trig), 0.05)`. And the `PreSample` would be a UGen outputting `y[n]=1` for `n < 0` and `y[n] = trig[n]` for `n >= 0`. That seems like a more complicated API than an `init` argument, but I don't have much handle on the SC internals so maybe there's a compelling argument against `init`."}}
{"actor":{"display_login":"ssfrr"}}