Help with freq detection… Bug in spike~ ?
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?
----------begin_max5_patcher---------- 646.3ocyW10aaBCEF9ZxuBKtZSpKBis4icwj1uiopIGvMwafMBbTyZUyu84O fT1JogDZ93FP9XGy64w97Zmmm44uPtg03C9J3G.Oumm44YCYB3011yujtIqf 1XGlelrrjIT9245Sw1nrwqX0bYN3SkMetqOdtsG4he8kztXOHEJAsjY6460b ZQ+dZ3OY6AFNOnMrXcIWTvT1uN70fx0ptncCshpxVwEK+YMKS4xoPLTOS.LI 17J1Lsfvf4Af6M+jWlMy73tIl5pU0rlUxBc1alZkDn+nCQgjqDEvgDShiRSL ufgmGLTstngAdjmqVcHPDes.Awl5nP61AHI37.h2sT.csJEPotbG+ATJvdJm lscfrC5OjXCOVwhfVwRbaUwjtmmjXenPp+vCHV7Hrkb5U8mJlSYlYipWyA9K nhk9f6m7ZV36fAWEKJLxRioscc+XXDki5eYNKiWRKpJnYtiLhtIPDrEQ18Hw 3IgHA6QMPdqAeMkK1BfAAAff4vgPH5D1I0vWJLceJbBc7bxU9GYs9RgmCNUU ye0NrukWzUxyqMowI1sEH74o9IBcqaizhA2sfROS1HjjacLDC6cMnI5ltmRf usU6PPFhNwmtCwQgkgOqEdXmAGVbm09QiklJ9uYCceARzIuo4hPELxcCjnAo hUB9Ebw++enrSnI9+hpF455rtrn6FHffcYRNqQwETEWJ5OHs+B.taPq344LQ emuRddkTa81JBbP7bhdAk3dEg20ZOKoiVsnQnVyF8dC5fpEElX0WhSl8ZMU0 FOV1dDpchZx3QNNBdDq2nj.CyvtKKaNg+MsPotS.I3cslZlLF5ZptujzMZDZ J5xthGMlZFzT3jtwKy9Kr8IEBB -----------end_max5_patcher-----------
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~]…
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.
[x] Scheduler in Overdrive
[x] in Audio Interrupt
got rid of 0.0 errors but then my computer froze :)