spatialaudio / python-sounddevice

:sound: Play and Record Sound with Python :snake:
https://python-sounddevice.readthedocs.io/
MIT License
980 stars 145 forks source link

Glitch during playback #452

Open grundew opened 1 year ago

grundew commented 1 year ago

I'm playing back a continuous sine at 250 Hz and occasionally I get a glitch in the middle of the tone.

I always get a glitch at the start and the end.

I have tried both using a callback written in python and in c to try to avoid the GIL and GC disturbing something. But none of them help.

I've also played around with different latency settinga without luck.

Audio interface: focusrite 18i20 Os: windows

mgeier commented 1 year ago

If you start and stop a sine tone abruptly, it is expected to hear an glitch.

See e.g. https://nbviewer.org/github/spatialaudio/communication-acoustics-exercises/blob/master/intro.ipynb#Listening-to-the-Signal

If there are glitches in the middle, there are two likely reasons:

If you share your code (reduced to a minimum), I might be able to help spotting the problem.