Bluetooth audio, bmixd and aloopd
stemsee wrote: Thu Nov 04, 2021 1:21 pmI also have a question regarding bmixd and default soundcard script.
There are two ways to connect to bluetooth audio in Fatdog up to 812rc. (The next release will add a 3rd way).
All of these are activated using fatdog-default-soundcard.sh
Method 1) Connect to bluetooth directly.
Method 2) Connect to bluetooth using bmixd (bluetooth-dmix-daemon).
Method 3) Connect to bluetooth using aloopd. (Not yet available, to be released in next release of Fatdog, probably in 812)
Method 1: Direct bluetooth connection
This was the oldest method. It still works, but it is less convenient.
Steps:
1. Pair the bluetooth speaker, using bluetoothctl
a) Run bluetoothctl
b) Inside bluetoothctl's prompt, type "scan"
c) when you see the device you want, type "pair AA:BB:CC:DD:EE" where AA:BB:CC:DD:EE is the bluetooth MAC address you see.
2. Run fatdog-default-soundcard.sh
3. Choose "bluetooth devices" (last option).
4. Choose device you have just paried in step 1.
5. Start the audio app.
6. When you're done, don't forget to run "bluetoothctl" again and type "disconnect"
Pro: simple, no daemon needed.
Con: only one application can use the sound at one time. If one audio app is already using sound, starting a second audio app will fail. Switching between bluetooth speakers and/or internal soundcards require you to stop the audio app, run fatdog-default-soundcard, and then re-start it.
Method 2: Bluetooth connection using bmixd
Steps:
1. Pair the bluetooth device as above described in method #1.
2. Run fatdog-default-soundcard.sh, and choose "Bluetooth devices using blue-alsa bmixd"
3. Back on terminal, type "service bmixd start"
4. Run bluetoothctl, and inside, type "paired-devices". This will give you a list of the devices that you have paired before.
5. Type "connect AA:BB:CC:DD:EE" where AA:BB:CC:DD:EE is one of the devices you see in previous step.
6. Start the audio app
7. When you're done, don't forget to run "bluetoothctl" again and type "disconnect"
Pro: Multiple apps can output to bluetooth speaker. You can change the bluetooth devices any time you want, without restarting the audio app. If you want to switch to internal soundcard, however, you still have to re-start the app.
Con: Requires you to run the bmixd daemon.
Method 3: Bluetooth connection using aloopd
Steps:
1. Pair the bluetooth device as above described in method #1.
2. Run fatdog-default-soundcard.sh, and choose "ALSA Loop sound server (aloopd)"
3. Back to terminal, run bluetoothctl, and inside, type "paired-devices". This will give you a list of the devices that you have paired before.
4. Type "connect AA:BB:CC:DD:EE" where AA:BB:CC:DD:EE is one of the devices you see in the preivous step.
5. Edit $HOME/.aloopdrc and specify the bluetooth address AA:BB:CC:DD:EE as the bluetooth target device.
6. Type "service aloopd start".
7. Start the audio app
8. When you're done, don't forget to run "bluetoothctl" again and type "disconnect"
We may create a GUI for step 5, so you don't have to write it manually.
Pro: Multiple apps can output to bluetooth speaker. You can change the bluetooth devices any time you want, switch between internal soundcard(s), and bluetooth anytime, without restarting the app. You can also record what you hear.
Con: Requires you to run the aloopd daemon.
________________________
Notes:
1. The operations that requires the interactive "bluetoothctl" can also be done scripted using others commands: "bt-device" to connect/disconnect/pair/unpair, and "bt-adapter" to view nearby devices. See details here.
2. We used to have a GUI for all this, but when we upgraded to bluez 5, we lost that GUI tool; and we haven't gotten the chance to re-write a new GUI too. I remember, though that @stemsee had written some sort of GUI for that.