LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to acquire and save long audio

What is the requirement?

Do you need to save the data to an audio file while collecting data?

Why don't you use the built in logging functions of DAQmx, save the data to TDMS, then post process the file and convert it to audio.

0 Kudos
Message 11 of 21
(180 Views)

Hi mcduff

 

I don't know well. It is a for a student job that i need to prepare the ni9233 and 2 microphones to collect sound. Then she will analyse the data...

I never used the TDMS data and how to convert it as wav...

I have some experience in collecting data from sensors. 

I would like to enter in the sound world (I had installed the ni sound and vibration) and replace a very old data acquisition and bigger from other company.

I could see some great examples for analysing data in S&V but it would be better saving the original (raw) data for some extra analysing.

 

Thanks in advance

 

Best regards

cpalka

 

 

0 Kudos
Message 12 of 21
(168 Views)

Attached is a QUICK mod to the original file.

  1. It is NOT a finished version.
  2. It is set up for multichannel acquisition, you said you had 2 microphones.
  3. Right now, it is converting a single channel to a wav file, you can implement the second channel to another file.
  4. Wav files have certain limits with respect to the input, sample rate, etc. You need to ensure you are within those limits.
  5. I would suggest you forget about the wav files and have your student analyze the data in the TDMS file. It will make your life easier and there is no advantage to a wav file here.

snip.png

Message 13 of 21
(158 Views)

Hi mcduff

 

Many thanks

 

I will test it, but I forgot to tell you that my LB version is 2013 🙂

Could you please convert it?

 

Best regards

cpalka

 

0 Kudos
Message 14 of 21
(134 Views)
0 Kudos
Message 15 of 21
(121 Views)

Thanks

0 Kudos
Message 16 of 21
(116 Views)

@p0rg wrote:

@

Hahaha your post just made my day! Inspired by your method, I recorded myself counting out loud and discovered the issue-- when the consumer loop dequeues a packet of 3, the samples are appended to the waveform in reverse order. So for example, when I counted to 10, the recording saved "3,2,1, 6,5,4, 9,8,7, 10." I'm having trouble fixing this issue in my code though-- would you be able to provide some help (LV2021 VI attached)? Thanks!

sounds familiar, can you replace  "Enqueue element" with "Enqueue element at Opposite End"?

 

Spoiler
oppsite-end.png

 

 

0 Kudos
Message 17 of 21
(100 Views)

Dear mcduff

 

Here is my version with 2 channels.

I use 1 microphone and the 2nd channel is for the signal from an encoder. I need to synchronize the collected sound with the distance.

Attached is the TDMS file, from sound and encoder

Your example is great because it saves TDMS file and then it creates a wav file.

For me it was a little bit difficult because I never work with tasks. Normally I use the DAQ assistant block and configure there the channels.

By the way, the way, I use a lot for saving data the Write to measurement file, and it has the options for the file format Binary (TDMS). If I create a vi with the DAQ Assistant, configure a channel (microphone) and save the data into a Write to measurement file (Binary (TDMS))?

 

Best regards

cpalka

 

Download All
0 Kudos
Message 18 of 21
(85 Views)

Good afternoon, @cpalka.

 

     When the DAQ Assistant first came out, I was still pretty new to LabVIEW (and never did understand how to use "classic" DAQ), and DAQmx was a big improvement.  However, I shortly stumbled upon a wonderful introduction to DAQmx called "Learn 10 Functions in NI DAQmx and Handle 80% of Your Data Acquisition Applications".  I've memorized that site name, and have taken to renaming the Dreaded DAQ Assistant as "The Dreaded DAQ Assistant" (whose Evil Twin is the Dynamic Data Wire).

 

Many (most?) DAQmx "applications" can be done with 4 or 5 DAQmx calls, and you can "see what you are doing" and keep the code very simple and understandable.  I strongly recommend you search for "Learn 10 Functions" (which is probably all you need to type into a Search Engine to find it), ignore Chapter 1 (which is about the DDA), and look at the next 2 or 4 chapters which should cover most of what you need to use right now.

 

Bob Schor

Message 19 of 21
(81 Views)

Hi Bob_Schor

 

Many thanks, I start seeing the presentation, let's see if will be this time I will start using tasks.

 

Could someone answer my questions in last message?

 

By the way I search an example vi to create a wav file from a TDMS file but could not find it.

 

Best regards

cpalka

 

 

0 Kudos
Message 20 of 21
(55 Views)