You are not logged in.
Pages: 1
It is not difficult to remove PulseAudio and PipeWire.
The problem is how to configure a software mixer for ALSA.
Such mixer might be needed, if one wants to use ALSA just like MacOS users are using the sound system on MacBooks: for video conferencing with Discord or similar app, or playing HiRes audio files without distortions produced by crappy resamplers. This implies that the desired software mixer should have a high quality real-time codec (resampler and format converter).
These problems can be solved through the help of the fftrate plugin
https://github.com/PetrovSE/fftrate
Debian packages:
libasound2-plugin-fftrate_1.6.3_amd64.deb
alsa-config-utils_1.6.3_amd64.deb
pcm-utils_1.6.3_amd64.deb
They provide:
libasound_module_rate_fftrate.so — ALSA plugin (FFT resampler/converter)
arateconf — utility to generate ~/.asoundrc
pcm_conv — standalone FFT resampler/converter
How to compile fftrate plugin
Install "build-essential", etc.
sudo apt update
sudo apt-get install build-essential git debhelper
sudo apt install libasound2-dev libasound2-plugins swh-plugins
Install gcc-10 and g++-10 from Devuan's oldstable repositories.
$ cat /etc/apt/sources.list | grep oldstable
# oldstable repositories
deb http://deb.devuan.org/merged oldstable main contrib non-free
deb-src http://deb.devuan.org/merged oldstable main contrib non-free
Enable the oldstable repositories and update
sudo apt update
$ apt search g* | grep "gcc-10/\|g++-10/"
g++-10/oldstable,now 10.2.1-6 amd64
gcc-10/oldstable,now 10.2.1-6 amd64
sudo apt install gcc-10 g++-10
$ whereis gcc-10 g++-10
gcc-10: /usr/bin/gcc-10
g++-10: /usr/bin/g++-10
To compile the code you should configure "make" to use gcc-10 and g++-10, instead of the default gcc-12 and g++-12.
To build the deb packages, you have to specify "compatibility level 13" in debian/compat
$ man debhelper-compat-upgrade-checklist | grep "recommended mode"
v13 This is the recommended mode of operation.
Compilation
mkdir petrov-fftrate
cd petrov-fftrate
git clone https://github.com/PetrovSE/fftrate.git
Now you have to edit two files inside the package "fftrate":
./fftrate/src/lib/makedef.mk
./fftrate/packets/debian/compat
Enable gcc-10 and g++-10:
$ cat ./fftrate/src/lib/makedef.mk | grep gcc -A1
CC = gcc-10
CPP = g++-10
Change compat to "13":
$ cat ./fftrate/packets/debian/compat
13
Now you can compile:
cd ./fftrate/packets
$ ls -1
Makefile
debian
etc
mk_dpkg
Compilte the code:
make
Make debian packages:
./mk_dpkg
$ ls ../ | grep .deb
alsa-config-utils_1.6.3_amd64.deb
libasound2-plugin-fftrate_1.6.3_amd64.deb
pcm-utils_1.6.3_amd64.deb
How to install fftrate
Install dependencies (if they are not already installed):
sudo apt install libasound2 libasound2-plugins swh-plugins
Install fftrate:
sudo dpkg -i libasound2-plugin-fftrate_1.6.3_amd64.deb alsa-config-utils_1.6.3_amd64.deb pcm-utils_1.6.3_amd64.deb
Open /etc/fftrate.conf with a text editor:
sudo nano /etc/fftrate.conf
Enable fft resampler:
$ cat /etc/fftrate.conf | grep "Transform type" -A3
# Transform type
# Available: dct, fft (default: dct)
#transform = dct
transform = fft
Run arateconf (interactive mode) to generate ~/.asoundrc
arateconf
Press 0 to select the first sound card.
Press 1 to select the second sound card.
Press F to change format
For Intel HDA codec on motherboard, try 32bit 192000Hz
For USB headsets, try 16bit 48Hz
Run TEST (press T).
If all tests have been passed successfully, save the setting (press S) and exit (ESC).
EXAMPLE: Intel HDA
===============
| Main menu |
---------------
Curr. | Used | Play (def) | Rec (def) | Available cards
----------|------|------------|-----------|-----------------------------------
0 - >>>>> | * | * * | * * | HDA-Intel - HDA Intel PCH
1 - | * | * | * | USB-Audio - iMic USB audio system
U - Toggle used flag
P - Set this device as default player
R - Set this device as default recorder
O - Output device: PCH,0
I - Input device : PCH,0
F - Format: 192000 Hz, 2 ch, 'S32_LE'
C - Converter: fftrate
A - Show all plugins [ ]
M - Plug-ins:
[X] Convert, [ ] Expand, [X] Asym
[ ] Play Vol, [X] Dmix
[ ] Rec. Vol, [X] Dsnoop
[ ] Phonon, [ ] Normalizator
T - Test
S - Save to '/home/devuan/.asoundrc'
X - Delete '/home/devuan/.asoundrc'
ESC - Exit
EXAMPLE: iMic USB
===============
| Main menu |
---------------
Curr. | Used | Play (def) | Rec (def) | Available cards
----------|------|------------|-----------|-----------------------------------
0 - | * | * * | * * | HDA-Intel - HDA Intel PCH
1 - >>>>> | * | * | * | USB-Audio - iMic USB audio system
U - Toggle used flag
P - Set this device as default player
R - Set this device as default recorder
O - Output device: system,0
I - Input device : system,0
F - Format: 48000 Hz, 2 ch, 'S16_LE'
C - Converter: fftrate
A - Show all plugins [ ]
M - Plug-ins:
[X] Convert, [ ] Expand, [X] Asym
[ ] Play Vol, [X] Dmix
[ ] Rec. Vol, [X] Dsnoop
[ ] Phonon, [ ] Normalizator
T - Test
S - Save to '/home/devuan/.asoundrc'
X - Delete '/home/devuan/.asoundrc'
ESC - Exit
TEST
> t
Testing H/W compatibility ...
Device: PCH
Output:
Open device "hw:PCH,0" ... Ok.
Set rate 192000 Hz ... Ok.
Set channels 2 ... Ok.
Set format 'S32_LE' ... Ok.
Set buffer size 30720 -> 30720
Set period size 7680 -> 7680
Input:
Open device "hw:PCH,0" ... Ok.
Set rate 192000 Hz ... Ok.
Set format 'S32_LE' ... Ok.
Set buffer size 30720 -> 30720
Set period size 7680 -> 7680
Device: system
Output:
Open device "hw:system,0" ... Ok.
Set rate 48000 Hz ... Ok.
Set channels 2 ... Ok.
Set format 'S16_LE' ... Ok.
Set buffer size 7680 -> 7680
Set period size 1920 -> 1920
Input:
Open device "hw:system,0" ... Ok.
Set rate 48000 Hz ... Ok.
Set format 'S16_LE' ... Ok.
Set buffer size 7680 -> 7680
Set period size 1920 -> 1920
Press any key ...
S - Save to '/home/devuan/.asoundrc'
> s
Saving config file...
Test: 'default' ... Ok.
Test: 'default' ... Ok.
Ok.
Testing playback/recording
$ aplay *.wav
Playing WAVE 'audio_test_48kHz_16bit.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Input: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 192000 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 7680
Rates: 48000 --> 192000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.
$ arecord -V stereo -f S16_LE -r 48000 -c 2 1-fft-exp_rec_alsa.wav
Recording WAVE '1-fft-exp_rec_alsa.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Input: 192000 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 7680
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates: 192000 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.
$ aplay 1-fft-exp_rec_alsa.wav
Playing WAVE '1-fft-exp_rec_alsa.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Input: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 192000 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 7680
Rates: 48000 --> 192000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.
Now you can install apulse and run discord
apulse discord
You may also need ALSA mixer
alsamixer
man alsamixer
Last edited by igorzwx (2024-05-31 00:40:14)
Offline
Thank you! Looks very interesting.
Offline
Pages: 1