On Tue, 20 Oct 2009, Bjørn Nielsen wrote:

The lowest delay in ms I have reached before the sound gets quicky is 11ms, but it depends on whether I use Jackpilot and what audiointerface I use (the macbook internal soundcard can't do 11ms, but my mbox2 can). It was my impression that this delay is all the latency PD have,

I don't know, I'd risk saying that the delay in question is simply added to the base delay of the in/out system, but I wouldn't risk guaranteeing it without rereading all of the s_audio*.c code again... I forgot a fair bit of it.

In theory, the soundcard needs to fill a block before it can pass it to pd, then pd needs to process a whole block before a block of output is ready, and then the time it takes to play a block is a block duration, but if you look at the minimum time difference between in and out, you don't need to count the normal duration of the output block in there. So you only count blocksize once, and then, if the processing time is really smooth, then your minimum audiobuf size is the blocksize delay times the % of CPU that pd is using.

So if your patch takes 75% CPU and has 64-byte blocks at 48000 kHz, then you compute (1+75/100)*64/48000 = 0.002333... s = 2.333... ms; and you could set pd's audiobuf to (75/100)*64/48000 = 0.001 s = 1 ms exactly.

Obviously, this is not what you are getting, because the processing isn't that much smooth. This may depend on the speed of the multitasker in the OS itself, the quality of the realtime priority system, and various little hiccups that happen in Pd itself. Many Pd internals and externals make it hard, by expecting a file-open to take 0 ms of logical time, thus if it really takes 50 ms, then you need at least 50 ms - 0 ms = 50 ms of audiobuf on top of the minimum required audiobuf.

but maybe I'm wrong? Is it even possible to measure where in the system the latency occur?

The best you can do is make a laundry list of things be checking for, but Pd can't possibly have all the information.

Btw, can you get doc/7.stuff/tools/latency.pd to work? and how would one interpret that figure?

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to