[chuck-users] Chuck Latency

Tom Aizenberg tom at tomaizenberg.nl
Wed Aug 24 15:44:46 EDT 2011


Hi, I'm not sure, but this seems to have to do something with your
soundcard-driver. You probably need ASIO drivers, check out ASIO4ALL if you
do not have an expensive soundcard. Then you will also need a ChucK version
compiled with ASIO, to be found somewhere on this page:
http://electro-music.com/forum/topic-18931.html.

 

Good luck!

 

Van: chuck-users-bounces at lists.cs.princeton.edu
[mailto:chuck-users-bounces at lists.cs.princeton.edu] Namens Kyle Hipke
Verzonden: woensdag 24 augustus 2011 21:30
Aan: chuck-users at lists.cs.princeton.edu
Onderwerp: [chuck-users] Chuck Latency

 

I'm working on a project that requires low latency peak detection. But I'm
struggling with the low-latency part. I'm not sure if there's just a problem
with chuck, my code, or if my computer is slow. I'm on an Intel Core 2 Duo
2.13 GHz processor.
The following code illustrates the problem:

time chrono;

 

Impulse i => dac;

 

adc => Gain g => OnePole p => blackhole;

adc => g;

3 => g.op;

.9999 => p.pole;

 

now => time start;

 

10::samp => dur peakPollRate;

 

//ADJUST THIS

.001 => float threshold;

 

spork ~makeImpulses();

while (1) {  

    if (p.last() > threshold) {

       <<< "peak at", (now - chrono) /ms >>>;

        .2::second => now;

    }

    

    peakPollRate => now;

}

 

fun void makeImpulses() {

            while (true) {

                        1 => i.next;

                        .8::second => now;

                        <<< "Impulse at ", (now - start) / ms >>>;

            }

}

 

This code uses an impulse as a metronome and listens to the adc through a
OnePole filter for peaks above a threshold.

Here's two ways to demonstrate the problem (you'll need speakers and a mic):
1. With headphones in, adjust the threshold as low as possible without
picking up room noise (under //ADJUST THIS) then run the code. Make a
percussive sound into your mic that coincides with one of the impulses, then
kill chuck and look at the output. On my machine, it detects the peak ~200ms
after the metronome, even though I made the sound immediately when I heard
the metronome.

2. With speakers on, adjust the threshold and your speaker volume so that
the Impulses are detected as peaks, but no room noise is. Run the program
for a few clicks and kill it, then look at the output. On my machine, again,
I get a ~200ms delay.

Do other people have this same problem? Why is this happening?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20110824/15879c6e/attachment.htm>


More information about the chuck-users mailing list