View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

measuring the delay between in- and output

The following patches can be used to do this - just plug your output of your soundcard into the input.
Writing this patch I realized that normal soundcards don't react properly on frequencies below say 20 Hz.


//sc2
Synth.scope({
	var in, out, lastTime;
	out = LFPulse.ar(100,  0.01);
	in = AudioIn.ar(1);
	Sequencer.ar({ lastTime = thisSynth.time; 0.0}, out);
	Sequencer.ar({  (thisSynth.time - lastTime * 1000).post; " ms".postln; 0.0}, in.abs > 0.1);
	[out, in]
});


//sc3
Synth.scope(#{
	var in, out, lastTime;
	
	out = LFPulse.ar(100, pi/4, 0.01);
	in = AudioIn.ar(1);
	Sequencer.ar({ lastTime = thisGroup.time; 0.0}, out);
	Sequencer.ar({ (thisGroup.time - lastTime * 1000).post; " ms".postln; 0.0}, in.abs > 0.1);
	[out, in]
});
	
//sc3 test the test
Synth.scope(#{
	var in, out, lastTime;
	
	out = LFPulse.ar(100, pi/4, 0.01);
	in = DelayN.ar(AudioIn.ar(1), 0.005, MouseX.kr([0, 0.005]));
	Sequencer.ar({ lastTime = thisGroup.time; 0.0}, out);
	Sequencer.ar({ (thisGroup.time - lastTime * 1000).post; " ms".postln; 0.0}, in.abs > 0.1);
	[out, in]
});
	



jrh
delaytime = (synthBlockSize + outBufferSize + inBufferSize + synthBlockSize) / sampleRate
on a powerbook g3 buffer size 512 blockSize 64, I got a delay of 0.00349 sec
with this patch.

Links to this Page