Forums > MaxMSP

Phase Meter …

January 21, 2010 | 2:08 pm

Anyone know how to build a phase meter?
I’m after is the ability to stream data expressing the phase (0-180 degrees) difference between left and right of two audio signals.. Any help would be awesome..
Scope does this very nicely expressing in visual form only and has no outputs..(ie data outs)

thanks


January 21, 2010 | 6:21 pm

I’m not 100% sure this is correct, but I thought it was interesting so I had a go!

If someone more knowledgeable than myself can confirm this to be accurate, then you could convert the output to degrees and you’re sorted.

– Pasted Max Patch, click to expand. –

January 22, 2010 | 3:27 am

That’s exactly what I’ve been trying to hammer out. Thanks so much for your very awesome patch. Hopefully it will help other people too.


January 22, 2010 | 5:40 am

Hey Tim,
I’ve been nosing about the patch a bit more..
It seems if you feed perfectly out of phase audio, the meter still measures in the + range.
Could the patch be measuring the phase difference from 0 degrees(mono)
and phase difference from 180 degrees and expressing it equally in the + range only?


January 22, 2010 | 9:32 am

So it does…….It’s the way I’ve done the p_meter subpatch that is messing it up. If you get rid of the meter altogether the result of the +~ object shows perfectly in phase as 0 and perfectly out of phase as maximum deviation from 0:

– Pasted Max Patch, click to expand. –

Not got time to mess with the subpatch right now, but it shouldn’t be hard to make it work as expected.


January 25, 2010 | 10:31 am

thanks tim, Cat wait to check you new patch.
Kinda tied up at the mo but I do thank you for your help on this..
Much appreciated..


January 25, 2010 | 10:23 pm

I’ve not tried to fix the patch yet, but just had a thought. If you feed in perfectly out of phase audio (which implies the two channels being exactly the same and 180 degrees out of phase) it would result in the two signals canceling completely. So the way I’ve done it by phase-inverting one input means that the output will just be the sum of both signals, now completely in phase with each other if that makes sense.

I also have a feeling that to calculate the exact difference in phase angle between two signals you need to know the wavelength of both, which makes it almost impossible to do accurately in real-time.

I did a quick test with Logic, and playing 2 test oscillators at the same frequency, with one phase inverted the phase correlation in multimeter reads +1 just like my patch.

—— I guess you could have an rms meter before the inversion of one channel in my patch, and if the rms of the sum of both input channels was 0 it would mean the two channels were perfectly out of phase (ie 180 degrees)……which could then multiply the output of +~ by -1……………

Sorry but I’ve got a bit of an epic stint of uni work to finish over the next few days, I may have time to fiddle with it next week.


April 16, 2010 | 3:31 pm

Hi Timlloyd,
Hmmmm, Do you think the meter should have read +1? Perhaps your Logic experiment expresses the data "rectified"? What i’m trying to write should have a 180deg phase diff as reading -1(my range is -1 to +1 where 0 is 90deg phase diff i.e. perfect stereo) Its a tricky one hey but I’m sure there is a really simple way to deal with this kind of analysis…


April 18, 2010 | 12:47 pm

 
you answered it already in your question: a phasemeter shows the difference
between right and left: you could build one around [-~ ]

there are different methods of smoothing the output of [-~] … i would just
choose slide~ or rampsmooth~.

one could also get the rms power of say 25-200 milliseconds and then substract
the results from each other. in this case the "minus" could be done outside
the signal layer.

the question is if you really need to recreate the existing industry standards or
just make your own tool.

-110


August 17, 2012 | 12:25 pm

Ok, so I’m trying to build roughly the same thing, but it seems to be a little trickier to come up with – I’m sure the solution is simple.

See what you guys think of my rough patch. There are a few issues such as when one channel is off it goes to infinity – maybe this isn’t actually a problem as the slider will still read +1, but maybe it would be nice for it to recognise that the two channels are effectively completely different in this instance, and therefore the slider should read 0.

Anyway, really open to suggestions!

Attachments:
  1. goniometer.rtf

August 17, 2012 | 12:27 pm

P.S. copy the text and open as new from clipboard, it is a Max 6 file. Let me know if its not working for anyone and i’ll just put up a screen shot (its a very basic patch).


August 17, 2012 | 12:58 pm

Hi,

there’s a ‘copy compressed’ option in Max (I think it’s in the ‘Edit’ menu), if you select your full patch and then you choose ‘copy compressed’ from the menu, you’ll get a base64-formatted string on your clipboard that can be simply pasted into the forum. That’s actually the preferred way of sharing patches.

HTH,
Ádám


August 17, 2012 | 9:19 pm

Ha! Thanks Adam!

– Pasted Max Patch, click to expand. –

July 8, 2014 | 8:06 am

What do you recommend for reading more about measuring phase difference? I mean what have guys studied that enlighten you?

Thanks


July 9, 2014 | 7:58 am

P.S. copy the text and open as new from clipboard, it is a Max 6 file. Let me know if its not working for anyone and i’ll just put up a screen shot (its a very basic patch).

—————————————————————————–
My name’s Phuc . I love ve may bay & ve may bay gia re


July 13, 2014 | 12:14 pm

now thats some clever spambotting. soon they will fix our broken patches, too.


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