LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring Phase Difference of acquired sound input - How to set the reference

Solved!
Go to solution

I am trying to measure the phase difference between two audio inputs.(Left and Right Channel of my sound card)

Both are free running 1kHz audio samples which come in and out of phase.

When the samples are in phase everything seems to be working correctly and shows no phase difference.

However once the signals start to go out of phase +-10deg the result keeps jumping around.

 

It appears to be the fact that it is changing the reference to determine the phase.

When I view the output phase of a channel it is a sawtooth waveform moving from 250deg and then wraps round to -110deg

 

What I want is to fix one input at 0 degrees and see the others inputs phase difference against it. 

Is there a way to set one signal as the reference or an alternative strategy?

 

Thanks in advance for any assistance. 

 

PLEASE NOTE THAT THE acquire.jpg IS ACTUALLY THE VI.

It would not upload as the vi. Please rename extension to acquire.vi to view it. 

Message Edited by EuanB on 05-15-2009 01:54 AM
Message Edited by EuanB on 05-15-2009 01:55 AM
Message Edited by EuanB on 05-15-2009 01:57 AM
Message Edited by EuanB on 05-15-2009 01:57 AM
Message Edited by EuanB on 05-15-2009 01:59 AM
Download All
0 Kudos
Message 1 of 9
(4,650 Views)

Please post VIs as VIs, the need for downloading and renaming them is very discouraging for user like myself.....

The most important question in this request is:

Do you know if your sounddevice samples the signal in parallel? Or is it maybe multiplexed? If multiplexed, how long is the delay between the channels? Is that delay constant?

Without that information, your analysis is, sorry to say that, worthless.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 9
(4,627 Views)
Since I work with lock-in amplifiers I came up with this. I guess it will work in your case. This method has some limitations. Both the reference and the measured signal need to have the same amplitude. And the amplitude has to be known. But besides this it will work quite good


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 3 of 9
(4,613 Views)

Norbert B wrote:

Do you know if your sounddevice samples the signal in parallel? Or is it maybe multiplexed? If multiplexed, how long is the delay between the channels? Is that delay constant?

Without that information, your analysis is, sorry to say that, worthless.


On a general bases I do not agree with you. If a constant signal is used as a reference, and multiplexed ADC is used. The time delay between each channel will cause a phase difference between the first and second channel. This phase difference can be calculated. From this the inter channel delay may found



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 9
(4,608 Views)

Coq rouge wrote:

Norbert B wrote:

Do you know if your sounddevice samples the signal in parallel? Or is it maybe multiplexed? If multiplexed, how long is the delay between the channels? Is that delay constant?

Without that information, your analysis is, sorry to say that, worthless.


On a general bases I do not agree with you. If a constant signal is used as a reference, and multiplexed ADC is used. The time delay between each channel will cause a phase difference between the first and second channel. This phase difference can be calculated. From this the inter channel delay may found


Ok, in order to this, you have to make sure that
-The very same signal is connected to both inputs
- There is no phase difference due to the setup (both channels must have equally length of connections with exact same specifications)
- The multiplexing of the channels has to be constant, that means completly timed by hardware
 
If you can make these things secure, you can determine the "offset"our system has (requiring that the signals will use the same hardware setup afterwords, e.g. cable length). Then your software is capable of deducting that "error". 
 
hope this helps,
Norbert 
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 9
(4,579 Views)

Indeed!

I am so used to using HW timed data collection, that I forgot the software timed possibility ;). In fact thinking about it I can not remember that I have done SW timing data collection ever. But I see it often in this forum, that I have to admit. It is a common novice mistake



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 6 of 9
(4,577 Views)

Firstly, Thankyou for your replies.

 

Norbert, apologies that the VI extension was renamed but like I said in my original post it would not upload. Some problem on the labview file upload process accepting VI extensions.

 

You make a valid point about how the system is measuring the incoming sound card.

I tested this before by sampling the same data on both the left and right channel. (i.e there should be no phase difference)

The measured phase difference is within 0.03degress, well within the required accuracy for my required measurment.

This was also confirmed using a waveform generator with a fixed known phase difference between the channels and it showed comparible measurement tolerance.

 

Coq rouge, many thanks for supplying your example. Unfortunately, one of the conditions of my system is that i cannot guarantee the voltage of the measured signals.

It will vary depending on the unit under test tolerance (manufacturing tolerances) and it is not a variable i want to have to deal with. (admittedly I may be forced to if there is no easier way)

 

What I am struggling to understnad is how the phase result is calculated by Labview.

Simplifying my problem down to just one sampled audio channel.

Labview generates a phase result.How is this possible? What is this relative to?

If I knew that I could maybe use this to solve the rest of the problem by using this internal reference.

0 Kudos
Message 7 of 9
(4,520 Views)
I did some modifications to my first vi. Now is the amplitude problem removed. At least in then I simulate. You may test in real world:smileytongue:


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 8 of 9
(4,509 Views)
Solution
Accepted by topic author EuanB

Finally managed to work the problem out.

Coq rouge, I tried to replace your simulated inputs with real world audio sound card inputs and things went horribly wrong.

There doesn't seem to be a translation between the two. (Perhaps due to my rubbish understanding of Labview)

Labview uses the internal reference of the DAQ cards in order to make phase measurements.

This is what all of the phase measuring VI rely on and what is missing from non-NI DQA cards. 

That is what I thought I was missing in the first place however there is no way I can see to simulated your own.

 

In order to get round the problem I used zero crossing detectors to compare the time lead or lag compared to the reference in order to calculate phase.

I got the core of the detector from somewhere on the forum but have lost the actual page. (apologies to the author who deserves Kudos)

 

Anyway, hope this hepls someone.

 

 

0 Kudos
Message 9 of 9
(4,384 Views)