LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Music player in Labview

If you have a big, complicated, program that has "lots of moving parts", don't try to tackle the entire thing all at once.

 

A good place to start would be to do the "critical, central thing" once.  In this case, it is "Read a Wave File and play its contents".

 

Write a LabVIEW routine that does only that.  Wire in the path to the Waveform.  [Indeed, when you submit your code, see if you can also submit the .WAV file you are trying to play (make it a fairly small one) so we will have some "data to test"].

 

When you are coding a VI, try very hard to always have your wires run from left to right.  In your 2019 code, the function "Sound Output Write" was to the left of "Sound File Read", so it looked like an output (since it was coming out the right side of "Sound Input Write") was joining with the output from Sound File Read and going into the Waveform Graphs.  

 

Your code doesn't look too bad (except for the connection between Sound File Read and Sound Output Write, which only looks wrong), but making it simpler (and studying the WAV example that ships with LabVIEW) may help you find why a simple "Play one WAV file" doesn't work for you.  [To find the Example, look at the Help for, say, "Sound File Open".  Scroll down to the bottom and open the first Example, "Sound File to Sound Output.VI".  Once you open it, immediately save it to your desktop (so you don't "accidentally" overwrite the Example code).  For safety, exit LabVIEW, then double-click the saved Example to open and try it out.  

 

Bob Schor

Message 11 of 13
(270 Views)

our problem is you put your event structure in the main loop.  It is now blocking the code while it waits for an event.  Add a timeout event and wire a zero to the timer input in the upper left corner. 

 

You still have several issues, including some that will lock up the execution.  Work through them by using the Highlight Execution tool (light bulb).

 

Great job so far BTW!  This is a very challenging app for anyone new to LabVIEW.

 

NIquist_0-1717080172850.png

NIquist_1-1717080228941.png

 

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 12 of 13
(245 Views)

A little hint on one problem.  You did a nice trick by only grabbing 1000 samples and then moving the position offset.  BUT, it will never stop even if there's no more samples.  Maybe the End of File output from the Sound File Read VI could help?

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 13 of 13
(241 Views)