You are not logged in.
Pages: 1
1. Make fftrate the default ALSA resampler
$ cat ~/.asoundrc
defaults.pcm.rate_converter "fftrate"$ file 'rudra veena and pakhawaj.flac'
rudra veena and pakhawaj.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 49123284 samples$ file audio_test_48kHz_16bit.wav
audio_test_48kHz_16bit.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 48000 Hz2. Run media players with debug 2>&1
$ audacious 2>&1 'rudra veena and pakhawaj.flac'
Input: 44100 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 940
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1024
Rates: 30080 --> 32768 (J: 0.09%, T: FFT, W: Vorbis)
Ok.$ /usr/bin/totem 2>&1 'rudra veena and pakhawaj.flac'
Input: 44100 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 940
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1024
Rates: 30080 --> 32768 (J: 0.09%, T: FFT, W: Vorbis)
Ok.$ mpv 2>&1 'rudra veena and pakhawaj.flac'
(+) Audio --aid=1 (flac 2ch 44100Hz)
AO: [alsa] 48000Hz stereo 2ch s16$ mpv 2>&1 audio_test_48kHz_16bit.wav
(+) Audio --aid=1 (pcm_s16le 2ch 48000Hz)
AO: [alsa] 48000Hz stereo 2ch s163. Check hw_params
$ cat /proc/asound/cards
0 [system]: USB-Audio - iMic USB audio system
Griffin Technology, Inc iMic USB audio system at usb-0000:00:1a.0-1.3.4, full s$ cat /proc/asound/system/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 16384This means that the default sample rate is 48kHz. Let us change it. Presumably, there is already a sort of invisible dmix, so that we can set defaults.pcm.dmix.rate in ALSA config.
$ cat ~/.asoundrc
defaults.pcm.rate_converter "fftrate"
defaults.pcm.dmix.rate 44100$ /usr/bin/totem 2>&1 audio_test_48kHz_16bit.wav
Input: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 480
Output: 44100 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 441
Rates: 48000 --> 44100 (J: 0.00%, T: FFT, W: Vorbis)
Ok.$ mpv 2>&1 audio_test_48kHz_16bit.wav
(+) Audio --aid=1 (pcm_s16le 2ch 48000Hz)
AO: [alsa] 44100Hz stereo 2ch s16$ mpv 2>&1 'rudra veena and pakhawaj.flac'
(+) Audio --aid=1 (flac 2ch 44100Hz)
AO: [alsa] 44100Hz stereo 2ch s16$ cat /proc/asound/system/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 2734
buffer_size: 11026It works because dmix is already enabled.
Debian Wiki:
Advanced features such as mixing should already be configured with sane defaults.
_https://wiki.debian.org/ALSA#Configuration
This means that there is already a very advanced software mixer with dmix and other plugins configured for pulseaudio. It might be obvious that this strange construction was created to imitate "bit perfect" playback of audiophile apps for macOS: media players can easily change the default sample rate of the software mixer to avoid software resampling. Try "bit perfect" mode of Audacious for macOS. It makes sense for macOS, because the built-in HW resampler of the DAC is better than the software resampler of macOS.
Why do we need this Stone Age technology? Configure a normal mixer with arateconf and forget about problems with sound quality. The so-called "bit perfect" is not needed, because the fftrate resampler is much better than the built-in HW resampler of your DAC. You can safely configure fftrate for the maximal sample rate supported by your DAC.
NOTE: When software mixer configured by arateconf, mpv does not resample anything,
$ mpv 'rudra veena and pakhawaj.flac'
(+) Audio --aid=1 (flac 2ch 44100Hz)
Input: 44100 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1764
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates: 44100 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.
AO: [alsa] 44100Hz stereo 2ch s16Explanation:
$ mpv 'rudra veena and pakhawaj.flac'
(+) Audio --aid=1 (flac 2ch 44100Hz) # mpv Input
AO: [alsa] 44100Hz stereo 2ch s16 # mpv Output --> ALSA software mixer
# ALSA software mixer: fftrate
Input: 44100 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1764
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates: 44100 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.Last edited by igorzwx (2025-11-10 07:20:05)
Offline
Pages: 1