Realtek HD Soundcard Cannot Play Back At Higher Than 48khz Sampling Rate under Linux
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Realtek HD Soundcard Cannot Play Back At Higher Than 48khz Sampling Rate under Linux
Hi. Have been struggling to force my Debian installation on Asus MiniPC to force the built-in soundcard with its full sampling rate potential, but I can't achieve it.
The soundcard is Realtek ALC255, and has sample rates up to 192khz.
When I play out audio, it allows me to set the sample rate at 192khz. See in the speaker test for example:
Code:
~$ speaker-test -c2 -r 192000
speaker-test 1.1.8
Playback device is default
Stream parameters are 192000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 192000Hz (requested 192000Hz)
Buffer size range from 96 to 1048576
Period size range from 32 to 349526
Using max buffer size 1048576
Periods = 4
was set period_size = 262144
was set buffer_size = 1048576
0 - Front Left
^C 1 - Front Right
Time per period = 2.750980
However, in reality it does not seem to play out at 192khz but at the maximum rate of the generic Intel soundcard driver: 48khz. As seen by this:
So it appears that under Linux, the RealTek driver is not truly used, but instead a different (generic?) driver jumps in? Is there any way to force Linux (I tested the same under Ubuntu, same result) to use a higher sampling rate than that of the Intel HD driver? Or is there a different reason for the "cap" on the sampling rate?
Btw, I tried forcing a higher rate in the alsa config settings, no luck either.
Looking forward to any advice you may have.
Best regards
Christo
Not sure which version of debian you are using, but Pulseaudio will automatically resample all your audio to a set frequency and bitrate. You can disable resampling of your audio streams by editing /etc/pulse/daemon.conf and adding or editing this line if it already exist.
Code:
avoid-resampling = true
You might also want to change your sample rate from 16-bit to 24-bit. You can do this by adding or editing the line too.
Code:
default-sample-format = s24le
After you make these changes and restart pulseaudio, I would download a high resolution music file from here to confirm that your sound is not being resampled by pulseaudio anymore http://www.2l.no/hires/index.html
Not sure which version of debian you are using, but Pulseaudio will automatically resample all your audio to a set frequency and bitrate. You can disable resampling of your audio streams by editing /etc/pulse/daemon.conf and adding or editing this line if it already exist.
Code:
avoid-resampling = true
You might also want to change your sample rate from 16-bit to 24-bit. You can do this by adding or editing the line too.
Code:
default-sample-format = s24le
After you make these changes and restart pulseaudio, I would download a high resolution music file from here to confirm that your sound is not being resampled by pulseaudio anymore http://www.2l.no/hires/index.html
Unfortunately, no luck after changing enabling the avoid-resampling. The hi-res files still play at 48khz.
I do think it's a (missing) driver issue.
The OS is Debian 10.
In case this is useful, here are is the dmesg output linked to sound/audio:
One last thing, not sure if it will help, but you can you post the output of "pulseaudio --dump-conf". This is definitely odd, if you are disabling pulseaudio and running pure alsa it shouldn't resample.
One last thing, not sure if it will help, but you can you post the output of "pulseaudio --dump-conf". This is definitely odd, if you are disabling pulseaudio and running pure alsa it shouldn't resample.
Ok if you look at that output pulseaudio still has resampling enabled
Code:
avoid-resampling = no
This was my mistake, the correct option in daemon.conf should be "avoid-resampling = yes" not true. However it looks like you set the default sample rate to "default-sample-rate = 192000" So all your sound should be resampled to that high rate. I would try changing true to yes in the daemon.conf file and changing "default-sample-format = s16le" to "default-sample-format = s24le" and see if that makes any difference. Just be sure that your audio file has a true 192000 mhz sample rate to test with, you can get a test flac from the link I posted above. Sorry I can't be more help, its just this is all I ever do to get my music from being resampled.
also if you download that hi res flac from above, after you start playing it in a terminal run
Ok if you look at that output pulseaudio still has resampling enabled
Code:
avoid-resampling = no
This was my mistake, the correct option in daemon.conf should be "avoid-resampling = yes" not true. However it looks like you set the default sample rate to "default-sample-rate = 192000" So all your sound should be resampled to that high rate. I would try changing true to yes in the daemon.conf file and changing "default-sample-format = s16le" to "default-sample-format = s24le" and see if that makes any difference. Just be sure that your audio file has a true 192000 mhz sample rate to test with, you can get a test flac from the link I posted above. Sorry I can't be more help, its just this is all I ever do to get my music from being resampled.
also if you download that hi res flac from above, after you start playing it in a terminal run
this will give you the information on sample rate and bitreate
Thanks - that's exactly how I check the actual sample rate. Whether or not I change the avoid-resampling to yes or no, it makes no difference. Generally, it's not a pulseaudio issue; the downsampling takes place at the alsa level.
I already tried this, with many different settings.
When I use a simple "fixed rate" setting such as this:
Code:
pcm.!default {
type hw
card 0
rate 192000
}
ctl.!default {
type hw
card 0
}
I can no longer play a 192khz file. Here's the output from aplay -v filename.wav:
Code:
cg@cg-PN40:~$ aplay -v test02.wav
Playing WAVE 'test02.wav' : Signed 16 bit Little Endian, Rate 192000 Hz, Stereo
aplay: set_params:1270: Broken configuration for this PCM: no configurations available
When I run aplay -v on the same file WITHOUT the asound.rc file, here is the output:
Note that this file was created using the same sound card, so the chip does permit 192khz (and in any case, the same soundcard does produce 192khz in playback under windows, so it's not a hardware limitation).
Quote:
please show the output of (you may need to install the package)
I am not sure how to read this, but I notice that while the default PCM has rates up to 192khz, the "Audio Output" nodes have rates of only 44.1 and 48 khz.
I have a different kernel to you but I am sure you will get my drift.
modinfo snd_sod did not enlighten me at all but this looks more useful
Code:
strings /lib/modules/5.4.0-4-amd64/kernel/sound/soc/sof/snd-sof.ko | grep DSP
error: failed to probe DSP %d
error: failed to init DSP trace/debug %d
error: failed to init DSP IPC %d
error: failed to load DSP firmware %d
error: failed to boot DSP firmware %d
error: failed to register DSP DAI driver %d
ipc: DSP is ready 0x%8.8x offset 0x%x
error: unknown DSP message 0x%x
error: failed to load DSP topology %d
error: failed to power down DSP during suspend %d
error: failed to power up DSP after resume
error: failed to load DSP firmware after resume %d
error: failed to boot DSP firmware after resume %d
error: debugfs entry cannot be read in DSP D3
error: DSP failed to add route sink %s control %s source %s result %d
error: DSP failed to add widget id %d type %d name : %s stream %s reply %d
error: DSP sent %zu bytes max is %d
error: DSP trace buffer overflow %u bytes. Total messages %d
error : DSP panic!
booting DSP firmware
error: failed to reset DSP
OK so they are options.....lets eliminate missing firmware
Code:
sudo dmesg | grep firmware
do not post all output....mine contains hits for APU/CPU and networking firmware.
We are interested in you show output for any firmware you do not recognise please. and I am guessing the firware appears here.....again I have not researched your setup
DSP is only one factor in the process...but for reasons I have not researched your device yet....you need snd_sof.
-f --format=FORMAT
Sample format
Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE
FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE
S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE
Some of these may not be available on selected hardware
The available format shortcuts are:
-f cd (16 bit little endian, 44100, stereo) [-f S16_LE -c2 -r44100]
-f cdr (16 bit big endian, 44100, stereo) [-f S16_BE -c2 -f44100]
-f dat (16 bit little endian, 48000, stereo) [-f S16_LE -c2 -r48000]
If no format is given U8 is used
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.