Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playing audio on different devices?

I have a USB headphones connected to system. So now my system has two different audio output devices (one internal speakers and other is USB headphone). Though it is possible t choose the default the output device. What i am interested is play different audio on each of the device at the same time. In other words i am looking for a program solution which gives freedom to choose the device on which the audio should be played. By any means, using any library is this possible?

like image 936
Faiz Ali Avatar asked Nov 07 '25 12:11

Faiz Ali


1 Answers

If you use sounddevice.play(), you can simply specify the desired device with each call.

You can either use the device ID (e.g. device=3) or a substring of the device name (e.g. device='headphone', if that's part of the device name).

You can get a list of devices with:

python3 -m sounddevice
like image 108
Matthias Avatar answered Nov 10 '25 01:11

Matthias



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!