LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Play Sound File.vi not working in Windows 7 x64 Ultimate, LV2009 SP1 x64

Solved!
Go to solution

Hi,

 

For some reason "Play Sound File.vi" in LabVIEW 2009 SP1 x64 will not playback my .wav files on Windows 7 x64 Ultimate.  It gives this error:

 

LabVIEW: (Hex 0x12C3) The sound driver or card does not support the desired operation.

 

The exact same code does work (it will play .wav files) with LabVIEW 2009 SP1 x32 on Windows 7 x32 Home Premium.

 

Here are the results of the test cases I tried so far:

 

Box 1: Dell Precision T3400, Windows 7 x64 Ultimate, LabVIEW 2009 SP1 x64 [does not work]

Box 2: Dell Optiplex 755, Windows 7 x64 Ultimate, LabVIEW 2009 SP1 x64 [does not work]

Box 3: Lenovo X100E Netbook, Windows 7 x32 Home Premium, LabVIEW 2009 SP1 x32 [works]

 

The "Beep.vi", however, does work on all three machines.  The sound devices on all three machines work fine when used by other non-LabVIEW applications.

 

I also tried several different .wav files, including ones stored in C:\Windows\Media.  None of them will playback in LV on Box 1 or Box 2.

The user account I'm using even has Administator privileges on all 3 boxes.

 

Anyone else experience this?  How do I resolve it?  I tried digging into "Beep.vi" to see if I could reuse any subvis, but Beep.vi is password protected.

 

Thanks,

Richard

 

0 Kudos
Message 1 of 10
(7,713 Views)

If it were me, I'd start with the DLL that the VI calls: C:\Program Files\National Instruments\LabVIEW 2009\resource\lvsound2.dll.  Maybe you could try using the older file, lvsound.dll

 

If I just wanted a way around this problem, I'd consider using ActiveX calls to run the windows media player instead...

-------------------
Greg
Certifed LabVIEW Developer
0 Kudos
Message 2 of 10
(7,698 Views)
Solution
Accepted by topic author RichardBallantyne

I got wav files to play by calling the PlaySound method contained in C:\Windows\System32\winmm.dll.

Had to create a Call Library Function and lookup the interface to PlaySound.

 

The VI is attached to this post.

Message 3 of 10
(7,678 Views)

I leave an example which can contribute, greetings SO-W7 64bit

0 Kudos
Message 4 of 10
(5,598 Views)

Thank you for that. This whole thing's been bugging me since last week.

 

Now, how does the VI declare an 'end of file'?

0 Kudos
Message 5 of 10
(5,346 Views)

By that I mean how do I get the Call Library node to output a boolean value when the end of file is reached?

0 Kudos
Message 6 of 10
(5,340 Views)

Hahis d tproblem in LabVIEW 2013 64 bit.  This VI solved the problem.  NI should note this and update the example program.  I have a service request in #7407862.  

LeMur Technology Services, LLC
0 Kudos
Message 7 of 10
(4,982 Views)

Greg,

 

The link to the VI does not work. Can you tell me what the change was?

 

Jon

0 Kudos
Message 8 of 10
(4,612 Views)

JonP,

Including this Service request post because I forgot what this was all about. Also I don't know where this replacement VI came from, probably these forums. anyway this worked on LV2013 and 14 64 bit

 

This is Corey in Applications Engineering at National Instruments. I've brought the play sound vi x64 issue to some of our Product Support Engineers. This problem is associated with the windows API being updated. The LabVIEW example, playsound.vi, was created sometime ago and has never been updated to use the new windows API call as documented in this knowledge base article:

"Why Does My Project Search for the lvsound.dll Library When Opened?"
http://digital.ni.com/public.nsf/allkb/E3760A2A21C087DE86257CD00063C4B0?OpenDocument

To sum it all up: To correct this, you will need to modify your code and replace functions from the old sound API with functions from the new API.  This will change your program to make calls from lvsound2.dllinstead of lvsound.dll.

The original API VIs have remained in vi.lib for compatibility purposes only, but not in the palettes. As far as future x64 support goes, it is the direction LabVIEW is headed and we do have internal documenation that updates this for future releases.

 

 

LeMur Technology Services, LLC
0 Kudos
Message 9 of 10
(4,604 Views)

play_sound_file2.vi works for me (Win7, x64, LV2014). Thanks.

0 Kudos
Message 10 of 10
(3,811 Views)