Skip to content Skip to sidebar Skip to footer

Continuous Audio Playback With Sounddevice

I am writing a program to stream audio over a network, so I have a thread to record data and one to send it. When testing the audio has noticeable gaps. I beleive this is due to th

Solution 1:

The function sd.play() is not meant to be used repeatedly in rapid succession. Internally, it each time creates an sd.OutputStream, plays the audio data and closes the stream again. Because of opening and closing the stream, gaps will occur. This is expected.

For continuous playback you should use the sd.OutputStream.write() function or, even better, an sd.OutputStream with a custom callback function (as shown in some of the example programs).

The same thing also happens in the documentation audio passthrough example here.

This must have a different reason. This should work, and it works fine for me. Can you please describe the problem in more detail? Are there any messages printed to the terminal?

Post a Comment for "Continuous Audio Playback With Sounddevice"