How to Modify Audio Bitrate in Fedora 40?

Hello Fedora community,

I’m rather new to Fedora 40. I would like to know how to customize my audio bitrate?

There is a discussion pertaining to this topic regarding Fedora 35, but my attempts to follow it got me nowhere. Any help regarding this is much appreciated.

-Thanks

Hello @deckerdoberman ,
Welcome to :fedora: !
Perhaps @ycollet may know your answer … so I am pinging him on it.

2 Likes

Added f40 and removed f35

To change, the bitrate and the sampling frequency, I use the following commands:

$ pw-metadata -n settings 0 clock force-quantum 256
$ pw-metadata -n settings 0 clock.force-rate 48000
2 Likes

I have this in notes:

mkdir -p ~/'.config/pipewire/pipewire.conf.d' && nano ~/'.config/pipewire/pipewire.conf.d/99-custom.conf'
context.properties = {
    default.clock.rate          = 192000
    default.clock.allowed-rates = [ 44100 48000 88200 96000 192000 ]
}

So this works, but gets reset to default after an update. Is there a permanent way to edit these settings?

I’m not sure if I’m doing this right, as I’m still stuck at 48000 hz.

I’ve entered the first line in the terminal. Then copied the context.properties section into the file and saved it. It looks exactly as you’ve written it.

I think if any app specifies its own output bitrate (like a game defaulting to 48000) that will get used if it’s a supported rate under default.clock.allowed-rates, even if it’s lower than the default.clock.rate.

I’m not sure how proper it is, but one idea is to remove any extra clocks you don’t want under allow-rates and only have the highest one as both the default rate and the only one under allowed-rates:

context.properties = {
    default.clock.rate          = 192000
    default.clock.allowed-rates = [ 192000 ]
}

I think any changes with that also need either WirePlumber or PipeWire restarted, or just a complete computer restart.

Why would you want to force up sampling?
Best is to play the content in its native bitrate.

I’m still in the progress to see if I can emulate the windows behaviour for playing media files. On Windows I would use AISO or WASAPI Exclusive to bypass the windows audio stack and output the signal from my media player 1:1 to my USB DAC. Have not figured out how to achieve this on Linux.

Yes it’s not a good idea. The example in the previous post will by definition not improve audio quality and may decrease quality depending on the circumstances. It will also increase overall latency and required processing power.

In general, for best audio quality you want to have as little processing and up/downsampling as possible, since resampling will in principle negatively affect quality. Fixing the output bitrate is generally not preferred for that reason because a lot of sources may be resampled unnecessarily. In most cases it’s best determined by the hardware which signals they accept for the best result. Higher is not better.