LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous sound output

Hi all!

 

I am working on a real time application that acquires FM signal using niRFSA, demodulates it and sends it to speakers ard using 'sound output write.vi'. The problem is i don't hear a continuous, smooth audio. At every loop iteration, there is a gap between the audio. I want to know how the sound output buffer works? Does it overwrite or append the new buffer at  every loop iteration? How can i overcome this problem?

 

Any kind of help would be highly appreciated!

 

regards

0 Kudos
Message 1 of 6
(4,735 Views)

Hi Sandee,

 

 

To understand the behaviour of the sound output buffer just play a wav file from the example present in the example finder.

 

Play it on the pc speakers.

 

I think there is some kind of noise or time lag in the program.

 

Regards

0 Kudos
Message 2 of 6
(4,728 Views)

Hi Shrekt!

 

The acquired signal that i am giving to the SO write VI is also written to the file at the same time. When I play that file using example 'sound file to sound output', the signal that i hear is a continuous signal without any gaps in between. But the same signal if i give it directly to my speakers using the sound output write vi is not a clear one. 

 

I am acquiring the signal at an IQ rate of 150kS/s with 150k samples as the number of samples to acquire. After demodulation  i resample it to 11025KS/s and give it sound output write.vi. Configuration parameters for the sound output device are 16 bits/sample, 11025S/s, 11025 S/channel, mono channel. Is there any relatonship between number of samples per channel and sample rate? Also how does the SO write.vi writes data to the buffer between labview and output device? Is it a circular buffer?

 

 

Thanks

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

I guess this is due to a bug in the Labview sound system. The Labview sound system is full of bugs but hopefully a fix will come in the next version.  I have reported some bugs here http://forums.ni.com/ni/board/message?board.id=170&message.id=441154#M441154

Your problem is related to CAR 187316. You can use the old sound system used in Labview 7.x. That is much better in many ways. You may have the old sound system installed you will find it here ......\National Instruments\LabVIEW 8.6\vi.lib\sound\lvsound.llb It is not on the palette. If you do not find it I can send it to you.



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

Hi Coq Rouge,

 

Thanks for the help. I have tried it using the VIs with lvsound.llb and its working fine now. 

What I have understood is that inorder to have a continuous, smooth audio, you'll have to make sure that the buffer never empties because after every loop iteration the buffer empties and its impossible to refill the buffer at the exact time when the last sample was played.

 

I want to know that how does increasing the number of buffers in "SO set num of buffers.vi" ensures smooth audio without any glitches? because when I set it to default (i.e 0), I hear the audio with glitches and disappears when I start increasing the number of buffers. Also what the maximunm number of buffers I can set?

 

Thanks

0 Kudos
Message 5 of 6
(4,661 Views)

Sandee wrote:

Hi Coq Rouge,

I want to know that how does increasing the number of buffers in "SO set num of buffers.vi" ensures smooth audio without any glitches? because when I set it to default (i.e 0), I hear the audio with glitches and disappears when I start increasing the number of buffers. Also what the maximunm number of buffers I can set?

Thanks


Switching from one buffer to another is very fast. While one buffer is played the other can be preparedI do not know how sound cards works exactly but I know they use DMA, and is quite autonomous. That will say a sound card does not need constant attention from the CPU.

I do not know how many buffers you can set. I can not find anything about it the Labview help. I think it is more important how long each buffer plays. I have read some place that buffer play length below 0.02 sec is not recommended as it take to much of the CPU time. But I guess this also is system dependent



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
(4,655 Views)