python-sounddevice
python-sounddevice copied to clipboard
Bluetooth device is not listing in sd.query_devices()
Hello, I am new to this, I just cloned the repo and I played one audion in the default audio device but it is not showing my Bluetooth headphones which are connected.
Here is the list of devices shown:-
I encounter the same problem, bluetooth device can't be queried. but if I use pyqt5.QMultimedia it can fetch the bluetooth audio devices
Are you talking about https://pypi.org/project/PyQt5/ ?
if yes then will it list Bluetooth devices by sd.query_devices()
or if there is another way to list them then how can I play music on those devices?
@Sameer-hesta
- while, as for PyQt5 you can refer to https://www.riverbankcomputing.com/static/Docs/PyQt5/api/qtmultimedia/qtmultimedia-module.html, but the method is different, not sd.query_devices()
- i tried sounddevice again, and found that it can fetch my bluetooth devices with sd.query_devices(). here bellow is the result
so you may shall the demo code to analyze. pls don't run sd.query_devices() in the console(or you need to rerun the console after you connect to your bluetooth devices), instead, put the demo code sd.query_devices() in a .py file and run it, here bellow is an example:
how can I play music on those devices? pls refer to doc of sounddevice, https://python-sounddevice.readthedocs.io/en/0.4.1/index.html good luck
The underlying PortAudio library currently doesn't have a "hotplug" feature, which means you have to initialize the library after you connect your bluetooth device.
If that's not possible, you can try to use sd._terminate()
followed by sd._initialize()
, see https://python-sounddevice.readthedocs.io/en/latest/api/expert-mode.html.
@Sameer-hesta did this resolve your problem? If so, feel free to close the issue.