Phase Meter ...

quietquiet's icon

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

Tim Lloyd's icon

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

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

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

quietquiet's icon

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.

quietquiet's icon

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?

Tim Lloyd's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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:

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

quietquiet's icon

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

Tim Lloyd's icon

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.

quietquiet's icon

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

Roman Thilenius's icon

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

matman1000's icon

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!

4313.goniometer.rtf
rtf
matman1000's icon

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

$Adam's icon

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

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

Ha! Thanks Adam!

loadmess's icon

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

Thanks

duyduc's icon

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

Roman Thilenius's icon

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