Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help setting up bluetooth headphones with ALSA
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
phodgson11
n00b
n00b


Joined: 04 Sep 2019
Posts: 9

PostPosted: Tue Jul 02, 2024 12:37 am    Post subject: Help setting up bluetooth headphones with ALSA Reply with quote

Hello,

I've followed the guide on the wiki for bluetooth headsets, and gotten everything to work, but it's not gotten me what I expected: you have to pass the 'bluealsa' device to the application before you run it, so already running applications can't switch, and some applications don't even have that as an option. Making it the default device fixes the latter, but not the former.

I want to be able to switch from my laptop speakers to the bluetooth headset on the fly, so I would like the bluetooth headset to be added as another output for the default alsa device, similar to the speakers and headphone jack, which can be independently muted, so I could just toggle between muting the speakers and muting the headset with amixer. Is it possible to do this?

I don't have much experience with audio programming and ALSA, especially asound.conf, is very cryptic to me. Any help or links to tutorials would be much appreciated. Or let me know if this is a problem which can only be solved with another layer of software like Pulseaudio.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 512

PostPosted: Tue Jul 02, 2024 6:37 am    Post subject: Reply with quote

Hi

I think that ALSA simply does not have the capability you require. Using BT headphones with ALSA is a painful experience, because ALSA is not designed to allow applications to switch audio devices at runtime. Applications could be coded to make that possible but, on the whole, my experience is that they have not been. Usually an application just opens an ALSA device, and keeps it open until it exits.

I think this is the main limitation of ALSA that Pulse/Pipewire was developed to improve. An application can keep open a Pulse channel, and let Pulse switch ALSA devices. But that does mean giving Pulse/PipeWire complete control of the ALSA system, which is not something I can put up with.

FWIW `blueaudio` is not an ALSA PCM, but a protocol. Applications that enumerate PCMs in ALSA won't usually see blueaudio as a choice. However, my experience is that all applications (that I've tried) will use bluealsa if they are forced to. For example:

vlc -A alsa --alsa-audio-device:bluealsa

That works, even though VLC does not list 'bluealsa' as an ALSA output device.

I do use ALSA with BT headphones, but I don't find it an agreeable experience. I don't usually wish to have Pulse back, but that's a time when I do :/

BR, Lars.
Back to top
View user's profile Send private message
phodgson11
n00b
n00b


Joined: 04 Sep 2019
Posts: 9

PostPosted: Tue Jul 02, 2024 8:43 pm    Post subject: Reply with quote

Thank you for the informative reply. I'll think about my options.

If you don't mind me asking, I'm curious how do Pulse/Pipewire take complete control of ALSA so that it is unusable to you?
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 512

PostPosted: Wed Jul 03, 2024 7:09 am    Post subject: Reply with quote

phodgson11 wrote:
I'm curious how do Pulse/Pipewire take complete control of ALSA so that it is unusable to you?


I use an external DAC for audio. It tells me the sample rate and bit width of the data stream it receives. In general, with Pulse/PipeWire they don't match what I'm trying to play. So I configure my music player to write directly to ALSA, using a specific 'hw:...' protocol. But very often this fails, because the low-level device is already held open by Pulse or PipeWire.

Usually this only happens if I have played audio via Pulse/PipeWire already. I think these things don't automatically open every ALSA device -- I think they do it when they have to, and then don't let go. If I restart Pulse/PipeWire, I can usually free the ALSA device. But it's a nuisance, having to do this.

My main problem with Pulse/PipeWire is the amount of system resources they use. The ALSA lock-out thing is a nuisance, rather than a show-stopper. Pulse uses ~10% CPU on my old laptop when playing high-resolution audio files. Sometimes, it uses 100%, even when doing nothing. I take that to be a bug.

BR, Lars.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum