Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Multimedia
  • Search

[solved] pipewire as a bluetooth headset for a phone?

Help with creation, editing, or playback of sounds, images, or video. Amarok, audacious, mplayer, grip, cdparanoia and anything else that makes a sound or plays a video.
Post Reply
Advanced search
14 posts • Page 1 of 1
Author
Message
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

[solved] pipewire as a bluetooth headset for a phone?

  • Quote

Post by szatox » Thu Jun 26, 2025 6:53 pm

I can pair a bt speaker, and wireplumber connects it to the sources in pipewire. And it would be nice to be able to go the other way too:
I want to use my big big computer headphones and maybe some audio filters when making phone calls.

I had a look around the internet, and it _seems_ that pipewire with bluez should be able to do everything I want, but this part is not enabled by default:
https://pipewire.pages.freedesktop.org/ ... properties
The question is: how do I enable hsp-hs or hfp-hf roles? Grepping through configs and scripts in /usr/share/wireplumber didn't get me very far this time, so I'm looking for hints.


For a bit of extra context, snippets from wpctl status with either the speaker or the phone connected. Playing something through bt speaker also adds filters, but there is nothing to show when idle.
The phone does currently recognize my computer as a headset, though it could be an aftereffect of having used bluez-alsa, which was probably a wrong approach. Either way, the phone is trying to send audio to the PC, but my PC doesn't do anything with it.

Code: Select all

Audio
 ├─ Devices:
 │      47. SRS-XB10                            [bluez5]
 │     176. Built-in Audio                      [alsa]
 │  
 ├─ Sinks:
 │      39. Built-in Audio Analog Stereo        [vol: 0.18]
 │  *   44. SRS-XB10                            [vol: 0.24]
 │      75. Easy Effects Sink                   [vol: 1.00]
 │  

Code: Select all

Audio
 ├─ Devices:
 │     103. MYPHONE                             [bluez5]
 │     176. Built-in Audio                      [alsa]
 │  
 ├─ Sinks:
 │  *   39. Built-in Audio Analog Stereo        [vol: 0.18]
 │      75. Easy Effects Sink                   [vol: 1.00]
 │  
Last edited by szatox on Sun Jun 29, 2025 9:54 pm, edited 1 time in total.
Make Pipewire a system service
Top
fpemud
Guru
Guru
Posts: 368
Joined: Wed Feb 15, 2012 7:00 am

  • Quote

Post by fpemud » Fri Jun 27, 2025 5:46 am

Also interested on this.

I think it would be great to have a command that lets computers 'lend' hardware to other systems - whether via bluetooth or usb connection.
This could go beyond just headphones (speaker & microphone) to include peripherals like keyboards, mice, and even joysticks.

For example, I could 'lend' my joystick to my iPad, making it feel like I'm controlling the iPad directly, even though the signal actually routes through my main computer:

Joystick -> Bluetooth -> Main PC -> Bluetooth -> iPad

This kind of hardware passthrough would be super useful.
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Fri Jun 27, 2025 12:30 pm

fpemud, I think you're essentially looking for USB over IP, or maybe Synergy if it's only for keyboard and mouse. Both of those are out of scope for me though.
I don't want to "share" hardware in general; just enable bluetooth headset role in addition to already enabled bluetooth audio gateway role. It is a very specific service running on bluetooth nodes, and it is widely used on commercially available devices.
Make Pipewire a system service
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4692
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Fri Jun 27, 2025 1:13 pm

Have you tried to just do the audio routing via time GUI patchbay program, like helvum?
I once played around with such tool and I was able to directly route youtube video audio to signal-desktop so that my friend on the signal call could easily hear it.
If it works, then you could write some script to enable or disable the bluetooth audio routing.
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Fri Jun 27, 2025 1:44 pm

> Have you tried to just do the audio routing via time GUI patchbay program, like helvum?

I'm not there yet. There is neither sink, source, nor client node representing the phone, though it is detected as a "device", whatever that means.
I need pipewire to create a node for bluez first. See status snippet from my first post. The docs I linked kinda imply all code is already there, but disabled by default, because it confuses some BT headsets. So I basically need to find the switch.
Make Pipewire a system service
Top
Anon-E-moose
Watchman
Watchman
User avatar
Posts: 6566
Joined: Fri May 23, 2008 7:31 pm
Location: Dallas area

  • Quote

Post by Anon-E-moose » Fri Jun 27, 2025 3:59 pm

are you talking about this stuff

Code: Select all

