Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

Verification of sampling rate

Hello
 
I am trying to verify the sampling rate of my soundcard. My plan is to sample for 1 second and count the number of samples. My initial plan was to multiply the number of sampled input-buffer-frames with the number of samples each buffer-frame was specified to contain. This works ok as a rough estimator of the sample rate at low frequencies.
 
There are, however, some problems with this plan. You can easily sample at very high sample rates, if the buffer-frames are made large.  
 
So, my next thought was that the number of samples in each buffer-frame, was less than what it was specified to be at high frequencies. I tried to measure the dimensions og the final array of sampled buffer frames, but the "array size"-vi, showed that the dimensions was:
 
<number of frames sampled> x 2
 
I was expecting:
 
<number of frames sampled> x <number of samples pr. frame>
 
Besides that I am suspecting that the the size of the buffer frames are(when I get to measure it correctly) the size that they are specified to be, which I guess leaves me only with verification of the sample rate by manuel inspection of a sampled waveform.
 
So my question is: is there a way to verify the sample rate other than by manuel inspection?
 
I have included my basic program.
  
Regards
 
0 Kudos
Message 1 of 3
(7,332 Views)
Hi JacobB,
 
I have been looking at your code, but I am not absolutely sure about your problem. If you are sampling 2 channels, it seems logical that you will have an array of dimension <number of frames sampled> x 2, but I may have misunderstood your question. If I have not understood correctly, could you give a more detailed explanation of the program?
 
Best regards,
Peter Porsman | Applications Engineer | National Instruments
0 Kudos
Message 2 of 3
(7,294 Views)
The array size primitive in your code tells you the size of the 2D array of waveforms. Each element in the 2D array is a waveform that contains 5000 samples. Generally, counting the number of acquired samples yields a very coarse estimate of the sample rate. If you trust the dt returned in the waveform, sample rate = 1/dt. You can verify dt in the waveform if you have a high-precision function generator. Connect the output of the function generator to one of your input channels. Use Extract Single Tone Information to measure the frequency of the acquired tone. This should match the specified frequency of the function generator if dt is accurate. If the sample rate was coerced to a sample rate supported by the sound card, you can compute the coerced value from the frequency identified in the acquired waveform. If you only need one second of data, you could consider using a Finite acquisition and setting Number of Samples/ch to the sample rate. Hope some of this is useful.
Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 3 of 3
(7,287 Views)