This project has moved and is read-only. For the latest updates, please go here.

Short gaps during playback

Jan 12, 2011 at 1:12 PM


in my application i use a a socket connection between 2 pcs to transfer audio datat (speex encoded). The transmission and decpding works very well but sometimes

during playback i have small gaps, in this case the playback buffer is zero filled. I am using BufferedWaveProvider for playback.

How can i avoid this? This happens also when i buffer more data.

The Waveformat is 8000 kHz, 16 bit, mono.





Jan 12, 2011 at 1:14 PM

I forgot to metion that the callback function for playing audio is called and not enough bytes are available... so the rest is filled with zeros...

Jan 13, 2011 at 11:14 AM

if there aren't enough bytes queued in the BufferedWaveProvider there is not much you can do - you simply are not providing data fast enough for playback. Possibly you could 'pause' playback (i.e. play a bit more silence) whenever you don't have enough data buffered (e.g. 1 seconds worth).

Jan 13, 2011 at 11:21 AM

Yes there are missing some bytes which (approx. 500 bytes of PCM data (8000 hHz, 16 bit, mono) in 10 seconds. Bute when the silence (0 bytes) are played... i hear a clicking noise from the pseakers. Is it possibel to fill these bytes with audio data which "fits" to the data played before?


Jan 13, 2011 at 11:23 AM

you need a brief fade-in/fade-out. Over the course of a few samples (16 bit, so byte pairs), move towards zero.

Jan 26, 2011 at 7:33 AM

I have another question...

Is it poosible to use waveout buffer (which are send to the sound card) with dynamic sizes? Now each read does return the same datasize. Is it possible to fill them dynamically?



Jan 27, 2011 at 1:18 PM

you could, although it would render the "latency" time unreliable. You'd probably have to create your own custom version of WaveOut to do it