monitor.bluez.properties = {
  ## The properties used when constructing the 'api.bluez5.enum.dbus' plugin

  ## Enabled roles (default: [ a2dp_sink a2dp_source bap_sink bap_source hfp_hf hfp_ag ])
  ##
  ## Currently some headsets (Sony WH-1000XM3) are not working with
  ## both hsp_ag and hfp_ag enabled, so by default we enable only HFP.
  ##
  ## Supported roles: hsp_hs (HSP Headset),
  ##                  hsp_ag (HSP Audio Gateway),
  ##                  hfp_hf (HFP Hands-Free),
  ##                  hfp_ag (HFP Audio Gateway)
  ##                  a2dp_sink (A2DP Audio Sink)
  ##                  a2dp_source (A2DP Audio Source)
  ##                  bap_sink (LE Audio Basic Audio Profile Sink)
  ##                  bap_source (LE Audio Basic Audio Profile Source)
  # bluez5.roles = [ a2dp_sink a2dp_source bap_sink bap_source hsp_hs hsp_ag hfp_hf hfp_ag ]
  bluez5.roles = [ a2dp_source hsp_hs hsp_ag hfp_hf hfp_ag ]
UM780 xtx, 6.18 zen kernel, gcc 15, openrc, wayland
minixforum m1-s1 max -- same software as above but used for ai learning


Zealots are gonna be zealots, just like haters are gonna be haters
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Fri Jun 27, 2025 6:02 pm

Yeah, though I don't see anything similar in the installed configs.
Make Pipewire a system service
Top
Anon-E-moose
Watchman
Watchman
User avatar
Posts: 6566
Joined: Fri May 23, 2008 7:31 pm
Location: Dallas area

  • Quote

Post by Anon-E-moose » Fri Jun 27, 2025 10:13 pm

/usr/share/doc/wireplumber/examples/wireplumber.conf.d/bluetooth.conf.bz2
UM780 xtx, 6.18 zen kernel, gcc 15, openrc, wayland
minixforum m1-s1 max -- same software as above but used for ai learning


Zealots are gonna be zealots, just like haters are gonna be haters
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Sat Jun 28, 2025 1:17 pm

Right, I completely missed docs with examples. Thanks.
It seems to be a lua script, but it still goes into the conf directory, and it apparently it is OK to pick only the interesting fragments from it, leaving the rest to be imported from /usr/share/wireplumber.

So, I made some progress. I am now able to present my pc as a headset to my phone. Speakers and mike both get connected, though mike is very quiet and stubbornly ignores my input filters... Output filters on the other hand are respected.
And it only works if I start wireplumber from within my user session. If I start it as a service instead, it wireplumber segfaults the moment my phone attempts to connect to hfp_hf. Sometimes it even takes down bluetooth service with it. Still, it is a good start.

Funny enough, bluetooth speaker does not crash wireplumber started as a service. I can even connect it without logging in at all and get the audio, as long as something tells mpd to start playing. I'm gonna try disabling hfp and using the older hsp instead. Maybe it's just that one service that is buggy...
Make Pipewire a system service
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Sun Jun 29, 2025 9:54 pm

Ok, so, after enabling bluez5.roles with exeption of hfp_hf (to force using the older hsp_hs instead) it seems to be working.
Well, phone's volume is out of whack, but I should be able to get it under control after doing a few more tests. The important thing is that I made sound go through in both directions, and nothing crashed on me.
Mission successful. Thanks, everyone!

Edit: the phone has its own volume control and applies it to the stream going to the headset instead of leaving it as-is for the headset to handle. No wonder I could barely hear anything.
Make Pipewire a system service
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4692
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Sat Jul 19, 2025 12:28 pm

I wonder if It was possible to do the same with my TV..?
I mean have my laptop act as bluetooth audio sink for both my phone and TV, so I could have (a cacophony of) audio of all the devices to my laptop... As a bonus, a incoming call would mute all others.

Maybe I'll try to have the TV audio routed first.
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4692
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Fri Aug 15, 2025 8:18 pm

Zucca wrote:Maybe I'll try to have the TV audio routed first.
So.
I wanted to try this now, as I got my shiny new wired headphones.

When I run

Code: Select all

bluetoothctl connect <my-tv-btMAC> a2dp-source
... I see my TV appear as audio source in qpwgraph. So that was simple. But oh boy the audio does stutter... Or more like it cuts completely and then continues again, then cuts... Like it's out of buffer.

szatox, did you have anything like this?

Btw the same happens when on reverse: when I play audio to my TV.
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4692
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Sat Aug 16, 2025 5:54 am

Well. I managed to stop stuttering almost completely...

Code: Select all

M2-Air ~ # cat /etc/pipewire.d/context_properties.conf 

context.properties = {

        ## Properties for the DSP configuration.
        default.clock.rate          = 48000
        default.clock.allowed-rates = [ 44100 48000 96000 192000 ]
        default.clock.quantum       = 4096
        default.clock.min-quantum   = 512
        default.clock.max-quantum   = 8192
        #default.clock.quantum-limit = 8192
        #default.clock.quantum-floor = 4
        #default.video.width         = 640
        #default.video.height        = 480
        #default.video.rate.num      = 25
        #default.video.rate.denom    = 1
        #
        #settings.check-quantum      = false
        #settings.check-rate         = false

}
I'll start another topic If I can't get the settings adjusted properly...
I wonder why pipewire can't autoadjust these if it detects stuttering... I mean my "stupid" cheapo earbuds don't stutter when connected to my TV, but only at the very beginning of playback, so they clearly do some auto adjusting.
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Mon Dec 01, 2025 1:17 pm

I haven't head problems with stuttering, but I know bluetooth audio has modes optimized for phone calls (low latency) and media playback (sound quality), and can be set to different bitrates, including adaptive bitrate dependent on link quality - this is probably what your headphones are doing.
My guess is you had it set to high quality sound over an insufficient link (suffering form low signal strength or interference)
Make Pipewire a system service
Top
Post Reply

14 posts • Page 1 of 1

Return to “Multimedia”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic