04-17-2012 05:25 AM
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.
Note: the vi doesn’t create microphone channel but just AI so I get nice sinus from virtual card for testing
04-18-2012 02:15 PM
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.
04-19-2012 05:45 AM
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.
04-23-2012 10:43 AM
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.
05-07-2012 05:33 AM
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.
05-07-2012 05:58 AM - edited 05-07-2012 06:02 AM
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
05-07-2012 06:49 AM
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?