time between zero crossings

kkll's icon

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,

kkll's icon

what i mean is,

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

pdelges's icon

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

Not sure it is really exact...

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

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

oli larkin's icon

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

kkll's icon

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 :?

oli larkin's icon

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

oli

kkll's icon

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

oli larkin's icon
Max Patch
Copy patch and select New From Clipboard in Max.


kkll's icon

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 ..