LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Playing two sound waves across two different sound cards simutaneously?

Solved!
Go to solution

Hello all.

 

With the help from old board posts and the example VIs packaged with Labview 2009 SP1, I was able to get part of the way.

 

The goal is to simutaneously play two .wav files, to two different sound cards. So far:

 

1) I can play one wav file to either sound card

2) I can generate two sine waves of different tones, and push each out to the two cards seperately simutaneously.

 

But when I replace those two tones from #2 with .wav files, the wave files play alternately. So wav_1 plays to sound_card_1, THEN wav_2 plays to sound_card_2, not simutaneously.

 

Is it even possible to play 2 wav files simutaneously out to different cards?

 

I've included a VI of the attempt in #2 above. Disclaimer: my labview skills are minimal and this vi was very experimental so it's probably terrible form.

0 Kudos
Message 1 of 5
(3,112 Views)
Solution
Accepted by topic author tzoom84

Why do you want to do this. Many modern sound cards have 5 output channals



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 2 of 5
(3,102 Views)

I'm required to work with a piece of hardware that is a 10-channel output device, but shows up as 5 separate sound cards. So this device actually only has two channels per sound card, and I'd like to control the sound signals (via .wav files) to the cards independently by simutaneously.

0 Kudos
Message 3 of 5
(3,097 Views)

I got the two wave files to play overlapping to different cards, but NOT synchronous. I also tried handshaking across the two just prior to sound output via semaphores, but no luck. Perhaps it just depends on whenever labview hits that instruction.

 

Watching the light bulb iterate through, the loops occur simutaneously where the sound write vi is called, but the exact moment when the sound write vi's get hit are not synchronized. Oh well.

0 Kudos
Message 4 of 5
(3,077 Views)

Tzoom84,

 

Since there is no way to buffer your sound output on the sound card and use hardware triggering you will be limited to software start timing.  You could use semaphores as you said, or simply wire both of the Sound Output writes in parallel inside a single while loop.  Since windows is nondeterministic the best you will likely achieve is the two outputs starting within tens of milliseconds of one another.  The time between the two starting will be affected by all other processes running on your system and may take much longer.  

 

Regards,

 

Sam K

Applications Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 5 of 5
(3,043 Views)