Skip to content

Instantly share code, notes, and snippets.

@researcx
Last active Dec 17, 2021
Embed
What would you like to do?
Linux System-wide Audio Tuning [24bit 192 kHz HD Audio + A=432 Hz Tuning + Equalizer]

24bit 192 kHz HD Audio + A=432 Hz Tuning + Equalizer

High-quality sampling

ALSA

echo 'defaults.pcm.rate_converter "speexrate_best"' | tee -a .asoundrc
sudo alsactl restore

PulseAudio

sudo echo 'default-sample-format = s24le' | sudo tee -a /etc/pulse/daemon.conf
sudo echo 'default-sample-rate = 192000' | sudo tee -a /etc/pulse/daemon.conf
sudo echo 'resample-method = soxr-vhq' | sudo tee -a /etc/pulse/daemon.conf
pulseaudio -k; pulseaudio -D

A4 432 Hz real-time tuning

A=432 Hz, known as Verdi’s ‘A’ is an alternative tuning that is mathematically consistent with the universe.

Sources:

Required: ladspa-devel, ladspa-tap-plugins

ALSA

Append to the end of ~/.asoundrc:

pcm.ladspa {
	type ladspa
	slave.pcm "hw:0,0";
	path "/usr/lib64/ladspa";
	plugins [{
		label tap_pitch
		input {
		controls [ -0.317667 0 -90 0 ]
		}
	}]
}

Reload ALSA

sudo alsactl restore

PulseAudio

Comment out these lines in /etc/pulse/default.pa:

.ifexists module-udev-detect.so
load-module module-udev-detect
.else
load-module module-detect
.endif

Append to the end of /etc/pulse/default.pa:

load-module module-alsa-sink device=hw:0,0
.ifexists module-ladspa-sink.so
.nofail
load-module module-ladspa-sink sink_name=ladspa_out master=alsa_output.hw_0_0 plugin=tap_pitch label=tap_pitch control=-0.317667,0,-90,0
.fail
.endif

Restart pulseaudio

pulseaudio -k; pulseaudio -D

Equalizer

Ziyad's Perfect EQ (included in pulseeffects): https://www.ziyadnazem.com/post/956431457/the-perfect-eq-settings-unmasking-the-eq

Arch Linux: yaourt -S pulseeffects calf

Others: pulseaudio-equalizer-ladspa, pulseaudio-equalizer, pulseeffects, qpaeq, alsaequal

@dspacejs
Copy link

dspacejs commented Feb 1, 2021

Why comment out this?

.ifexists module-udev-detect.so
load-module module-udev-detect
.else
load-module module-detect
.endif

It's getting rid of the rest of the sound devices on my PC, such as microphones, etc. Will it work with this code block enabled? Because I can't use it without the device detection.

@researcx
Copy link
Author

researcx commented Feb 4, 2021

Why comment out this?

.ifexists module-udev-detect.so
load-module module-udev-detect
.else
load-module module-detect
.endif

It's getting rid of the rest of the sound devices on my PC, such as microphones, etc. Will it work with this code block enabled? Because I can't use it without the device detection.

I'm not able to try this right now, if you want to experiment with it, I'd suggest using something like PulseEffects which displays your current audio quality and is able to view sound frequencies.

Also I wish to add this from my experiences:

  • certain media players (and unfortunately most) will automatically lower the audio quality to around 16bit 44hz and need to be manually configured to 24bit 192k (and on some this doesn't work). (cmus, audacius, gmusicbrowser should have no issues)
  • applications such as Spotify installed from snap or flatpak (from my experience in 2018) will always only play audio at 44hz, and setting the sound quality to highest makes no difference.

@dspacejs
Copy link

dspacejs commented Feb 6, 2021

@unendingPattern

applications such as Spotify installed from snap or flatpak (from my experience in 2018) will always only play audio at 44hz, and setting the sound quality to highest makes no difference.

Unfortunately my music player is installed via flatpak, so I can't really do anything about that. Regardless, surely if you're configuring the sound at the OS level, wouldn't this just transform all sound output by default to be whatever frequency you want (even if an app uses a different frequency)? Which is ideal anyway, since I'd rather have all sounds be 432Hz by default.

certain media players (and unfortunately most) will automatically lower the audio quality to around 16bit 44hz and need to be manually configured to 24bit 192k (and on some this doesn't work). (cmus, audacius, gmusicbrowser should have no issues)

Do you know if TIDAL or Tauon Music Box do this, by any chance? TIDAL doesn't have a Linux desktop app, but they have a web app (and someone made an Electron wrapper for this). I'm assuming TIDAL doesn't because it's designed for audiophiles, but maybe web players have some sort of technical limitation.

@dm17
Copy link

dm17 commented Feb 13, 2021

I didn't realize you could tune a whole waveform to 432hz... I thought the original composition needed to be produced this way - it is an aspect of how it is in tune with itself. Does that make sense, or am I off?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment