Sample Accurate Counter

George Dennis's icon

Hi all,

I have a minor problem with a small part of a patch I am currently working on. Using a phasor~, I've constructed a simple signal-rate counter. Alongside increments in signal value I want it to output discrete max messages as well.

At the moment I can only get it to output a constant stream of numbers. Either that or it misses the odd step in the sequence, normally following multiples of 7 (as in the patch below).

Any help anybody could give me would be much appreciated!

Thanks.
_____

Max Patch
Copy patch and select New From Clipboard in Max.

jml's icon

Actually, what you've posted works fine here.
I would recommend checking in to your sig.VS and I.O.VS settings in the DSP Status window.

Currently, mine is set at 512/512.
jl

kjg's icon

> Any help anybody could give me would be much appreciated!
>

If you want it to really be sample accurate, don't rely on edge~. For what you seem to be wanting to do (...) this should be good, I think..

regards,
kjg

Max Patch
Copy patch and select New From Clipboard in Max.

George Dennis's icon

Thanks for the help!

jl, have changed vector settings and it works fine now. Thanks for the tip.

kjg, I like your version of the patch (and may have to use it in my final piece). Edge~ does seem to be a little problematic in terms of timing, but hopefully for my purposes I can probably accept the discrepancies in intervals between bangs. Do you know if a heavy cpu load would affect these intervals?

Cheers.

kjg's icon

Quote: george.r.dennis@gmail.com wrote on Fri, 22 February 2008 13:04

> kjg, I like your version of the patch (and may have to use it in my final piece). Edge~ does seem to be a little problematic in terms of timing, but hopefully for my purposes I can probably accept the discrepancies in intervals between bangs. Do you know if a heavy cpu load would affect these intervals?

edge~ output is non-audio, therefore it depends on the scheduler. to make the timing tighter, i think you should have max in overdrive. ti improve the timing further you could also enable the scheduler in audio interrupt option in the dsp status window.
when scheduler in audio interrupt is enabled, the maximum scheduler drift should be the vector size.
you can calculate this by doing vs/samplerate.
eg: 256/44100 = 5.8 msec, 64/44100 = 1.5 msec

good luck!

Eric Lyon's icon

If you don't mind third party externals, here's a reliable solution to sample accurate counting.

-Eric

Max Patch
Copy patch and select New From Clipboard in Max.

George Dennis's icon

kjg, thanks once again for the useful advice. Will have me a bit of a tinker when the patch is fully assembled to see what works best.

Eric, hi, sorry, I can't try out your patch as the new Manchester computers don't have all of your objects installed yet (although they are on the way...) It does look like it could be something of much use though.

Thanks for all the help! (Alexis says hi.)