[chuck-users] Question regarding Sample level timing.

Mike McGonagle mjmogo at gmail.com
Mon Feb 6 09:28:58 EST 2006


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


More information about the chuck-users mailing list