03-12-2015 02:21 PM
I appologize if this is incredibly straightforward, but I seem to be at a dead end. My goal is simple. I want to use Labview to collect two channels of acoustic data (sampling at 50k per channel) from an NI DAQ card. I want to stream these two channels to binary files (either one file containing both channels, or one file per channel). I then wish to be able to use a separate vi to open these files and convert the data to .wav (or anything really; .wav seems appropriate for acoustic data).
My trouble is that the 'write waveform to file' tends to create very large files that cause memory issues when opening.
I have tried several variations of using Write to Binary and Read from Binary that have resulted in very mixed up data.
Any help would be much appreciated.
Solved! Go to Solution.
03-12-2015 02:43 PM
what about using tdms files as the intermediate binary? they are standardized, so you don't need to create parser vi-s and have quite good performance
03-12-2015 09:51 PM
I'm not sure why you are having a problem. As I understand it, you are sampling 2 channels at 50 KSamples/sec. You should be able to write pairs of numbers (I'm assuming you are working with a 16-bit A/D, so that's a rate of 200KB/sec -- you should be able to keep up this rate for a long time (unless you are using a 1.44MB floppy). To achieve reasonable data rates, buffer your data (i.e. send 1000 points at a time instead of 1 at a time) and use something like the Producer (A/D converter)/Consumer (Disk I/O) pattern.
BS
03-13-2015 07:06 AM
I also highly suggest using TDMS. And if you are using DAQmx (which you should), there is a DAQmx Configure Logging VI. Use this VI to have your DAQmx task streamed straight to a TDMS file. You don't have to do anything else with the data or file. That is by far the simplest solution.
03-13-2015 07:57 AM
Thank you all; I don't know what was wrong with the binary; but I dropped TDMS in its place and the whole thing works beautifully. Thanks!