Question regarding Sample level timing.
Hello all, I wrote this test this morning, and something seems amiss here with timing. Or am I understanding this wrong? /* The following code doesn't seem to work properly, as there appears to be a 2 sample delay from when the impulse is triggered from what is expected. as the 'doit' function is started at time 0.0, I would think that each and every impulse would be generated at 100::ms intervals, starting at 0.0, and not 2.0 The code generates the output below... */ impulse i => blackhole; fun void doit() { while(true) { 1.0 => i.next; 100::ms => now; } } now + 1::second => time later; spork ~ doit(); while(now < later) { i.last() => float val; if (val != 0.0) { <<< now, i.last() >>>; } 1::samp => now; } /* 2.000000 1.000000 4412.000000 1.000000 8822.000000 1.000000 13232.000000 1.000000 17642.000000 1.000000 22052.000000 1.000000 26462.000000 1.000000 30872.000000 1.000000 35282.000000 1.000000 39692.000000 1.000000 */ Thanks, Mike
Hi Mike!
impulse i => blackhole;
fun void doit() { while(true) { 1.0 => i.next; 100::ms => now; } }
now + 1::second => time later;
spork ~ doit();
while(now < later) { i.last() => float val; if (val != 0.0) { <<< now, i.last() >>>; } 1::samp => now; }
Interesting. There should be exactly 1 sample of offset, not 2, since chucking to i.next sets the next sample, which isn't detected by .last() until after time=1.0, when the sample is actually generated. I looked into this and tracked down the "bug" that added one extra samp's offset to .last. This has been fixed and committed to CVS, and will be in 1.2.0.5. There should be only 1 samp of offset now. Thanks for reporting this! Best, Ge!
If I could make a suggestion and have a footnote added to the
documentation mentioning this action about setting next, and that it
will actually have the value offset by 1 sample. While this makes
perfect sense, it might seem a little odd when unfamiliar with this.
Mike
On 2/6/06, Ge Wang
Hi Mike!
impulse i => blackhole;
fun void doit() { while(true) { 1.0 => i.next; 100::ms => now; } }
now + 1::second => time later;
spork ~ doit();
while(now < later) { i.last() => float val; if (val != 0.0) { <<< now, i.last() >>>; } 1::samp => now; }
Interesting. There should be exactly 1 sample of offset, not 2, since chucking to i.next sets the next sample, which isn't detected by .last() until after time=1.0, when the sample is actually generated.
I looked into this and tracked down the "bug" that added one extra samp's offset to .last. This has been fixed and committed to CVS, and will be in 1.2.0.5. There should be only 1 samp of offset now. Thanks for reporting this!
Best, Ge! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Help the Environment, Plant a Bush back in Texas!
Greetings,
If I could make a suggestion and have a footnote added to the documentation mentioning this action about setting next, and that it will actually have the value offset by 1 sample. While this makes perfect sense, it might seem a little odd when unfamiliar with this.
Good idea - I added a potentially incoherent blurb about this behavior in the ugen documentations: http://chuck.cs.princeton.edu/doc/program/ugen_full.html#impulse I hope this will help things. Best, Ge!
participants (2)
-
Ge Wang
-
Mike McGonagle