post: Current state of audio routing #38

Merged
agx merged 2 commits from agx/phosh-site:media-role into main 2025-10-26 11:59:53 +01:00
Owner
No description provided.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
agx force-pushed media-role from 1d4f8dc88f to 44e3a9e453
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
2025-10-25 18:15:03 +02:00
Compare
agx force-pushed media-role from 44e3a9e453
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
to b3612babac
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
2025-10-25 18:24:24 +02:00
Compare
agx force-pushed media-role from b3612babac
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
to 48366e0068
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
2025-10-26 07:49:22 +01:00
Compare
agx force-pushed media-role from 48366e0068
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
to 6067a28879
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
2025-10-26 07:49:40 +01:00
Compare
agx force-pushed media-role from 6067a28879
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
to f2e6916235
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
2025-10-26 07:53:15 +01:00
Compare
Author
Owner

v1.1

  • Add mention of pulseaudio duck/cork
v1.1 - Add mention of pulseaudio duck/cork
agx force-pushed media-role from f2e6916235
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
to addd754895
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
2025-10-26 08:44:05 +01:00
Compare
Author
Owner

v1.2

  • Rework "Next steps" as we can enable most things sooner
v1.2 - Rework "Next steps" as we can enable most things sooner
agx force-pushed media-role from addd754895
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
to 7a41e8ad93
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
2025-10-26 08:50:27 +01:00
Compare
Author
Owner

v1.3

  • Tweak title a bit
v1.3 - Tweak title a bit
arun-mani-j left a comment
Member

Thanks! Actually TIL of such feature in LInux, hopefully everyone starts to make use of such features.

Just minor typos and inclusion of commas and full-stops, so it is easier to read. Rest all looks good to me.

