phase-matching two signals
Hi,
Not sure where to start with patching this. I have two mostly continuous acoustic inputs (A and B) and want match the phase of input A to input B (in realtime) to stop phase interference canceling resonance.
I suspect that delta~ can help me here to match (or at least know the difference), but how how do I track the phase of the target input in the first place? Any hints/help appreciated.
What is causing phase interference ?
2 mics recording same source at different distance ?
Or something else ?
In case of 2 mics just convert distance difference to ms or samples
and time align 2 sources using delay or something.
Thanks Source Audio, unfortunately it's two different sources. I'm trying to get A to induce resonance in B by playing pitches matching strong partials in B.
exactly, when it comes from 2 mics, you can first roughly calculate the distance->delay to narrow the range where to search in for the exact position using DSP.
but it seems we we are somewhere else here.
if i get you right, it should be okay to just remove this kind of phase from the signals by using the first output of [hilbert~].
(alternatively you could average the imaginary outputs of the sources)
is that what you want?
-110
so You extract frequency of strong partials of B and play some sort of
sound matching the pitches ?
That latency would be constant I guess.

My physics may of course be oversimplistic here, let me know what you think about this being possible in Max.
Roman, thanks for the Hilbert~, I hadn't seen that, but I'll have to do some reading as my mind is blown. I'm not sure what you mean by "remove this kind of phase from the signals". FWIW, in my context this is acoustic instruments (strings), but one is trying to cause resonance in the other using a transducer to send signal A into the physical object making signal B; aligning the phase of the transducer signal A with the vibrating string B.
if A informs the evolution of B somehow, it's not possible to move signal A in phase with B and then have B keep that form of 'resonance'(the shift in A will interfere with the continuous nature of its own frequency, causing a different kind of interference and influence over B). it basically sounds like you have a system in which delay is ubiquitous to its function, but you'd like to remove the delay without
removing the delay 🤯 ...without removing the delay 🤯 ...removing the delay 😱🤔
but it is worth trying, because you could still try to 'surf' the resonance(if you came up with some kind of control to keep shifting the two towards each other).
and since it's a transducer and a string we're talking about, another thing to consider: if B doesn't initially influence A, then perhaps it's easier to shift B somehow to keep and amplify resonance(you'd have to create a physically/mechanically moveable bridge or something that could slightly shift the string's length by just a microscopic amount 😆 ...awww snapz! i don't know which one would be more difficult to implement)
sorry i'm not of more help, but it's a very catchy and interesting idea: in my head, i hear 2 tones swinging like pendulums moving more and more towards harmonic relationships with amplified resonances.
(if i had any help to offer, it might be something like this:
you subtract the phases of the two signals, and using sample-and-hold when difference is detected, add the difference in phase back into the original signal..... but this fails anyways, because you'll soon find the difference will keep shifting the more you try to control it ....this might be more easily done with pitch&litude-tracking applied to the tuning of band-pass filters or some similar system of pitch&-guided filtering)
Best of luck 🤞🍀
If You would give more information about instruments, pickups,
etc in use, one could easier understand what is going on.
Having built many guitars, pickups, transcducers etc
I understand the problematic.
Let's say You have 2 cellos and You want to pickup the sound of
cello A and amplify it's transducer to a loudspeaker mounted at the
bridge of cello B, trying to influence the natural vibration of cello B.
Or principle of sustainiac, picking up electric string
and playing it back via magnetic field (another Pickup)
mounted on same guitar, to provoke infinite sustain,
or ground tone cancelation, depending on phase switch.
And many other examples.
So what is Your hardware in use and how is it hooked ?
Then one could start checking if what You are after is possible at all
ïn real time.
I have a guitar sustained with an sustainiac. I want a violin to be able to influence the harmonic sustained on the guitar by playing the violin's pitch through the sustainiac. In this way the feedback loop of the guitar string is replaced by the violin.
At the moment this works reasonably well, but if the violin plays same pitch as the guitar harmonic then they cancel out, presumably due to phase cancelation. Whereas noise signals (scratch bow, percussive sounds) or other (low) pitches tend to amplify, presumably because there's enough components in that sound that DO align with the guitar phase for it to resonate.
Then You need phase inverter or shifter .
Putting all this through software would not really work easilly.
But, if You say when violin plays same root as guitar,
it's ok, but not if it plays harmonic, which? 5th as strongest ?
The only way I would think of it would be to simplify things,
allways ptich - to frequency both guitar and violin, and invert/shift phase if
they don't play the same root.
I am most sattisfied with vb.pitch~ from Volker Böhm , when it comes to speed
and reliability of pitch detection.
And this definitely would work only on slow , monophonic notes
-------
Another possibility is to tame the violin output, by distorting,
extracting fundamental using lowpass etc to make feedback better.
One could also pitchshift violin etc, there are many options,
but whatever one does some notes would match better,
die others less and some not at all .
Violin is anyway higher range, so low strings on guitar would not benefit much
with unpitched violin feed
Thanks Source, yes this is all very long slow sounds, needs to be anyways to allow the resonance to build. I'll give your suggestion a try; and I've never looked into the vb. objects so that'll be good to see. Cheers.
Here is pitchshifter that I use for
control signal transposition.
It is fast.
Cross is a bit steeper filter, this is taken out of other more complex mixture,
You can use any steep lowpas flter instead, and adjust frequency as needed.
Similar way subbass creation works in hardware devices :
rectify the signal, drive flipflop or some counter with it, and low pass output
to smooth square output making it more sinusiodal.
Output level is than regulated using envelope follower.
1 have one on each string on guitar.
cool! thanks.
I think you want was it's displayed by Smaart: If you move a freq, you moove the phase too... It's a normal behaviour mooving with a delay some transducers and capture a freq with a mic: like moove a sub between a distance fixed by some tops like a linearrary that is fixed in his position. Sending a freq in betwwen the crossover point, you get this freq on both speakers, but the phase of this freq coming out from the subs is different from the phase coming out from the tops (same freq). In this way you can alingn the system for a certain position (like the position in the FOH).
I'm trying to move this phase visulalization too, in the horizontal domain, but I can do it only in the vertical domain, and the phase is always a value of 0. and 1., if more it means that a impulse is out of sync, in the time domain...but always you have to moove it in the phase domain, after the time domain...sub can also be placed 1 meter before the tops...and that means at a 60Hz freq, and at 48KHz sampling rate, that the time domain of a impulse, and at a temperature of 22 C°, is some cycles before the top signal (same conditions), and for that you need a delay... It's hard to do, I know... At moment I don't know...sorry...