PulseAudio: How to determine native sample rates and bit depths, supported by hardware?
5,210
Solution 1
It seems like those information could be queried with grep
as follows:
grep rates /proc/asound/card0/codec\#0
grep bits /proc/asound/card0/codec\#0
# or in one-line with '-P'
grep -P 'rates|bits' /proc/asound/card0/codec\#0
Please note that \
is used to escape #
.
Actual file name is codec#0
.
Above commands will show you something like below:
$ grep -P 'rates|bits' /proc/asound/card0/codec\#0
rates [0x0]:
bits [0x0]:
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0xe]: 16 20 24
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0xe]: 16 20 24
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0xe]: 16 20 24
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0xe]: 16 20 24
Although the result looks correct, but actually I'm not sure whether it's a correct way to query.
Solution 2
According to Wikipedia article, Intel HDA has sample rates of 6–192 kHz and sample resolutions of 8–32 bits, though manufacturers may have not implemented the full specification, so it is good idea to test using
pactl list sinks | grep -Ei 'name:|sample specification:'
after changing the configuration.
Related videos on Youtube
Author by
shitpoet
Updated on September 18, 2022Comments
-
shitpoet over 1 year
I want to set maximum sampling rate and bit depth supported by my hardware (Intel HDA).
How to know the values?
I need this information because I want to avoid unnecessary resampling.
-
shitpoet about 4 yearsCan you please provide any additional information or links to prove that these parameters are truly supported by hardware and aren't just software compatibility modes of audio subsystem or audio drier? The output of commands you provided seems to be correct, but I am just not completely sure.
-
yuttie about 4 years@shitpoet Unfortunately, I don't have any rationale for the answer. It's just found by exploring
/proc
directory. I hope someone else would add information supporting the use of/proc/asound/card?/codec#?
. -
Nickolai Leschov about 3 yearsWhat if the sound card in question doesn't have the codec#0 file? On my system there are 4 sound cards: two do have the file and two don't (including the one I want to play music through, the E-MU Tracker Pre USB, card2 of 3). I poked around with mc and there's no similarly named file in the 'card2' or 'card3' directories.