LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to play multiple sound files simultaneously with no delay?

Hi there,

 

I'm working on a piano project, I'm using labview to play musical notes when a key is depressed.

 

I tried to use "Sound Output write", but it seems that this function is blocking, the sound card plays the next file only after the previous one ends. So if I depress many keys at the same time, sound files get stuck in sound card. 

 

I also tried to use "Play sound files", it isn't blocking, but when I depree the key, there's a tiny delay before playing. Pianoists from music department don't like this delay.

 

I'm wondering is there anyway I could solve blocking/delay problems? Which function shall I use?

Thank you in advance!

Sound file.jpg

Download All
0 Kudos
Message 1 of 6
(3,368 Views)

Hi Yatang,

 

It appears as though your code is trying to reference a file called "Note 12 Keys" and that this file is located on your desktop. Would you mind posting a link to this file so I can use it to try to better understand what might be causing this issue?

0 Kudos
Message 2 of 6
(3,324 Views)

Welcome back, I thought this project sounded familiar: http://forums.ni.com/t5/LabVIEW/Can-quot-Play-Sound-Files-quot-plays-two-files-simultaneously/m-p/33...

 

Try wiring 0 into the timeout of the Sound Output Write.vi. That should cause it to begin playing and not block.




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 3 of 6
(3,311 Views)

Hi Michael,

 

It seems that "Sound Output write" is still blocking even though I wire a 0 to timeout, it plays the sencond file only after the previous end.

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

Hi Letitsnow,

 

I attached those files. Please change the extension to .zip.

Do you know why "Play Sound File" will have a tiny delay before playing?

0 Kudos
Message 5 of 6
(3,285 Views)

Do you know why "Play Sound File" will have a tiny delay before playing?

Load the file I guess.  If you play it again, there is no delay.

 

George Zou
0 Kudos
Message 6 of 6
(3,271 Views)