You are not logged in.

#1 2024-06-11 17:23:24

Wild Penguin
Member
Registered: 2015-03-19
Posts: 388

Pulseaudio over network always resamples non-48kHz content

Hi!

I got two computers on a network, both use pipewire.

I've set up both computers so that they will NOT RESAMPLE if the audio device can play back at the correct sample rate. This works on both computers if playing audio locally (as seen by pactl, /proc/asound/card?/pcm1p/sub0/hw_params, and my DAC which reports the mixing rate).

I've set up sharing audio devices via my LAN as per https://wiki.archlinux.org/title/PipeWire (pipewire does not / can not share audio devices, at least according to this wiki page).

Whenever I play 44.1kHz content (which 99% of my content is), it will be resampled to 48kHz. This can cause artifacts and uses unnecessary CPU cycles on the client, and, is totally unnecessary.

If I play a local 44.1kHz audio on the sharing computer, it's audio device will be set to 44.1kHz, and the remote will also play back in 44.1kHz. But as soon as the sharing computer stops play back, after a few seconds (maybe ~5) the audio path re-initializes to 48kHz!!!.

As reported by pactl list sinks:

Sink #99
        State: SUSPENDED
        Name: tunnel.archnuke.local.alsa_output.pci-0000_00_1f.3.hdmi-stereo
        Description: Sisäinen äänentoisto Digitaalinen stereo (HDMI) on kodi@archnuke
        Driver: PipeWire
        Sample Specification: s32le 2ch 48000Hz
        Channel Map: front-left,front-right
        Owner Module: 4294967295
        Mute: no
        Volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
                balance 0,00
        Base Volume: 65536 / 100% / 0,00 dB
        Monitor Source: tunnel.archnuke.local.alsa_output.pci-0000_00_1f.3.hdmi-stereo.monitor
        Latency: 0 usec, configured 0 usec
        Flags: NETWORK DECIBEL_VOLUME LATENCY 
        Properties:
                audio.format = "S32LE"
                audio.rate = "48000"
                audio.channels = "2"
                audio.position = "[FL,FR]"
                node.name = "tunnel.archnuke.local.alsa_output.pci-0000_00_1f.3.hdmi-stereo"
                device.description = "Sisäinen äänentoisto Digitaalinen stereo (HDMI) on kodi@archnuke"
                node.virtual = "true"
                node.network = "true"
                media.class = "Audio/Sink"
                media.name = "pulse"
                stream.is-live = "true"
                node.want-driver = "true"
                node.autoconnect = "true"
                adapt.follower.spa-node = ""
                object.register = "false"
                factory.id = "6"
                clock.quantum-limit = "8192"
                factory.mode = "merge"
                audio.adapt.follower = ""
                library.name = "audioconvert/libspa-audioconvert"
                client.id = "79"
                object.id = "78"
                object.serial = "99"
        Formats:
                pcm

We can see the network sink reports audio.rate as 48kHz, which clients will be adamant to adhere to, although it can accept 44.1kHz.

Now, any ideas, where / how to configure sharing so that it will not advertise itself as 48kHz? Optimal would be if the clients will just choose the mixing rate as per the content they are currently playing, unless the audio device is reserved in which case the last-in stream will be resampled (this is how it works locally).

Is this a bug/oversight in PipeWire (-PulseAudio layer)?

Cheers!

Offline

#2 2024-06-11 17:26:56

Wild Penguin
Member
Registered: 2015-03-19
Posts: 388

Re: Pulseaudio over network always resamples non-48kHz content

Hi,

I noticed that if I "force" the output on the sharing device to 44.1kHz by playing something locally (like silence), the clients on the remote still play back in 48kHz. So that workaround does not work, as now there is resampling both on the client (44.1kHz -> 48kHz) and the server (48kHz -> 41kHz).

Offline

Board footer

Powered by FluxBB