Thanks! Actually TIL of such feature in LInux, hopefully everyone starts to make use of such features. Just minor typos and inclusion of commas and full-stops, so it is easier to read. Rest all looks good to me.
@ -0,0 +12,4 @@
What if you want to have your phone's alarm clock volume different from your music playback volume
and have the later go to speakers while alarms should continue to go to the phone's speaker?
While this could be handled via manually set up, per application volume and sink setups this doesn't
Member
- While this could be handled via manually set up, per application volume and sink setups this doesn't 
+ While this could be handled manually via per application volume and sink setups, this doesn't 
```diff - While this could be handled via manually set up, per application volume and sink setups this doesn't + While this could be handled manually via per application volume and sink setups, this doesn't ```
@ -0,0 +18,4 @@
incoming call while music is playing).
THe modern Linux audio stack uses [pipewire][] and [wireplumber][] and the wireplumber maintainers
implemented a solution for this called *role* *based* routing. In the following we'll explore how
Member
- implemented a solution for this called *role* *based* routing. In the following we'll explore how 
+ implemented a solution for this called *role based* routing. In this post we'll explore how 
```diff - implemented a solution for this called *role* *based* routing. In the following we'll explore how + implemented a solution for this called *role based* routing. In this post we'll explore how ```
@ -0,0 +19,4 @@
THe modern Linux audio stack uses [pipewire][] and [wireplumber][] and the wireplumber maintainers
implemented a solution for this called *role* *based* routing. In the following we'll explore how
this works, what is already implemented and what we needs to do before we can enable it by default
Member
- this works, what is already implemented and what we needs to do before we can enable it by default 
+ this works, what is already implemented and what we need to do before so we can enable it by default 
```diff - this works, what is already implemented and what we needs to do before we can enable it by default + this works, what is already implemented and what we need to do before so we can enable it by default ```
@ -0,0 +33,4 @@
While ducking and corking is being leveraged with pulseaudio to e.g. silence music during phone
calls on e.g. the Librem 5
[already](https://source.puri.sm/Librem5/librem5-base/-/blob/pureos/latest/default/audio/pulse/librem5.pa#L26-L31)
Member
- [already](https://source.puri.sm/Librem5/librem5-base/-/blob/pureos/latest/default/audio/pulse/librem5.pa#L26-L31) 
+ [already](https://source.puri.sm/Librem5/librem5-base/-/blob/pureos/latest/default/audio/pulse/librem5.pa#L26-L31),
```diff - [already](https://source.puri.sm/Librem5/librem5-base/-/blob/pureos/latest/default/audio/pulse/librem5.pa#L26-L31) + [already](https://source.puri.sm/Librem5/librem5-base/-/blob/pureos/latest/default/audio/pulse/librem5.pa#L26-L31), ```
@ -0,0 +39,4 @@
## Media Roles
In order to leverage this applications tag their audio streams with a certain role so wireplumber
Member
- In order to leverage this applications tag their audio streams with a certain role so wireplumber 
+ In order to leverage this, applications tag their audio streams with a certain role so wireplumber 
```diff - In order to leverage this applications tag their audio streams with a certain role so wireplumber + In order to leverage this, applications tag their audio streams with a certain role so wireplumber ```
@ -0,0 +45,4 @@
for alarm clocks, cellbroadcasts incoming calls, etc. is usually emitted by feedbackd these
applications don't need to anything as feedbackd will set an appropriate role.
The roles are currently not standardized on Linux so we researched a bit what is in use and
Member
- The roles are currently not standardized on Linux so we researched a bit what is in use and 
+ The roles are currently not standardized on Linux, so we researched a bit on what is in use and 
```diff - The roles are currently not standardized on Linux so we researched a bit what is in use and + The roles are currently not standardized on Linux, so we researched a bit on what is in use and ```
@ -0,0 +68,4 @@
If you want to test this you can build [feedbackd](https://gitlab.freedesktop.org/agx/feedbackd)
with `-Dmedia-roles`. `meson install` will then put a `media-role-nodes.conf` into
`/usr/share/wireplumber/wireplumber.conf.d/` enabling media role based
Member
- `/usr/share/wireplumber/wireplumber.conf.d/` enabling media role based 
+ `/usr/share/wireplumber/wireplumber.conf.d/` enabling media roles 
```diff - `/usr/share/wireplumber/wireplumber.conf.d/` enabling media role based + `/usr/share/wireplumber/wireplumber.conf.d/` enabling media roles ```
@ -0,0 +70,4 @@
with `-Dmedia-roles`. `meson install` will then put a `media-role-nodes.conf` into
`/usr/share/wireplumber/wireplumber.conf.d/` enabling media role based
in Wireplumber and feedbackd will then add `media.role` properties to the emitted events ensuring
that e.g. incoming calls or emergency alerts will silence any playing music or game output.
Member
- that e.g.  incoming calls or emergency alerts will silence any playing music or game output. 
+ that e.g. incoming calls or emergency alerts will silence any playing music or game output. 
```diff - that e.g. incoming calls or emergency alerts will silence any playing music or game output. + that e.g. incoming calls or emergency alerts will silence any playing music or game output. ```
@ -0,0 +72,4 @@
in Wireplumber and feedbackd will then add `media.role` properties to the emitted events ensuring
that e.g. incoming calls or emergency alerts will silence any playing music or game output.
### How do check if role based routing is active
Member
- ### How do check if role based routing is active 
+ ### How to check if role based routing is active? 
```diff - ### How do check if role based routing is active + ### How to check if role based routing is active? ```
@ -0,0 +74,4 @@
### How do check if role based routing is active
If role based routing is active the `wpctl status` output should list the known media roles as
Member
- If role based routing is active the `wpctl status` output should list the known media roles as 
+ If role based routing is active, then `wpctl status` output should list the known media roles as 
```diff - If role based routing is active the `wpctl status` output should list the known media roles as + If role based routing is active, then `wpctl status` output should list the known media roles as ```
@ -0,0 +137,4 @@
{ "subject": 0, "key": "current.role-based.volume.control", "type": "Spa:String:JSON", "value": { "name": "input.loopback.sink.role.alarm" } }
```
We can then use that in Phosh to make the default volume slider operation on this volume control. A
Member
- We can then use that in Phosh to make the default volume slider operation on this volume control. A 
+ We can then use that in Phosh to make the default volume slider operate on this volume control. A 
```diff - We can then use that in Phosh to make the default volume slider operation on this volume control. A + We can then use that in Phosh to make the default volume slider operate on this volume control. A ```
@ -0,0 +139,4 @@
We can then use that in Phosh to make the default volume slider operation on this volume control. A
prototype for this can be found
[here](https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1714))
Member
- [here](https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1714)) 
+ [here](https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1714)).
```diff - [here](https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1714)) + [here](https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1714)). ```
@ -0,0 +143,4 @@
## Routing Target
With volume controls sorted out there's still the question where to output to. Mobile phones usually
Member
- With volume controls sorted out there's still the question where to output to. Mobile phones usually 
+ With volume controls sorted out there's still the question of where to output to. Mobile phones usually 
```diff - With volume controls sorted out there's still the question where to output to. Mobile phones usually + With volume controls sorted out there's still the question of where to output to. Mobile phones usually ```
@ -0,0 +144,4 @@
## Routing Target
With volume controls sorted out there's still the question where to output to. Mobile phones usually
have a speaker and an earpiece and also often Bluetooth headphones are connected to. While the later
Member
- have a speaker and an earpiece and also often Bluetooth headphones are connected to. While the later 
+ have a speaker and an earpiece and also often Bluetooth headphones connected to it. While the later 
```diff - have a speaker and an earpiece and also often Bluetooth headphones are connected to. While the later + have a speaker and an earpiece and also often Bluetooth headphones connected to it. While the later ```
@ -0,0 +145,4 @@
With volume controls sorted out there's still the question where to output to. Mobile phones usually
have a speaker and an earpiece and also often Bluetooth headphones are connected to. While the later
might be the right target for music one usually wants emergency alerts and alarms routed to the
Member
- might be the right target for music one usually wants emergency alerts and alarms routed to the 
+ might be the right target for music, one usually wants emergency alerts and alarms routed to the 
```diff - might be the right target for music one usually wants emergency alerts and alarms routed to the + might be the right target for music, one usually wants emergency alerts and alarms routed to the ```
@ -0,0 +159,4 @@
# Trying it out
So how can you try that out. Until more things made it into releases we have to build some
Member
- So how can you try that out. Until more things made it into releases we have to build some 
+ So how can you try that out? Until more things made it into releases we have to build some 
```diff - So how can you try that out. Until more things made it into releases we have to build some + So how can you try that out? Until more things made it into releases we have to build some ```
@ -0,0 +162,4 @@
So how can you try that out. Until more things made it into releases we have to build some
components from source:
* [feedbackd][]: The needed changes are merge so you can clone it an run from the working copy
Member
- * [feedbackd][]: The needed changes are merge so you can clone it an run from the working copy 
+ * [feedbackd][]: The needed changes are merged, so you can build it from the latest upstream. 
```diff - * [feedbackd][]: The needed changes are merge so you can clone it an run from the working copy + * [feedbackd][]: The needed changes are merged, so you can build it from the latest upstream. ```
@ -0,0 +173,4 @@
_build/run
```
* [wireplumber][] git has the needed changes merged so you can build and run from the working copy
Member
- * [wireplumber][] git has the needed changes merged so you can build and run from the working copy 
+ * [wireplumber][] has the needed changes merged, so you can build it from the latest upstream. 
```diff - * [wireplumber][] git has the needed changes merged so you can build and run from the working copy + * [wireplumber][] has the needed changes merged, so you can build it from the latest upstream. ```
@ -0,0 +186,4 @@
./wp-uninstalled.sh wireplumber
```
* [phosh-mobile-settings][] has support built in since 0.47, no need to build anything
Member
- * [phosh-mobile-settings][] has support built in since 0.47, no need to build anything 
+ * [phosh-mobile-settings][] has support built in since 0.47, so no need to build anything.
+ 
```diff - * [phosh-mobile-settings][] has support built in since 0.47, no need to build anything + * [phosh-mobile-settings][] has support built in since 0.47, so no need to build anything. + ```
@ -0,0 +204,4 @@
With this you should be able to check if the role based policies are active and e.g. see the volume
slider in mobile settings.
If you can do without an GUI bits and want to avoid building lots of stuff manually but still want
Member
- If you can do without an GUI bits and want to avoid building lots of stuff manually but still want 
+ If you can do without GUI bits and want to avoid building lots of stuff manually, but still want 
```diff - If you can do without an GUI bits and want to avoid building lots of stuff manually but still want + If you can do without GUI bits and want to avoid building lots of stuff manually, but still want ```
@ -0,0 +205,4 @@
slider in mobile settings.
If you can do without an GUI bits and want to avoid building lots of stuff manually but still want
to try things out it sufficient to only build wireplumber and add the policy. You can then use
Member
- to try things out it sufficient to only build wireplumber and add the policy. You can then use 
+ to try things out, it is sufficient to only build wireplumber and add the policy. You can then use 
```diff - to try things out it sufficient to only build wireplumber and add the policy. You can then use + to try things out, it is sufficient to only build wireplumber and add the policy. You can then use ```
agx force-pushed media-role from 7a41e8ad93
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
to 95c1b32390
Some checks failed
ci/woodpecker/pr/lint Pipeline failed
2025-10-26 11:35:27 +01:00
Compare
Author
Owner

Thanks a lot @arun-mani-j , I've applied all of it and made some more tweaks for (hopefully) clarity.

Thanks a lot @arun-mani-j , I've applied all of it and made some more tweaks for (hopefully) clarity.
agx force-pushed media-role from 95c1b32390
Some checks failed
ci/woodpecker/pr/lint Pipeline failed
to b106a3727b
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
2025-10-26 11:36:41 +01:00
Compare
agx force-pushed media-role from b106a3727b
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
to 2c8d111473
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
2025-10-26 11:40:22 +01:00
Compare
agx force-pushed media-role from 2c8d111473
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
to cfcc6f4c13
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
2025-10-26 11:52:57 +01:00
Compare
agx force-pushed media-role from cfcc6f4c13
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
to 4e5e18304e
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending approval
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/deploy Pipeline was successful
2025-10-26 11:59:39 +01:00
Compare
agx merged commit 4e5e18304e into main 2025-10-26 11:59:53 +01:00
agx deleted branch media-role 2025-10-26 11:59:54 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Phosh/phosh-site!38
No description provided.