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: 

Using Math Operations on Acquired Signal through DAQ

Hello there!

I'm just beginning to work with LabVIEW and I'm working on manipulating an input signal acquired through the DAQ and then outputting it to a speaker. Essentially, I have acquired a 1D array waveform (DBL) through the DAQ to be passed through queues and I want to manipulate this signal using math operations. The area of interest is in between the 'Get Waveform Components' and 'Build Waveform' components where I intend to do the maths.

If I were to connect the Dequeue element to the Enqueue element, I have a functioning continuous input/output working. So I have something wrong with how I'm trying to extract data from the signal. As you can see in the attached snippet, I have attempted to convert the 1D array waveform into its individual components where I believe I would use the Y component (representing the acquired data as a 1D array of type double)  to complete my math operations on. I then intend to build a waveform based on this modified signal, put it back into a 1D array waveform to then be passed on to the output.

So 3 main things that I need help on:
1. How to break down the 1D array waveform into its individual components that allow me to manipulate the signal without losing data

2. How I would use the Y component to complete the math operation, and whether I can use a 1D array of type double for such operations

3. How I would build this waveform up from the components into a 1D array without loss

Any help would be greatly appreciated! 


Capture1.JPG

0 Kudos
Message 1 of 5
(2,991 Views)

You have the while loop iteration counter wired up to the index array.  This doesn't seem like something you want to do, but since i can't see the rest of the code, I can't say for sure.  I think your understanding of un-bundling the data is correct, I'm just not sure that you are getting the data that you are expecting. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 5
(2,969 Views)

Aputman is right, problem is with index array

You are getting multiple channels from your DAQ (at least one). They are arranged in array of waveforms. First channel index = 0, second 1, etc. 

Loop index is the number of times you are reading DAQ channels

 

 

0 Kudos
Message 3 of 5
(2,950 Views)

You are also loosing the T0 of the waveform data and any attributes.

 

The code in this example may help you out (if you have LV 2016).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 5
(2,936 Views)

Thank you all for your quick replies!
It's taken me a bit of reading to understand arrays and indexing but you've collectively helped me understand my problem. I found that I'm currently acquiring two input channels from audioInputLeft and audioInputRight through the DAQ which I now know corresponds to 0 and 1 on the index array. I had to separate these channels, get their individual waveform components then put them back together by building an array so now I will be able to go forward with the math operations I want to do.

To understand this, I indexed an array earlier in the code to find the individual input waveforms for each of these channels and whilst audioInputLeft was producing the input I was expecting, audioInputRight was just producing noise. Both channels have been set up the same and I can't get my head around why this is the case. The output also comes out of just one of the stereo line levels too.

Attached are the channels that I have at the start of my program, and whichever I choose (left or right) to be first in the series sequence is the one that would produce the noisy signal. This is also the case on the output. I'd really appreciate if you could help me with this too!

 Capture4.JPGHere are the resulting waveform charts where 1 is the noisy input, 2 is the output and 3 is the expected input channel.
InputOutput.jpg

 

0 Kudos
Message 5 of 5
(2,910 Views)