You are not logged in.

#1 2025-03-17 15:04:57

fywrite
Member
Registered: 2025-03-17
Posts: 2

[Solved] Pipewire change default bit depth

I want to be able to set my audio driver bit depth to 24 bits.

As i understand my audio hardware supports 16 20 24 32 bits.  When i monitor with pw-top command always report:
S32LE 2 44100 alsa_output.pci-0000_00_1b.0.analog-stereo and cat /proc/asound/card1/pcm0p/sub0/hw_params  S32_LE too.         
What is the correct way to set it up for S24_LE audio format?

I share the required information below:
My main configuration is monitor.alsa.rules and expecting respect what i change in it and see cat /proc/asound/card1/pcm0p/sub0/hw_params S24_LE as a output.

Solution:
I solved the issue after some research. My config was right but my hardware especially with alsa only supports two audio formats. Pipewire does not give me error about audio format either its supported or not. What i did is to play sound with aplay (alsa-utils) with the alsa path of my audio hardware. The output says my hardware actually support two audio format i confirm S16_LE and S32_LE work with monitor.alsa.rules in wireplumber configuration.

$ aplay -D hw:1 --dump-hw-params ~/Music/audiofilename.flac
HW Params of device "hw:1":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S16_LE S32_LE
SUBFORMAT:  STD MSBITS_MAX
SAMPLE_BITS: [16 32]
FRAME_BITS: [32 128]
CHANNELS: [2 4]
RATE: [32000 192000]
PERIOD_TIME: (41 16384000]
PERIOD_SIZE: [8 524288]
PERIOD_BYTES: [128 2097152]
PERIODS: [2 32]
BUFFER_TIME: (83 32768000]
BUFFER_SIZE: [16 1048576]
BUFFER_BYTES: [128 4194304]
TICK_TIME: ALL
--------------------
aplay: set_params:1387: Sample format non available
Available formats:
- S16_LE
- S32_LE
 
$ uname -r
6.13.7-arch1-1
$ pacman -Qe
alsa-utils 1.2.13-2
base 3-2
brightnessctl 0.5.1-3
btrfs-progs 6.13-1
efibootmgr 18-3
flatpak 1:1.16.0-1
foot 1.20.2-1
gnu-free-fonts 20120503-8
grub 2:2.12.r226.g56ccc5ed-1
htop 3.4.0-1
intel-media-driver 25.1.3-1
intel-ucode 20250211-1
iwd 3.4-1
linux 6.13.7.arch1-1
linux-firmware 20250311.b69d4b74-2
man-db 2.13.0-1
mesa 1:25.0.1-2
nano 8.3-1
pipewire 1:1.4.1-1
pipewire-alsa 1:1.4.1-1
pipewire-audio 1:1.4.1-1
pipewire-docs 1:1.4.1-1
pipewire-pulse 1:1.4.1-1
polkit 126-2
polkit-gnome 0.105-11
sof-firmware 2025.01-1
sudo 1.9.16.p2-2
sway 1:1.10.1-2
swaybg 1.2.1-1
swayidle 1.8.0-2
swaylock 1.8.0-1
tuned 2.25.1-1
tuned-ppd 2.25.1-1
unzip 6.0-22
vulkan-intel 1:25.0.1-2
wireplumber 0.5.8-1
wmenu 0.1.9-1
xdg-desktop-portal-gtk 1.15.2-1
xdg-desktop-portal-wlr 0.7.1-1
xdg-user-dirs 0.18-2
zram-generator 1.2.1-1
$ wpctl status
PipeWire 'pipewire-0' [1.4.1, fywrite@archlinux, cookie:3644433263]
 └─ Clients:
        34. WirePlumber                         [1.4.1, fywrite@archlinux, pid:617]
        35. pipewire                            [1.4.1, fywrite@archlinux, pid:616]
        36. pipewire                            [1.4.1, fywrite@archlinux, pid:618]
        37. pipewire                            [1.4.1, fywrite@archlinux, pid:616]
        47. WirePlumber [export]                [1.4.1, fywrite@archlinux, pid:617]
        72. xdg-desktop-portal                  [1.4.1, fywrite@archlinux, pid:1308]
        73. xdg-desktop-portal-wlr              [1.4.1, fywrite@archlinux, pid:1322]
        74. LibreWolf                           [1.4.1, fywrite@archlinux, pid:2]
        80. wpctl                               [1.4.1, fywrite@archlinux, pid:5932]

