Forums > MaxMSP

time between zero crossings


October 7, 2008 | 10:39 am

hi,

i am having a whale of a time trying to measure the time between zero crossings in a wave form (in samples).

everytime i think i get close i realise it relies on bangs.. and bangs don’t seem accurate enough :( after all you can fit 44 samples between bangs… more or less :)

basically what i want to do is, have any wave input (complex, sine whatever), then measure the time between every time it crosses zero..( the y-axis i suppose)….

thanks in confusion,

October 7, 2008 | 10:59 am

what i mean is,

can anyone suggest a method to help me ?? :)

October 7, 2008 | 1:37 pm

Here are some ideas (for real time, and for non real time analyse on a
buffer)

Not sure it is really exact…

– Pasted Max Patch, click to expand. –

On 7 oct. 08, at 12:40, ccjj wrote:

>
> hi,
>
> i am having a whale of a time trying to measure the time between
> zero crossings in a wave form (in samples).
>
> everytime i think i get close i realise it relies on bangs.. and
> bangs don’t seem accurate enough :( after all you can fit 44 samples
> between bangs… more or less :)
>
> basically what i want to do is, have any wave input (complex, sine
> whatever), then measure the time between every time it crosses zero..
> ( the y-axis i suppose)….

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl
http://www.crfmw.be/max

October 7, 2008 | 3:56 pm

here is an external that counts the samples between impulses (signal of +1). You can use it with zerox~ to get the number of samples between zero crossings at samplerate

oli

October 7, 2008 | 11:00 pm

thanks for your replies :)
but i can’t open any :(
i don’t think it helped that i didnt give my details –
Max 4.5.5 on windows xp.

so Patrick Delges, I don’t know if I can use that code.

and oli larkin,
the errors i get with your files are__

error: error 14001 loading external ol.sampletime~
and the sampletimertest.maxpat comes out as code. I don’t know what to do with that.

and to Shea Ako
error: trans_timer~: No such object
there is the trans_timer~.mxo folder, but I have no idea what that is :?

October 8, 2008 | 8:25 am

i think to use that external you need to install the MS visual studio 2008 redistributable package, which can be found here:

http://tinyurl.com/4rcnl9

oli

October 8, 2008 | 10:11 am

oli, thanks,i installed the visual studio,
now the ol.sampletimer~ works as an object,
but the test patch comes out as text/code.

so basically i can’t work out what/how the ol.sampletimer~ does/works :P
tried connecting a cycle~ into the top, and a signal monitor and flownumber to the bottom. but it doesnt really give me anyhting i can recognise :)

i have however got to a new point in my development.
running the wave through a zerox~, with the click going into a +=~ accumulator.
into a buffer, the accumuluator gives the index and a running counter gives a number into the index, if i deduct previous index point value it gives me a sample value of time !! hooray !!

The problem now is to access these values in useable timing. am trying the play~ object so I can run a signal value in for index, but this creates problem with having to define a buffer~ size…

hmmmm, it will wait until tomorrow

thanks

October 8, 2008 | 10:57 am

#P user ezdac~ 418 78 462 111 0;
#P window setfont Tahoma 9.;
#P user number~ 254 228 344 242 9 268 2 2 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Tahoma 10.;
#P window linecount 1;
#P newex 142 105 39 17563658 zerox~;
#P newex 123 71 46 17563658 cycle~ 1;
#P newex 203 154 78 17563658 ol.sampletimer~;
#P connect 0 0 3 0;
#P connect 2 1 0 0;
#P connect 1 0 2 0;
#P window clipboard copycount 5;

October 16, 2008 | 2:28 am

thanks,

the ol.sampletimer~ works great !! am curious as to the other output ??

of course now i need to know how to get an amplitude figure between zero crossings :P
was initially hoping that i’d make the zero crossing counter object and then use techniques for that ..

have set up another topic
http://www.cycling74.com/forums/index.php?t=msg&goto=155056&rid=7826&S=eb34152a19cf0b36b4d1a6e3cc7989ea#msg_155056

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

Forums > MaxMSP