As the title mentions, importing sounddevice interrupts any currently playing audio streams momentarily on Windows when exclusive mode is enabled on the sound device. This issue seems to originate from PortAudio's initialization logic, however, I can't seem to pinpoint the problematic code there, and there isn't a similar issue opened there either.
To replicate the issue:
- On Windows 10/11, enable exclusive mode on the default sound device.
- Run any audio stream in the background (it doesn't seem necessary for the stream to be using exclusive mode)
import sounddevice (can be run in the python interactive interpreter; the current audio stream will be interrupted as a result)
This issue does not occur if exclusive mode is disabled in the sound device. I'd assume this issue can be reproduced on Windows 7 as well.