Audio
 ├─ Devices:
 │      52. Built-in Audio                      [alsa]
 │      53. Built-in Audio                      [alsa]
 │  
 ├─ Sinks:
 │  *   60. Built-in Audio Analog Stereo        [vol: 0.31]
 │  
 ├─ Sources:
 │  *   61. Built-in Audio Analog Stereo        [vol: 1.00]
 │  
 ├─ Filters:
 │    - filter-chain-616-30                                         
 │      38. Parametric EQ input                                          [Audio/Sink]
 │      39. Parametric EQ output                                         [Stream/Output/Audio]
 │  
 └─ Streams:
        75. LibreWolf                                                   
             78. output_FR       > CS4208 Analog:playback_FR	[active]
             79. output_FL       > CS4208 Analog:playback_FL	[active]

Video
 ├─ Devices:
 │  
 ├─ Sinks:
 │  
 ├─ Sources:
 │  
 ├─ Filters:
 │  
 └─ Streams:

Settings
 └─ Default Configured Devices:
         0. Audio/Sink    alsa_output.pci-0000_00_1b.0.analog-stereo
$ wpctl inspect 60
id 60, type PipeWire:Interface:Node
    alsa.card = "1"
    alsa.card_name = "HDA Intel PCH"
    alsa.class = "generic"
    alsa.components = "HDA:10134208,106b7b00,00100300"
    alsa.device = "0"
    alsa.driver_name = "snd_hda_intel"
    alsa.id = "CS4208 Analog"
    alsa.long_card_name = "HDA Intel PCH at 0xc1814000 irq 77"
    alsa.mixer_name = "Cirrus Logic CS4208"
    alsa.name = "CS4208 Analog"
    alsa.resolution_bits = "24"
    alsa.subclass = "generic-mix"
    alsa.subdevice = "0"
    alsa.subdevice_name = "subdevice #0"
    alsa.sync.id = "00000000:00000000:00000000:00000000"
    api.alsa.card.longname = "HDA Intel PCH at 0xc1814000 irq 77"
    api.alsa.card.name = "HDA Intel PCH"
    api.alsa.path = "front:1"
    api.alsa.pcm.card = "1"
    api.alsa.pcm.stream = "playback"
    audio.channels = "2"
    audio.format = "S24_LE"
    audio.position = "FL,FR"
    card.profile.device = "4"
  * client.id = "47"
    clock.quantum-limit = "8192"
    device.api = "alsa"
    device.class = "sound"
    device.icon-name = "audio-card-analog"
  * device.id = "53"
    device.profile.description = "Analog Stereo"
    device.profile.name = "analog-stereo"
    device.routes = "2"
  * factory.id = "19"
    factory.name = "api.alsa.pcm.sink"
    library.name = "audioconvert/libspa-audioconvert"
  * media.class = "Audio/Sink"
  * node.description = "Built-in Audio Analog Stereo"
    node.driver = "true"
    node.loop.name = "data-loop.0"
  * node.name = "alsa_output.pci-0000_00_1b.0.analog-stereo"
  * node.nick = "CS4208 Analog"
    node.pause-on-idle = "false"
  * object.path = "alsa:acp:PCH:4:playback"
  * object.serial = "60"
    port.group = "playback"
  * priority.driver = "1009"
  * priority.session = "1009"
$ cat .config/wireplumber/wireplumber.conf.d/90-alsa.conf
monitor.alsa.rules = [
  {
    matches = [
      {
        node.name = "alsa_output.pci-0000_00_1b.0.analog-stereo"
      }
    ]
    actions = {
      update-props = {
        alsa.resolution_bits = "24"
        audio.format = "S24_LE"
      }
    }
  }
]
$ cat .config/pipewire/pipewire.conf.d/90-sample-rates.conf
context.properties = {
    default.clock.rate          = 48000
    default.clock.allowed-rates = [ 32000 44100 48000 88200 96000 176400 192000 ]
}
$ systemctl --user status pipewire.service
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: active (running) since Mon 2025-03-17 17:05:51 +03; 17s ago
 Invocation: 4a328c20f0f5492b8900d7ba71683549
TriggeredBy: ● pipewire.socket
   Main PID: 612 (pipewire)
      Tasks: 3 (limit: 8930)
     Memory: 16.6M (peak: 16.8M)
        CPU: 58ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─612 /usr/bin/pipewire

Mar 17 17:05:51 archlinux systemd[601]: Started PipeWire Multimedia Service.
[fywrite@archlinux ~]$ systemctl --user status pipewire-pulse.service
● pipewire-pulse.service - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.service; enabled; preset: enabled)
     Active: active (running) since Mon 2025-03-17 17:05:51 +03; 29s ago
 Invocation: 2f5e3235a5cc477c9fe58ee67de5e53d
