12-02-2014 10:14 AM
Hi LabView gurus
I am a novice with some minimal experience with Labview.
Quick Summary
As part of my experiment, I am trying to use Labview in exercise measurement device. I didnt haveany trouble with acquisition and display of signal via NI USB 6008. However I have a requirement to play a WAV file (generated by MATLAB) to pace the people to a rythm and the playing fails with Error 4810 saying the format is unidentified. The WAV file (attached here- metronome.TXT - but extension .WAV changed to .TXT enable upload) plays in all other players. The previous posts have not addressed this issue sufficiently.
More details:
An exercise device measures the displacement reading from sensor in Volt and converts to distance by a calibration formula (simple y=mx+c). In the course of the 3 minutes the person exercises - That part in the attachedVI works beautifully. However a rythmic tick-tock sound has to play to pace him uniformaly. I created the WAV file from MATLAB sound functions and playing at 8KhZ (attached). But it didnt run no matter how many different ways I tried. Suggestions needed!
I am running Windows 7 Enterprise, 2GB RAM, LABVIEW 2013
Any help/suggestion/improvement is appreciated.
-SM
Solved! Go to Solution.
12-02-2014 10:45 AM
(Please next time attach a simplified example that only contains the code for playing of the soundfile.)
Here the sound file plays just fine. (LabVIEW 2014, WIndows 7)
Your code is a bit weird. What is the loop rate? (Sorry, I don't have DAQ here, so I cannot look at your express VIs. Your sound file is quite long so it is not quite clear to me why you are trying to play it in a loop.
12-02-2014 11:28 AM
The acquisiiton goes on until I hit the stop-push-button. The DAQ acquisition is configured at 10Khz in continous acquire mode.
I tried placing the sound file outside the loop - just to see if the file plays. I suspected if inside the loop the VI plays the first sample and waits for the next one - and that is long. It still pops the same error. I have the required codecs as mentioned in a old post.
Can you share the VI which played the sound. Maybe there is something wrong in the way i set it up?
-SM
12-02-2014 12:01 PM
Thanks,Ilooked up some more information and was able to play the file.
Specifically, this Youtube video is great walk through -
http://www.youtube.com/watch?v=ChSVf9lZ44k
Also I am posting the VI which can play a WAV file when its path is given (attached)
12-02-2014 12:02 PM
Well, you get a sound format error and I don't. Does the file actually play in media player on your computer/
12-02-2014 12:05 PM
Yes, the file played on the computer - that was not an issue. Maybe the problem was how Labview reads in the file.
In this new VI I used "Sound file Read", 'Index Array" and "Play waveform"
Essentially - having the wav file converted to a waveform and then play the waveform (instead of the more direct approach of reading/playing via the Windows codecs)
-SM
12-02-2014 12:09 PM
Both methods work on my computer just fine (that's actually what I tried first before my first reply). I doubt that the two tools use different code internally, so your observation surprises me.
02-21-2017 03:10 PM
Just wanted to share my thanks for sharing your solution to a confounding and odd problem. Reading file in to array and playing waveform solved my problem too.