You are not logged in.

#1 2022-01-12 08:18:01

860lacov
Member
Registered: 2020-05-02
Posts: 285

How can I change audio bit depth in pipewire?

I have DAC that is able to handle 32bit/768kHz audio.
In audio settings I was able to change sample rate from 48000 Hz to 96000Hz.

I would like to test different bit depth settings, but I didn't see an appropriate option in pipewire config file. Is that even possible?

Offline

#2 2022-01-12 08:36:05

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 15,039

Re: How can I change audio bit depth in pipewire?

This depends on what you are actually playing and what bit sizes your actual audio has. There's little point to "providing more bits"  when your input audio comes from a CD which has 16bit/44kHz. Ideally sampling differences should also be imperceptible to you, so if you crank that up to 96kHz all your doing is adding load to your CPU because it has to resample an input signal that is potentially lower than that up to your target rate.

If you want to check at which actual sample rate/bit depth your input operates and with which actual sample rate/bit depth your DAC is operating on as a response you can look at the outputs of

pactl list sink-inputs
pactl list sinks

Last edited by V1del (2022-01-12 08:39:17)

Offline

#3 2022-01-12 08:48:24

860lacov
Member
Registered: 2020-05-02
Posts: 285

Re: How can I change audio bit depth in pipewire?

V1del wrote:

This depends on what you are actually playing and what bit sizes your actual audio has. There's little point to "providing more bits"  when your input audio comes from a CD which has 16bit/44kHz. Ideally sampling differences should also be imperceptible to you, so if you crank that up to 96kHz all your doing is adding load to your CPU because it has to resample an input signal that is potentially lower than that up to your target rate.

If you want to check at which actual sample rate/bit depth your input operates and with which actual sample rate/bit depth your DAC is operating on as a response you can look at the outputs of

pactl list sink-inputs
pactl list sinks

So the if  the source has 16 bit then 16 bit will be pushed to DAC? [and 24 bit accordingly?]

Currently, I use tidal from AUR. I thought that it is 24bit/96kHz but it seems that trough browser or aur application I can achieve only 16/44.1

I'm aware that probably I won't hear the difference (I don't even remember the fancy audiophile terms for sound description big_smile). I have a decent hardware for audio and I would like to test/play a little with it. That's all smile

I'll check rate and bit depth later. (don't have DAC near me)

Last edited by 860lacov (2022-01-12 08:52:01)

Offline

#4 2022-01-12 09:32:25

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 15,039

Re: How can I change audio bit depth in pipewire?

860lacov wrote:

So the if  the source has 16 bit then 16 bit will be pushed to DAC? [and 24 bit accordingly?]