TriggeredBy: ● pipewire-pulse.socket
   Main PID: 614 (pipewire-pulse)
      Tasks: 3 (limit: 8930)
     Memory: 2.1M (peak: 2.5M)
        CPU: 30ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire-pulse.service
             └─614 /usr/bin/pipewire-pulse

Mar 17 17:05:51 archlinux systemd[601]: Started PipeWire PulseAudio.
[fywrite@archlinux ~]$ systemctl --user status pipewire-pulse.socket
● pipewire-pulse.socket - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.socket; enabled; preset: enabled)
     Active: active (running) since Mon 2025-03-17 17:05:51 +03; 33s ago
 Invocation: 772ede6f299a49058d8a57dfe5a879dd
   Triggers: ● pipewire-pulse.service
     Listen: /run/user/1000/pulse/native (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pipewire-pulse.socket

Mar 17 17:05:51 archlinux systemd[601]: Listening on PipeWire PulseAudio.
[fywrite@archlinux ~]$ systemctl --user status wireplumber.service
● wireplumber.service - Multimedia Service Session Manager
     Loaded: loaded (/usr/lib/systemd/user/wireplumber.service; enabled; preset: enabled)
     Active: active (running) since Mon 2025-03-17 17:05:51 +03; 51s ago
 Invocation: 62a0d62d773449a1a1956ec5ead4532b
   Main PID: 613 (wireplumber)
      Tasks: 6 (limit: 8930)
     Memory: 12.7M (peak: 14.7M)
        CPU: 231ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/wireplumber.service
             └─613 /usr/bin/wireplumber

Mar 17 17:05:51 archlinux systemd[601]: Started Multimedia Service Session Manager.
Mar 17 17:05:51 archlinux wireplumber[613]: wp-internal-comp-loader: Loading profile 'main'
Mar 17 17:05:52 archlinux wireplumber[613]: default: Failed to get percentage from UPower: org.freedesktop.DBus.Error.NameHasNoOwner
Mar 17 17:05:52 archlinux wireplumber[613]: spa.bluez5: BlueZ system service is not available
Mar 17 17:05:52 archlinux wireplumber[613]: wp-device: SPA handle 'api.libcamera.enum.manager' could not be loaded; is it installed?
Mar 17 17:05:52 archlinux wireplumber[613]: s-monitors-libcamera: PipeWire's libcamera SPA plugin is missing or broken. Some camera types may not be supported.
$ systemctl --user --type=service --state=running
  UNIT                                         LOAD   ACTIVE SUB     DESCRIPTION                                 
  at-spi-dbus-bus.service                      loaded active running Accessibility services bus
  dbus-:1.14-org.a11y.atspi.Registry@0.service loaded active running dbus-:1.14-org.a11y.atspi.Registry@0.service
  dbus-broker.service                          loaded active running D-Bus User Message Bus
  flatpak-session-helper.service               loaded active running flatpak session helper
  pipewire-pulse.service                       loaded active running PipeWire PulseAudio
  pipewire.service                             loaded active running PipeWire Multimedia Service
  wireplumber.service                          loaded active running Multimedia Service Session Manager
  xdg-desktop-portal-gtk.service               loaded active running Portal service (GTK/GNOME implementation)
  xdg-desktop-portal-wlr.service               loaded active running Portal service (wlroots implementation)
  xdg-desktop-portal.service                   loaded active running Portal service
  xdg-document-portal.service                  loaded active running flatpak document portal service
  xdg-permission-store.service                 loaded active running sandboxed app permission store

Legend: LOAD   → Reflects whether the unit definition was properly loaded.
        ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
        SUB    → The low-level unit activation state, values depend on unit type.

12 loaded units listed.
$ systemctl --type=service --state=running
  UNIT                     LOAD   ACTIVE SUB     DESCRIPTION                                   
  dbus-broker.service      loaded active running D-Bus System Message Bus
  getty@tty1.service       loaded active running Getty on tty1
  iwd.service              loaded active running Wireless service
  polkit.service           loaded active running Authorization Manager
  rtkit-daemon.service     loaded active running RealtimeKit Scheduling Policy Service
  systemd-journald.service loaded active running Journal Service
  systemd-logind.service   loaded active running User Login Management
  systemd-resolved.service loaded active running Network Name Resolution
  systemd-udevd.service    loaded active running Rule-based Manager for Device Events and Files
  systemd-userdbd.service  loaded active running User Database Manager
  tuned-ppd.service        loaded active running PPD-to-TuneD API Translation Daemon
  tuned.service            loaded active running Dynamic System Tuning Daemon
  user@1000.service        loaded active running User Manager for UID 1000

Legend: LOAD   → Reflects whether the unit definition was properly loaded.
        ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
        SUB    → The low-level unit activation state, values depend on unit type.

13 loaded units listed.
$ cat /proc/asound/card1/codec#0
Node 0x02 [Audio Output] wcaps 0xd043d: Stereo Amp-Out Stripe
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x7f, nsteps=0x7f, stepsize=0x01, mute=1
  Amp-Out vals:  [0x00 0x00]
  Converter: stream=5, channel=0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1e]: 16 20 24 32
    formats [0x3]: PCM FLOAT
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Delay: 13 samples
Node 0x03 [Audio Output] wcaps 0xd043d: Stereo Amp-Out Stripe
  Control: name="Speaker Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="CS4208 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x7f, nsteps=0x7f, stepsize=0x01, mute=1
  Amp-Out vals:  [0x43 0x43]
  Converter: stream=5, channel=0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1e]: 16 20 24 32
    formats [0x3]: PCM FLOAT
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Delay: 13 samples
$ grep -E 'Codec|Audio Output|rates' /proc/asound/card*/codec#*
/proc/asound/card0/codec#0:Codec: Intel Broadwell HDMI
/proc/asound/card0/codec#0:    rates [0x0]:
/proc/asound/card0/codec#0:Node 0x02 [Audio Output] wcaps 0x6611: 8-Channels Digital
/proc/asound/card0/codec#0:    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
/proc/asound/card0/codec#0:Node 0x03 [Audio Output] wcaps 0x6611: 8-Channels Digital
/proc/asound/card0/codec#0:    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
/proc/asound/card0/codec#0:Node 0x04 [Audio Output] wcaps 0x6611: 8-Channels Digital
/proc/asound/card0/codec#0:    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
/proc/asound/card1/codec#0:Codec: Cirrus Logic CS4208
/proc/asound/card1/codec#0:    rates [0x0]:
/proc/asound/card1/codec#0:Node 0x02 [Audio Output] wcaps 0xd043d: Stereo Amp-Out Stripe
/proc/asound/card1/codec#0:    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
/proc/asound/card1/codec#0:Node 0x03 [Audio Output] wcaps 0xd043d: Stereo Amp-Out Stripe
/proc/asound/card1/codec#0:    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
/proc/asound/card1/codec#0:Node 0x04 [Audio Output] wcaps 0xd043d: Stereo Amp-Out Stripe
/proc/asound/card1/codec#0:    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
/proc/asound/card1/codec#0:Node 0x05 [Audio Output] wcaps 0xd043d: Stereo Amp-Out Stripe
/proc/asound/card1/codec#0:    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
/proc/asound/card1/codec#0:    rates [0x1f5]: 8000 16000 32000 44100 48000 88200 96000
/proc/asound/card1/codec#0:    rates [0x1f5]: 8000 16000 32000 44100 48000 88200 96000
/proc/asound/card1/codec#0:    rates [0x1f5]: 8000 16000 32000 44100 48000 88200 96000
/proc/asound/card1/codec#0:    rates [0x1f5]: 8000 16000 32000 44100 48000 88200 96000
/proc/asound/card1/codec#0:Node 0x0a [Audio Output] wcaps 0x46631: 8-Channels Digital Stripe
/proc/asound/card1/codec#0:    rates [0x60]: 44100 48000
/proc/asound/card1/codec#0:Node 0x0b [Audio Output] wcaps 0x46631: 8-Channels Digital Stripe
/proc/asound/card1/codec#0:    rates [0x60]: 44100 48000
/proc/asound/card1/codec#0:    rates [0x60]: 44100 48000
/proc/asound/card1/codec#0:    rates [0x60]: 44100 48000
/proc/asound/card1/codec#0:Node 0x0e [Audio Output] wcaps 0x40631: Stereo Digital Stripe
/proc/asound/card1/codec#0:    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
/proc/asound/card1/codec#0:    rates [0x5f0]: 32000 44100 48000 88200 96000 192000
$ cat /proc/asound/card1/pcm0p/sub0/hw_params 
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 1024
buffer_size: 32768

Last edited by fywrite (2025-03-18 20:54:00)

Offline

Board footer

Powered by FluxBB