LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with timing issue

Hi

 

I had a previous thread but closed it because I thought I had solved the problem. However I found that my program is still functioning wrong.

I am a student in the OSA chapter at my school, I am working to make some new high school "friendly" experiments to demo for students on there visit to campus. I am working on a lazer listener, but the basics of it are that I want to read an analog signal from a Daq and filtering noise from that analog audio signal. I am taking samples from a Daq, USB 6009. These samples are analog and should be typically less than +- 0.5 V.  I want to read samples and play the sound simultanous and continously. I believe I am close but have something set-up wrong. Thank you very much for your help in advance.

 

jason

0 Kudos
Message 1 of 4
(2,635 Views)

What is "functioning wrong"?

Message 2 of 4
(2,629 Views)

Sorry about that, the first code I was using{ not the code posted, that code is an updated version} was not playing the sound continously. I think the problem was I was using the Express Sound VI inside my while loop so it was starting and stoping the sound output every cycle, so you would hear a "bleep" every cycle. So I looked at the simultaneous sound VI as a reference.  I have the start and stop now pulled out of the loop so that I should not get the "bleeping" anymore. However now that I have done this I think I have messed up the timming.  The VI will now only play a short(less than 1 sec) of sound then nothing. I can see I am still pulling samples from the Daq, via the two graphs, so that leads me to believe I messed up some timing issue with playing the sound.  Again sorry I forgot to put this part in, I had another post but closed it because I thought i fixed the problem and forgot to put this part in to this post. 

 

Jason

0 Kudos
Message 3 of 4
(2,613 Views)

Jason,

 

I do not have any DAQ devices so I created a simulated sound source.  When I add a delay comparable to the data acquisition timing, I occasionally hear an interruption in the output.  Even though you have both the sound and the DAQ set to the same sample rate, their timing is derived from different oscillators, so the match is not exact.  Also the OS gets involved in both the DAQ inputs and the sound outputs.  It is not surprising that interruptions occur.

 

I had recently put together a sound in/sound out VI for other purposes. I modified it to monitor the sound out using Sound In. I can clealry see the interruptions and the spectrum of both the sound and the noise.  The filter passband show up nicely.

 

Several things you can try:

1. When posting VIs to the Forum, please do not set them to Dialog window.  It makes it difficult to troubleshoot and to look at other things like my monitor VI.

2. Consider the Producer/Consumer architecture. Let the DAQ be the Producer and the Sound out be the Consumer.  Create some buffering so that slight timing differences and OS latencies are less likely to cause interruptions.

3. Depending on the nature of your source, you may find that the normalization creates step changes in your volume.  You may want to smooth the normalization over several acquistion blocks.

 

Lynn

Download All
Message 4 of 4
(2,600 Views)