Forums > MaxMSP

Help with freq detection… Bug in spike~ ?

Nov 05 2010 | 6:05 am


I’m using [spike~] to calculate the frequency of a signal that’s essentially a pulse train. Using [train~] as test input, I discovered that [spike~] starts outputting faulty values when the period drops below 3ms, and seriously messes up when the period is less than 1ms. The compressed test patch I’m using to test [spike~] is included below.

It looks like [spike~] wasn’t intended to detect periods below a certain threshold.

Can anyone suggest another approach to detect frequency of a pulse train signal that ranges from 6 to 5000 Hz?

Thank you,

-- Pasted Max Patch, click to expand. --

Nov 05 2010 | 11:50 am

seems like [spike~] calculates the intervals only between signal vectors, as opposed to [zerox~] which calculates the zerocrossings within _one_ signal vector.

Try setting the signal vector size to 1 sample and see if you can sufficient accurate readings with [spike~]…

Nov 05 2010 | 3:13 pm

mudang, thank you! I’m new to msp and never would have guessed this.

setting vector size to 1 works for periods less than 1ms, but I still am getting errors coming from [spike~]:

[train~] = 0.2ms
[spike~] = one of following 3 values at random (?)


I think I can do some averaging to get a constant number, but the 0.0 output is weird.

Thanks again!

Nov 05 2010 | 3:32 pm

DSP Status
[x] Scheduler in Overdrive
[x] in Audio Interrupt

got rid of 0.0 errors but then my computer froze :)

Viewing 4 posts - 1 through 4 (of 4 total)

Forums > MaxMSP