LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LABVIEW sound playback (with pause and reverse)

Solved!
Go to solution

Im trying to build a VI that will play a pre-recorded sound, with the ability to pause, play in reverse and skip to any part of the sound data and continue playback. (Play in reverse would be a nice feature but really doesn't need to be there). Once I have figured out the procedure, it will be integrated with video playback and logged data display, so it needs be fairly dynamic as far as loop time when adding to the output buffer.

 

I have what I thought should work (written in LABVIEW 8.6) only I am finding that the "sound output write" vi is not acting as expected. My interpretation of the documentation for this vi is that when you input data to this vi (with zero timeout wired in), it should dump that data onto the output buffer then return to the main program while that data is being played. However, I am finding that this does not happen and that the vi takes at least as long to complete as it takes to play the data. The rest of the vi is completed in less than a millisecond so it is definitely this vi that is taking all of the time. This is causing the sound to be very clicky and sometimes doesn't even resemble a sound-wave.

 

Am I using the VIs wrong? is there a better way to go about achieving this? The VI I have written is attached. If the sine wave signal is set to 500Hz it sounds fine as the sample frequency is a multiple of this (Im not exactly sure why it works). If I have the sine wave signal set to 501Hz or 510Hz for example, you hear the problem I described above.

0 Kudos
Message 1 of 6
(6,025 Views)
Solution
Accepted by topic author Mark Eastwood

Just a suggestion.,

 

You might try windows media player activeX control.  Just load the file you want play using the property nodes of the activeX control and it does the remaining job.Smiley Happy

 

I am jus testing the vi you have attached and will post back if i got any ideas.

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
Message 2 of 6
(6,012 Views)

hi,

why dont you use sound pause function?

 

 

 

Gaurav k

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 3 of 6
(6,005 Views)
The windows media player control is a good suggestion, however I would need some way of integrating the audio into the file. The video is currently being recorded through IMAQ which I believe does not have sound capability, and the sound is being read in through DAQmx (is currently just an array of values). However if this could be done then the windows media player control could be very useful.
Message Edited by Mark Eastwood on 05-14-2009 09:55 PM
0 Kudos
Message 4 of 6
(5,968 Views)

Hello Mark,

 

The Vision Acquisition Software currently does not offer the functionality to record audio along with video to an AVI file. I would look at third-party software that you could call from within LabVIEW that would enable you to integrate the audio portion of the AVI file. LabVIEW does have the ability, however, to save the array of values you receive from the DAQ card to a .wav file, and the video to a .avi file. 

Vivek Nath
National Instruments
Applications Engineer

Machine Vision
0 Kudos
Message 5 of 6
(5,927 Views)

It is a well known problem that the Labview sound output system is not very good in 8.x. The sound system in 8.x do not support buffers. It did so in 7.1 but was removed in 8.x. NI have recognized it as a problem. But are not interesting in fixing it. They have chosen to ignore it instead.

I think if you are running XP you may use the old sound system. You can find more about it here

http://forums.ni.com/ni/board/message?board.id=170&message.id=403131&query.id=397064#M403131

This may also help you http://www.zeitnitz.de/Christian/index.php?sel=waveio. I use this a fix



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