LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot play WAV file in Labview 2013

Solved!
Go to solution

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

Download All
0 Kudos
Message 1 of 8
(5,261 Views)

(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. 

0 Kudos
Message 2 of 8
(5,236 Views)

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

 

 

0 Kudos
Message 3 of 8
(5,226 Views)
Solution
Accepted by topic author somishra

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)

Message 4 of 8
(5,211 Views)

Well, you get a sound format error and I don't. Does the file actually play in media player on your computer/

0 Kudos
Message 5 of 8
(5,207 Views)

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

0 Kudos
Message 6 of 8
(5,204 Views)

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.

0 Kudos
Message 7 of 8
(5,198 Views)

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.

0 Kudos
Message 8 of 8
(3,987 Views)