That should be the general theory yes. Without anything playing and acquiring a file (ideally an uncompressed wav) that you know has the relevant properties you should be able to see a relevant change (playing with something that doesn't do internal resampling like pw-cat).

FWIW from https://gitlab.freedesktop.org/pipewire … n-pipewire unless explicitly configured by a client otherwise it will always use F32 internally. You could technically create additional node points set to something else.

Last edited by V1del (2022-01-12 09:35:00)

Offline

#5 2022-01-13 22:40:13

860lacov
Member
Registered: 2020-05-02
Posts: 285

Re: How can I change audio bit depth in pipewire?

pactl list sink-inputs gave me:

pactl list sink-inputs
Sink Input #73
	Driver: PipeWire
	Owner Module: n/a
	Client: 72
	Sink: 46
	Sample Specification: float32le 2ch 48000Hz
	Channel Map: front-left,front-right
	Format: pcm, format.sample_format = "\"float32le\""  format.rate = "48000"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Corked: no
	Mute: no
	Volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
	        balance 0,00
	Buffer Latency: 0 usec
	Sink Latency: 0 usec
	Resample method: PipeWire
	Properties:
		client.api = "pipewire-pulse"
		pulse.server.type = "unix"
		application.name = "Chromium"
		application.process.id = "2190"
		application.process.user = "jm"
		application.process.host = "spin"
		application.process.binary = "tidal-hifi"
		application.language = "pl_PL.UTF-8"
		window.x11.display = ":0"
		application.process.machine_id = "63f2eccaa9cf4b0099113cc4caf3920b"
		application.icon_name = "chromium-browser"
		media.name = "Playback"
		node.rate = "1/48000"
		stream.is-live = "true"
		node.name = "Chromium"
		node.autoconnect = "true"
		media.class = "Stream/Output/Audio"
		adapt.follower.node = ""
		object.register = "false"
		factory.id = "6"
		audio.adapt.follower = ""
		factory.mode = "split"
		library.name = "audioconvert/libspa-audioconvert"
		client.id = "72"
		object.id = "73"
		object.serial = "71"
		node.latency = "1024/48000"
		pulse.attr.maxlength = "4194304"
		pulse.attr.tlength = "16384"
		pulse.attr.prebuf = "12296"
		pulse.attr.minreq = "4096"
		module-stream-restore.id = "sink-input-by-application-name:Chromium"

and pactl list sinks

Sink #43
	State: SUSPENDED
	Name: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink
	Description: Tiger Lake-LP Smart Sound Technology Audio Controller HDMI / DisplayPort 3 Output
	Driver: PipeWire
	Sample Specification: s24-32le 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: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "0"
		alsa.card_name = "sof-hda-dsp"
		alsa.class = "generic"
		alsa.device = "5"
		alsa.driver_name = "snd_soc_skl_hda_dsp"
		alsa.id = "HDMI3 (*)"
		alsa.long_card_name = "TGL-SpinSP513_55N-V1.16-Milgauss_TL"
		alsa.mixer_device = "_ucm0001.hw:sofhdadsp"
		alsa.name = ""
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "TGL-SpinSP513_55N-V1.16-Milgauss_TL"
		api.alsa.card.name = "sof-hda-dsp"
		api.alsa.open.ucm = "true"
		api.alsa.path = "hw:sofhdadsp,5"
		api.alsa.pcm.card = "0"
		api.alsa.pcm.stream = "playback"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "0"
		device.api = "alsa"
		device.class = "sound"
		device.id = "40"
		device.profile.description = "HDMI / DisplayPort 3 Output"
		device.profile.name = "HiFi: hw:sofhdadsp,5: sink"
		device.routes = "1"
		factory.name = "api.alsa.pcm.sink"
		media.class = "Audio/Sink"
		device.description = "Tiger Lake-LP Smart Sound Technology Audio Controller HDMI / DisplayPort 3 Output"
		node.name = "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink"
		node.nick = "sof-hda-dsp"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:0:hw:sofhdadsp,5:playback"
		priority.driver = "664"
		priority.session = "664"
		session.suspend-timeout-seconds = "0"
		factory.id = "18"
		client.id = "32"
		node.driver = "true"
		factory.mode = "merge"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "43"
		object.serial = "40"
	Ports:
		[Out] HDMI3: HDMI / DisplayPort 3 Output (type: HDMI, priority: 700, availability group: HDMI/DP,pcm=5, not available)
	Active Port: [Out] HDMI3
	Formats:
		pcm

Sink #44
	State: SUSPENDED
	Name: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_4__sink
	Description: Tiger Lake-LP Smart Sound Technology Audio Controller HDMI / DisplayPort 2 Output
	Driver: PipeWire
	Sample Specification: s24-32le 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: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_4__sink.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "0"
		alsa.card_name = "sof-hda-dsp"
		alsa.class = "generic"
		alsa.device = "4"
		alsa.driver_name = "snd_soc_skl_hda_dsp"
		alsa.id = "HDMI2 (*)"
		alsa.long_card_name = "TGL-SpinSP513_55N-V1.16-Milgauss_TL"
		alsa.mixer_device = "_ucm0001.hw:sofhdadsp"
		alsa.name = ""
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "TGL-SpinSP513_55N-V1.16-Milgauss_TL"
		api.alsa.card.name = "sof-hda-dsp"
		api.alsa.open.ucm = "true"
		api.alsa.path = "hw:sofhdadsp,4"
		api.alsa.pcm.card = "0"
		api.alsa.pcm.stream = "playback"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "1"
		device.api = "alsa"
		device.class = "sound"
		device.id = "40"
		device.profile.description = "HDMI / DisplayPort 2 Output"
		device.profile.name = "HiFi: hw:sofhdadsp,4: sink"
		device.routes = "1"
		factory.name = "api.alsa.pcm.sink"
		media.class = "Audio/Sink"
		device.description = "Tiger Lake-LP Smart Sound Technology Audio Controller HDMI / DisplayPort 2 Output"
		node.name = "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_4__sink"
		node.nick = "sof-hda-dsp"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:0:hw:sofhdadsp,4:playback"
		priority.driver = "680"
		priority.session = "680"
		session.suspend-timeout-seconds = "0"
		factory.id = "18"
		client.id = "32"
		node.driver = "true"
		factory.mode = "merge"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "44"
		object.serial = "41"
	Ports:
		[Out] HDMI2: HDMI / DisplayPort 2 Output (type: HDMI, priority: 600, availability group: HDMI/DP,pcm=4, not available)
	Active Port: [Out] HDMI2
	Formats:
		pcm

Sink #45
	State: SUSPENDED
	Name: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink
	Description: Tiger Lake-LP Smart Sound Technology Audio Controller HDMI / DisplayPort 1 Output
	Driver: PipeWire
	Sample Specification: s24-32le 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: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "0"
		alsa.card_name = "sof-hda-dsp"
		alsa.class = "generic"
		alsa.device = "3"
		alsa.driver_name = "snd_soc_skl_hda_dsp"
		alsa.id = "HDMI1 (*)"
		alsa.long_card_name = "TGL-SpinSP513_55N-V1.16-Milgauss_TL"
		alsa.mixer_device = "_ucm0001.hw:sofhdadsp"
		alsa.name = ""
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "TGL-SpinSP513_55N-V1.16-Milgauss_TL"
		api.alsa.card.name = "sof-hda-dsp"
		api.alsa.open.ucm = "true"
		api.alsa.path = "hw:sofhdadsp,3"
		api.alsa.pcm.card = "0"
		api.alsa.pcm.stream = "playback"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "2"
		device.api = "alsa"
		device.class = "sound"
		device.id = "40"
		device.profile.description = "HDMI / DisplayPort 1 Output"
		device.profile.name = "HiFi: hw:sofhdadsp,3: sink"
		device.routes = "1"
		factory.name = "api.alsa.pcm.sink"
		media.class = "Audio/Sink"
		device.description = "Tiger Lake-LP Smart Sound Technology Audio Controller HDMI / DisplayPort 1 Output"
		node.name = "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink"
		node.nick = "sof-hda-dsp"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:0:hw:sofhdadsp,3:playback"
		priority.driver = "696"
		priority.session = "696"
		session.suspend-timeout-seconds = "0"
		factory.id = "18"
		client.id = "32"
		node.driver = "true"
		factory.mode = "merge"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "45"
		object.serial = "42"
	Ports:
		[Out] HDMI1: HDMI / DisplayPort 1 Output (type: HDMI, priority: 500, availability group: HDMI/DP,pcm=3, not available)
	Active Port: [Out] HDMI1
	Formats:
		pcm

Sink #46
	State: RUNNING
	Name: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink
	Description: Tiger Lake-LP Smart Sound Technology Audio Controller Speaker + Headphones
	Driver: PipeWire
	Sample Specification: s24-32le 2ch 48000Hz
	Channel Map: front-left,front-right
	Owner Module: 4294967295
	Mute: no
	Volume: front-left: 19660 /  30% / -31,37 dB,   front-right: 19660 /  30% / -31,37 dB
	        balance 0,00
	Base Volume: 65536 / 100% / 0,00 dB
	Monitor Source: alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "0"
		alsa.card_name = "sof-hda-dsp"
		alsa.class = "generic"
		alsa.device = "0"
		alsa.driver_name = "snd_soc_skl_hda_dsp"
		alsa.id = "HDA Analog (*)"
		alsa.long_card_name = "TGL-SpinSP513_55N-V1.16-Milgauss_TL"
		alsa.mixer_device = "_ucm0001.hw:sofhdadsp"
		alsa.name = ""
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "TGL-SpinSP513_55N-V1.16-Milgauss_TL"
		api.alsa.card.name = "sof-hda-dsp"
		api.alsa.open.ucm = "true"
		api.alsa.path = "hw:sofhdadsp"
		api.alsa.pcm.card = "0"
		api.alsa.pcm.stream = "playback"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "3"
		device.api = "alsa"
		device.class = "sound"
		device.id = "40"
		device.profile.description = "Speaker + Headphones"
		device.profile.name = "HiFi: hw:sofhdadsp: sink"
		device.routes = "2"
		factory.name = "api.alsa.pcm.sink"
		media.class = "Audio/Sink"
		device.description = "Tiger Lake-LP Smart Sound Technology Audio Controller Speaker + Headphones"
		node.name = "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink"
		node.nick = "sof-hda-dsp"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:0:hw:sofhdadsp:playback"
		priority.driver = "1000"
		priority.session = "1000"
		session.suspend-timeout-seconds = "0"
		factory.id = "18"
		client.id = "32"
		node.driver = "true"
		factory.mode = "merge"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "46"
		object.serial = "43"
		node.max-latency = "2048/48000"
	Ports:
		[Out] Speaker: Speaker (type: Speaker, priority: 100, availability unknown)
		[Out] Headphones: Headphones (type: Headphones, priority: 200, availability group: Headphone, not available)
	Active Port: [Out] Speaker
	Formats:
		pcm

Is this:
    Format: pcm, format.sample_format = "\"float32le\""  format.rate = "48000"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
The line I'm looking for ?

Last edited by 860lacov (2022-01-13 22:40:39)

Offline

#6 2022-01-14 03:53:39

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 15,039

Re: How can I change audio bit depth in pipewire?

those are the lines yes.

Offline

#7 2022-01-17 21:46:13

860lacov
Member
Registered: 2020-05-02
Posts: 285

Re: How can I change audio bit depth in pipewire?

Not sure if this is a material for new topic.
Is there a way to set pipewire to switch audio frequency automatically?
If an input is 44100 than set output in real time to 44100, and if 48000 than to 48000.

To avoid resampling.

Offline

#8 2022-01-17 22:04:03

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,228

Re: How can I change audio bit depth in pipewire?

860lacov wrote:

Not sure if this is a material for new topic.
Is there a way to set pipewire to switch audio frequency automatically?
If an input is 44100 than set output in real time to 44100, and if 48000 than to 48000.

To avoid resampling.

https://wiki.archlinux.org/title/PipeWi … ample_rate


Help me to improve ssh-rdp !

Offline

#9 2022-01-18 21:52:38

860lacov
Member
Registered: 2020-05-02
Posts: 285

Re: How can I change audio bit depth in pipewire?

kokoko3k wrote:
860lacov wrote:

Not sure if this is a material for new topic.
Is there a way to set pipewire to switch audio frequency automatically?
If an input is 44100 than set output in real time to 44100, and if 48000 than to 48000.

To avoid resampling.

https://wiki.archlinux.org/title/PipeWi … ample_rate

Thanks.
I already did that, but I just didn't notice because I checked this through the Bluetooth.
For USB DAC it works flawlessly.

I tried to find similar settings for Bluetooth. No luck.

I use wireplumber.
In:
/etc/wireplumber/bluetooth.lua.d/50-bluez-config.lua

I can change LDAC encoding quality

-- LDAC encoding quality
      -- Available values: auto (Adaptive Bitrate, default)
      --                   hq   (High Quality, 990/909kbps)
      --                   sq   (Standard Quality, 660/606kbps)
      --                   mq   (Mobile use Quality, 330/303kbps)
      ["bluez5.a2dp.ldac.quality"] = "hq",

and

-- Properties for the A2DP codec configuration
  ["bluez5.default.rate"] = 96000,
  --["bluez5.default.channels"] = 2,

I tried to change A2DP to:

-- Properties for the A2DP codec configuration
  ["bluez5.default.rate"] = 96000,
  ["default.clock.allowed-rates"] = ["48000 44100 96000"],
  --["bluez5.default.channels"] = 2,

But after that, Bluetooth stopped working.
I tried with and without [] or ""

Could you help me with this?

Last edited by 860lacov (2022-01-18 21:54:25)

Offline

#10 2022-01-19 08:50:06

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 15,039

Re: How can I change audio bit depth in pipewire?

I doubt you can change much here, bluetooth in general is pretty hard-coded on what and how it allows things. You generally don't have much leeway when interference prone wireless protocols are involved. You usually have a single target that has to be supported appropriately that all parties agree on. You don't have the bandwith to randomly start pumping out non specific higher sample rates.  If you want  audio representation doing anything wireless is going to have some restrictions one way or another "Bit-perfect" isn't going to work here.

Read, in the bluetooth case the default sample rate needs to be agreed "on connect" and can't be manipulated afterwards, which is why it doesn't really make sense to have/configure multiple here.

Last edited by V1del (2022-01-19 09:12:14)

Offline

Board footer

Powered by FluxBB