From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real-time sound processing in Labview

Hello,

We are trying to create a sound source, process it in real-time and output the sound on the stereo speakers. The sound source is a sine wave (fs=1200Hz) and we are also using a timed while loop to do the processing. Please see attached screenshot.

The issue is that the the  sound source seems to be affected by the timing of the while loop which makes the sound jittery. It seems that the sound source is re-generates the sound every time the while loop executes. 

We are using Labview 2015 with the NIUSB6229 to acquire data and do the processing (in the sub-vis) based on that.

Any suggestions how to go around this?
Thanks,
Matt

Download All
0 Kudos
Message 1 of 2
(3,761 Views)

As good as LabVIEW is, NI has not yet release the long-awaited "Predict the Future" function, so when talking about "real-time sound processing", we need to (pardon the outrageous pun) "get real" and realize (or "real"ize) that we can only output data based on previously-sampled data, i.e. there is necessarily a time delay in (digital) signal processing.

 

Having said that, you can provide continuous signal processing in real-time, i.e. you can take in data at, say, 20KHz and output a continuous stream of data also at 20KHz, with some delay to allow for (a) sampling time, (b) sampling width (the more data you work with, the more you are able to do, particularly with regard to removing noise, which goes down as the square of the number of samples), and (c) whatever algorithm you are using to process the sound.

 

You'll want to take advantage of LabVIEW's Data Flow model, which permits parallel operations -- while one "chunk" of data (say, 1000 samples) is being acquired, the previous "chunk" is being processed and the processed chunk before that is being output.  This particular trick is often accomplished by a Producer/Consumer Design Pattern.  A Template for this Pattern (which will provide some explanation and Code You Can Use) can be found in the New... (the dots are important) File Menu entry in LabVIEW.  Choose "From Templates" and look for Producer/Consumer Design Pattern (Data).

 

Bob Schor 

0 Kudos
Message 2 of 2
(3,701 Views)