LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous playing sound and measuring it's level

Hi all,

I am trying to measure the response of the room to different frequencies by playing a certain frequency and then measuring the volume of that specific frequency. (while averaging of course).
I am trying to measure a sound I am playing (just a normal 1Khz sine wave) with a microphone and there is one issue that causes a problem.
I can't make the Vi of acquiring the sound from the microphone work at the exact same time as I am playing the sine wave through the speakers. It starts in somewhat random time which affects the result completely.
I am using the Rendezvous Vi's to try and get them to work at the same time but it's not accurate enough.
Anyone has any idea?

I attached my Vi just in case. It's a bit messy but very simple so it shouldn't be a problem.

Thanks a lot for any help,

Orel
0 Kudos
Message 1 of 3
(2,527 Views)

Ori,

I'm not very familar with how well you can control the sound card vi's you are using, but I don't think you have control over how well you can sinc the inputs and outputs.   I would suggest you consider using a data acquisition board with analog inputs and outputs.  One of the M series boards from NI would allow you to have simultaneous syncronization between inputs and outputs at the hardware level.  What you are doing is software timed and will always have some variability in the timing.

SteveA
CLD

-------------------------------------
FPGA/RT/PDA/TP/DSC
-------------------------------------
0 Kudos
Message 2 of 3
(2,517 Views)
I'm not so sure rendezvous's are necessary or are effective for what you are doing.  First, you should create the rendezvous outside of your For loop and remember to destroy it after your For loop.  I don't think it is doing much for you because as soon as you create it, the rendezvous points are happening right afterwards, so both rendezvous's are going to happen at the same time anyway.  Rendezvous's are designed for synchronization of completely separate portions of code.
 
The rendezvous's don't even guarantee that your two case structures will happen at the same time.  It will guarantee that the wires coming out will execute simultaneously, and both of those lead to the case structures where you are doing your tasks.  But the lower case structure also has to wait on the sound configure task which may take a bit more time.  If you put the sound configure task in the previous frame of the sequence structure, that will guarantee it executes before the rendezvous's start.  And once you do that, I don't think you would need the rendezvous's.  If you wire up the error out of the configure sound and feed that into the rendezvous, that will guarantee that it executes before the rendezvous and is out of the way leaving just the wires to shoot into the parallel case structures.
 
In general, you should be wiring up the error in's and out's on several of the subVI's.Smiley Wink
0 Kudos
Message 3 of 3
(2,516 Views)