supercollider / supercollider

An audio server, programming language, and IDE for sound synthesis and algorithmic composition.
http://supercollider.github.io
GNU General Public License v3.0
5.5k stars 747 forks source link

Integrator init issue #4879

Open dkmayer opened 4 years ago

dkmayer commented 4 years ago

OSX 10.13.6, SC 3.11.0

// integration starts at 0 as expected

(
{
    var seq = Dseq([0, 1], inf);
    var sig = Duty.ar(SampleDur.ir, 0, seq);
    var sigInt = Integrator.ar(sig);
    [sig, sigInt]
}.plot(0.0002)
)

// integration starts at ... 2 !

(
{
    var seq = Dseq([1, 0], inf);
    var sig = Duty.ar(SampleDur.ir, 0, seq);
    var sigInt = Integrator.ar(sig);
    [sig, sigInt]
}.plot(0.0002)
)

https://www.listarc.bham.ac.uk/lists/sc-users/msg67175.html

jamshark70 commented 4 years ago

Integrator_Ctor() ends with Integrator_next(unit, 1);. So in the above reproducer, the ctor sets the running total to 1.

Then, the normal pass through UGens calls _next again, adding 1 a second time.

So this is another one of those "we haven't decided how the pre-sample should really be set, so it's basically up to whatever was convenient at the time" weird initialization bugs.

In the immediate case, we probably should just set the first output sample to the first input, and not call next at all.

dyfer commented 4 years ago

I think Mike is (gradually) working on this: https://github.com/mtmccrea/supercollider/projects/1