Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

Wav streaming and data clipping

I am new to sound measurements and I am facing problem with something that was supposed to be trivial. I want to stream data from NI USB 4431 during sound measurement. I thought that streaming into a wav file would be as simple as writing into normal binary file... but ouch. When I stream the data it clips (cuts) it to -1;1. So my question is what is the right way to do this? Should I convert do I32 and write the conversion constant to the wav header somehow? Or should I rescale the data and write it as a double?

I have the sound and vibration toolkit but I didn’t find a good example for this.

Thanks

 

Note: the vi doesn’t create microphone channel but just AI so I get nice sinus from virtual card for testing

LV 2011, Win7
0 Kudos
Message 1 of 7
(7,115 Views)

Hello.

 

Did you check in LV help to find answer on your question. To see short description how certain function in LV works press CTRL+H and place your cursor on function you are interested in (in your case name of function is Sound File Write.vi). After doing this small window (called context help will open). This one has contains link to detailed help. In detailed help you can find answer on your question (cliping to range -1 to 1 is feature of function you were using). 

Also , you asked " So my question is what is the right way to do this?", what do you mean by this (what does it refer to)?

 

Please let me know if you will need any other assistance.

 

Regards,

Sofija

0 Kudos
Message 2 of 7
(7,107 Views)

Hi, sure I know how to use the Help, I am not a newbie to LabVIEW 🙂

I am just asking what is the convetion of writing the wav file during acustic measurements to be able to retrieve its data and play it.

 

Thanks 

LV 2011, Win7
0 Kudos
Message 3 of 7
(7,099 Views)

Hello Ceties.

 

Please take a look at example that you can find on next location: NI Example Finder>>Toolkits and Modules>>Sound and Vibration>>File Input Output>>SVXMPL_WAV Recorder (DAQmx).vi .

 

This VI acquires data from the specified channel and saves this data into a *.wav file. Scaling information is stored as a header in the WAV file. Triggered and non-triggered acquisition is supported.

 

Hope this will help.

 

Regards,

Sofija

Message 4 of 7
(7,088 Views)

Hi Sofija and thanks again for your time. I know about this example. The problem is that it configures the channel as Voltage instead of pressure (DAQmx Create Channel-AI Sound pressure Microphone). Another issue is that it is a single shot acquisition and I have continuous.

What I have to do if I understand it right is to rescale the data to -1;1 range. For that I need to know the pressure range I can measure. When I create the MIC channel I specify the sensitivity and the MAX pressure.

 

But how can I determine my pressure range. How can I calculate it? Storing the gain is a piece of cake then.

Thanks 

LV 2011, Win7
0 Kudos
Message 5 of 7
(7,067 Views)

I think I have it. Just AI.Max and AI.Min. I thought that it returns the value in Volts but it respects the Task values which means Pascals in my case.

What I would like to know is how it calculates the values. For my settings:

Max sound pressure = 100dB

MIC Sensitivity = 40.271 mV/Pa

and Device input range +/- 10V

 

it returns the AI.Min -248.318 Pa and AI.MAX of 248.318 Pa

LV 2011, Win7
0 Kudos
Message 6 of 7
(7,065 Views)

Sorry for this self talk. I have it:

Since I have the sensitivity of 40.27mv/Pa it will give me for 10V -> 248.3Pa and for -10V -> -248.3Pa. But what is then the reason for the Max pressure parameter when configuring the virtual channel?

LV 2011, Win7
0 Kudos
Message 7 of 7
(7,061 Views)