LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Phase Alignment with two Microphone Inputs

Hello,

I am trying to perform phase alignment of two waveforms (one per microphone). 

The set up I am using is two identical microphones spaced 5 cm apart with a speaker roughly 2 ft away from the middle of the mics.

The issue I have is that the alignment only works part of the time.

I attached my vi and examples of it working and failing with the same sine wave generated form the speaker.

I essentially copied this example and added microphone inputs. https://forums.ni.com/t5/Example-Programs/Phase-and-Amplitude-Alignment-of-Waveforms/ta-p/3537546?pr...

I have a feeling the cause for this issue is the waveforms starting off with a small amplitude then gradually reaching the maximum height.

 

Thank you for the help.

0 Kudos
Message 1 of 7
(2,659 Views)

I'm on LV 2016 and 2018 and can't open the 2019 code.

 

If possible, I'd recommend an initial focus on *preventing* or *controlling* the misalignment with a careful setup of your data capture.  That's always going to be preferable to an after-the-fact attempt to measure, characterize, and manipulate the mic data.

 

If you're capturing with an NI data acq device, you should capture both mics in the same task.  This will let you control the amount of misalignment to be a small, precise, and consistent time.  (On simultaneous-sampling devices, it'll be 0.)

 

If capturing with a sound card, can you bring them in as if they were the L & R channels of a stereo signal?  That would lead to 0 misalignment as well.  (If the 2 mics need distinct "grounds", you may need an active component like a mixer in line.)

 

 

-Kevin P

 

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 7
(2,623 Views)

Hi Kevin,

 

I attached the vi for 2018. 

I have microphones connected to my computer via USB without any NI device.

As far as controlling the data capture before the alignment, I am unsure of ways to accomplish this.

Ideas would be greatly appreciated.

 

Thanks for the reply.

0 Kudos
Message 3 of 7
(2,618 Views)

If you look at the VI you attached (thank you!), you'll see that each channel specifies "stereo" input, meaning they'll be read together by the sound card, and will have a phase essentially determined by the time-difference it takes the sound to reach each microphone (as the sampling should be near-simultaneous).

 

Something you might do is to go on the Web and ask about "Record Stereo from 2 USB Microphones".  There are multiple ways to do this, and one (or more) might work well with LabVIEW.

 

Bob Schor

0 Kudos
Message 4 of 7
(2,614 Views)

Thank you for the advice.

 

I wired the microphones I am using to an audio jack.

One microphone is connected to the left signal and the other is connected to the right.

I made a VI to graph each channel separately, but both graphs display an identical signal.

It appears that only one microphone is being graphed as both signals.

I know the phases should be the same, but the amplitudes should not be from my tests.

 

Any help is appreciated.

 

Thanks

Download All
0 Kudos
Message 5 of 7
(2,587 Views)

Change your VI to the following, your inner loop looks too Rube-Goldberg. Note sure if something strange is happening with your R-G code.

 

mcduff

 

Snap10.png

0 Kudos
Message 6 of 7
(2,577 Views)

Thank you for the reply.

I used the posted code and obtained the same results (identical signals).

After some research it appears that the left and right tracks contain the input from both mics. 

There are some ways to record the tracks separately with recording/editing software, but nothing I could find in labview.

It seems to me that a USB Audio Adapter Sound Card is the next thing to try.

But Bob mentioned above that each stereo channel will be read together by the sound card, so maybe this isnt needed?

0 Kudos
Message 7 of 7
(2,516 Views)