Phase Meter …
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)
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. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1452.3oc4Z1sbiZCE.9Z6mBMz613jQBL3P6z2fc5E8hdSZZFAHaqcAIJH6jr 6r9Yu5GvFrArbhSpyrWD.qeOmOczQRGkuOdjSD+IRoC3WA2AFM56iGMRmjJg QU+djSF9o3TbotXNrUYQjhMNSL4kiEwKorEOTPhEl1AcK7F3D.JT+JLP8zEc CDbeUcJoKTkTksIAZhto4Qe45ff5VdNmIJoeinxB4tsrY7DcRtU+VJOTVJQT tWh7Uh8S0jj34bhQPUBBCm5LA3LOkikh+8M5aFNSWNm+hTjfYXGUV+X7X0iI VBqXdVFgIpUIA4IMib9LeAM9ZR4+BxWhKIfXdQAIEKnbFHiHHECf2PeMPmYd gNDuMoo+QnYK5g5jdvyLSXjGkh1AHIGj+vwTcDrok0LuAUcuWupi5yvwFykl pgTqL.ohHxpPSIqIEkxQ7F8zHmcJqanR8BzOcglg4fY6TVImWjxi+JIownzH mDx7SoM34D1txq4ZqGsKIkkWPJkVzZS086W7pTwCcS614OGGS5sx8.xQNKJn IblRLZUWUx0c3c.8rB+lxsNeFNuipJ37zHbwZZIMJkzZbPZCiYzLrfHnF4wE tsdzr7BJSzpsHLrrMVVFWvSSa0TlbV2QNIj0zXxizDwxVND2ysbC6lVytZk9 PyxZOS6SfqQ2zLmtloo4HZp90T39Sz1exl+sMaudLA5yac+S7rYx2v9lFU6e x7wjyOMuBXKLMdr8lcTXN6mVXVfyxKy3bwxMRpAg5GVQ2aMLNH3Xz06EYp58 xna0FLtTvqxMX4RtXiZkT6LZqdAcOFWQA+zZ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bB9txIOarm1Sveysw g1vIzqPlj+3Gi+OvEnya0 -----------end_max5_patcher-----------
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.
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?
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. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 573.3oc2V9saaBCEF+Z3ovxWtkFgM+Yg9fzalplb.mDOA1HriVxpZd1mw1jP WSSnPJqZ2.hiOX9N+36bfm78fKE6nRH3dv2AddO464YB0DvycsGrjrKqfHMo AyDkkTtBNytlhtS4hWWSKHJlf2tFeaoXqpfpL2YfK5JAWIY+l1DCgm2Flka1 FwxedGJE1IWNozjK7AZcNgSZWqhnx1v3q+QMMSYq.zh.89ARhiaN8MyQLZd. 3wSJhwaEDpI1y99MGlMxpuhVuRKih8.cECDq.UaHR5f.QUMUpeDFR1o1vKRa JmHr4Tf6vwJqK9RFH9vHCwhPlcGEg+WvOFeDrqKEhGpIJ0PgPqWBgVb6oPIU JIqouhB2gNeUitbUayTsuhZq.H7nTeKyTbj4McXvUMSgiqWzYlBwyi0vL8sn H9FRwaND6hC7PwQRWW0GANzavRZ8gyW7XWzRQNs608EFR1ZNo.NC.WUHHpSr Qufou7bsfCcNjcvsaJNJ3JigFDqn+RKvW4b9xAvspEzArq1HhPltDaIeoFwA ONCa6CirmRmLX90CSJIQ1BLIJ4ZjLbb1R6LyjvlN3+ScksrzZNuDKiFGKCrl x3IyTlsOqfdPOTIH3ignc+VwnXi6KEKdGrwjArfw+6+n27PZh+RfIEaqyZKj 1O1CN8fxoREia+k9SIoGDAPGyYCKOmx69qYkr7JAiqbZ.73Ye60aIg+7Iodn nnWjymAEEOoJpOFojIUQw8PQgSpOJpmJZnLRewy9+A.GgzZ7 -----------end_max5_patcher-----------
Not got time to mess with the subpatch right now, but it shouldn’t be hard to make it work as expected.
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..
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.
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…
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.
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!
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).
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.
Ha! Thanks Adam!
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 930.3oc6YtsbaBCDF9Z6mBFtr0lJsRhC8t9bj1oCFq3nTLjAvo4vD+rWIgwN I0FDINJj5dCisDd09+wpcWgue7H2Y42vKcc9pyYNiFc+3QizCoFXzluOxcY7 MIowk5ayMIe4RdVk6j54p32ToGG88rlwtJtJ4BQ1heVvSppsMI.6gBnTDLwg I+bH3SCBl3fYHOzDGPNqyO17yEy0FLe1kS88ar444YUYwK45o9VgHNsYlrUK EYo7Js6g2MX9pplQQOxHkh6zFACdH0nOLdr5xjWo7wsHdZ.3E.ARIuewiNf3 YeTD+z1TODP7X8S3zglvOOMWZ6l0tdMpt8JdsBUSGKohi6r3rEtakz91G3qg AFG4ICHBH9RvzNKfcnsPRhJdwO4YwyR4OWhuXNACQNgo8jS3SRNQCYJpzCNg NM4DombhEcZxIFUQEpLMkrbsrpcmb5DM+DAqyOEJimjATgcgI51FYjxUrT5C xYlJ654UAOo1Zr0NSYWhlw+sTe+UGAeZsziNHmKEKxjpvfB..HacBEAXxDYs yVIbe6VB1KZvCxMkfN4kwAaj+Gr0qfsMUG.IP8I.P5NXCFZAaG.MI2ljxW6P Qni.ev9XOEdvxpB9gswGRzPiO5380crYr8DR9dfLiDAHJkGp2AhIGP+rdTeC +dHmMORMSMz2X0b7xTR0suPXpLTcjkj.mxc3wPXuHb.g0Y0D3C0IFdSyC1bp TiyChCFb4AWkVIJSEy4EGjDp3nV4.DpaHgQYdQLDkDoHfNQBv7BC7QDX6Ou5 BQxux30KOYOHJrwOlsHIOMundIzaf2c4w7ssvv7BAOqJtRjm83gMIF73ErMs s1QLnRCMvKPFlQqoLAzMBenHL5GjNQ9xQBJLhAPgLzfB+t4wIqa4sjFfn0IR pO+Mq45dkGzCQ7NeL4H8SqHV20i8+GnLymWeLNyanpSyfHDsq3bqcJD8h6lJ xd9+UjVEpweJqJyWUjzn7lWisyNMLmWVIx1ll9rcUKcvauoKDymyeRZ74hRU .w7CGWar+fM0eP1wePF3OpSUYK9XBdHVCOp2FqY3wN9C0D9ndiTV5wkdo5xe .6gGhI3ArGdLI6i5Tt1hOfgOtrCdHQl93xN3gXRzru8bGpIQOVDOfoImsS3i QatXVCOOqpcK4lsj+XR3CfFV9i5T41xeLoXACFV9C9kVrntS53qt5ZdQ4Fap cE44Ktr9ke3OYb8ecS8W0Vzsfesn49YiUV6gw+AmLiJN -----------end_max5_patcher-----------
What do you recommend for reading more about measuring phase difference? I mean what have guys studied that enlighten you?
now thats some clever spambotting. soon they will fix our broken patches, too.
Forums > MaxMSP