LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Need to output sound in CVI project through sound card

I've been adding a software mod to one of our long standing projects, that involves sound output. Certain pieces of our kit require orientating in a certain way before they can be calibrated, but due to them also being adversely affected by magnetic fields and large lumps of ferrous metal, they are often positioned well away from whereever the PC is that is being used to calibrate them. I've come up with a solution that involves a series of beeps transmitted via walkie talkie, a bit like sonar pings, that can be used to determine when the kit is within tolerance of its required position. Unfortunately whilst developing I hadnt realised that the StartPCSound / StopPCSound only worked on the internal speaker, as I develop on a laptop where all the sound comes through the same speakers. However now I would like to be able to output this sound through external speakers, so can no longer use this functionality - shame as its very easy to use.

 

So firstly, I'm pretty sure I know the answer to this but I'll ask anyway - is there anything already in LabWindows CVI that would allow me to do the same sort of thing as StartPCSound - I'm not after glorious sound quality - a square wave will be just fine!

 

Secondly, has anyone come across any easily configurable .NET or C++ libraries that would allow me to do something similar, and if so can you share you experiences and if possibly some code examples to get me started.

 

Regards

 

Gavin Summers

0 Kudos
Message 1 of 3
(3,399 Views)

Hi Gavin,

 

I've been having a quick look at this and there is an example with CVI that can play .wav files.  If you go to help>>find examples and then search for sound there is an example called sndplay.  It would require you to have a .wav file (there are some in C:\Users\Public\Documents\National Instruments\CVI2009\Samples\datasocket\DataFiles which you can use to test it) but should meet your other requirements.

 

Regards,

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 2 of 3
(3,371 Views)

I had looked at playing wav files as an option. However I'd need a few. My post originally was a bit misleading as sonar pings are all the same frequency, but closer or further apart. My original solution keeps the pings the same distance apart, but varies the pitch, so as you get closer to the desired alignment, the pings get higher in pitch. When the desired alignment is reached you get a two tones one after another.

 

However having said that the way you've suggested isn't actually a bad idea, and I certainly could make use of it. Record two tones, use one played at differing frequencies depending on how close to required position I am, and then the other continuously when within acceptable range. I'll check wav playing out as an alternative option.

 

Cheers Smiley Happy

0 Kudos
Message 3 of 3
(3,365 Views)