LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Play a .wav file in LabWindows CVI

Solved!
Go to solution

Hi everyone,

 

I'm a french student in intership. Currently improving my programm, I have to warn people when a certain level of electromagnetic waves is reached.

 

I would like to warn them by a sound and a red light. I already found an example in Labwindows/CVI data but i can't put it in my own programm. So I ask you if there is a way to play a .wav file when the critical level is reached. (Or an other type of file maybe if it's easier).

 

Thank you for your help,

 

Matthieu

 

 

0 Kudos
Message 1 of 6
(4,757 Views)
Solution
Accepted by MatGIL

Take a look at this small sample I coded a few years ago: it shows you how to use PlaySound to play a .wav file.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 6
(4,721 Views)

Hi

There is a sample project that should help you. If you go to find examples--> In search fill with "wav".

You will find sndplay.cws project. Otherwise, it is stored in :

C:\Users\Public\Documents\National Instruments\CVI2015\samples\sdk\audio

Paolo_P
Certified TestStand Architect
Certified LabVIEW Architect
National Instruments France

0 Kudos
Message 3 of 6
(4,716 Views)

I know, i already found it, but i couldn't take the "playsound" function. I had a lot of problems. However, I'll try to use the file of Roberto.

 

I'll tell you if it worked.

 

Matthieu

0 Kudos
Message 4 of 6
(4,707 Views)

Both PlaySound and sndPlaySound functions are available in Base and Full version of CVI, but to use them you need to:

 

  • Install the interface to Win32 API (formerly Windows SDK)
  • #include <windows.h>
  • #include <mmsystem.h>
  • On older versions of CVI, add WinMM.lib to your project


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 6
(4,702 Views)

I'm using LW2009. The PlaySound function works, thank you ! 🙂 It helps me a lot (I had an other solution "printf ("\7"); but i was not good)

 

Thank you again,

 

Matthieu

 

 

0 Kudos
Message 6 of 6
(4,687 Views)