[Tutorial] Improve Audio Sound

This was many years of trial and error with different kernel level settings etc. Finally got it dialed in and myself as well as others who have tried it agree it does improve the sound. Tested on RPi, Sparky, Odroid and ASUS with Squeezelite and MPD.

See my Github repo

https://github.com/dynobot/Linux-Audio-Adjustments

Thanks for sharing, perhaps we can adapt some tweaks to DietPi.

Thanks MichaIng,

I know people come up with these things all the time. I’ve actually been working on these and fine tuning for nearly 10 years. I read and used manuals from RedHat, IBM, Oracle and others to understand which kernel parameters can be tuned. Obviously there are a lot with a lot of different values for each.

After years of trying different values, settings and values recommended by the professionals and values I ended up liking through empirical listening tests I quickly found out that the old way of thinking “If some is good, more is better” does not apply to audio. For example using bruit force methods of applying the highest priority didn’t always sound best, in fact it most often sounds worse.

In addition, I learned that there is a delicate balancing act at play with tuning the kernel for optimal results. This meant I had to try a lot of variables to listen for what really effects sound quality and what kernel level tuning plays well with others.
Now after nearly a decade I believe I have narrowed down a small set of kernel level variables to adjust to give optimal results for all types of music and in all listening situations. In fact, on Debian based systems these values work for all music players equally well.

Give it an honest try and see what you think. I’m not a ‘real’ coder so I know it could have been done more elegantly, but it work :slight_smile:

BTW, they work as a ‘whole’ unit best.

Just a quick question…where exactly do I paste into the limits.conf file? Am I supposed to insert the code on the same line as “#End of file”, or all into the blank line directly above that one?

It needs to be “before” the “#End of file” line.

Created an automated install and removal

See Github

Wow, thanks so much! There is definitely an improvement in sound quality!

Hi Smithcgriff

Please fill out the very short survey, takes about 15 seconds.

Enjoy the Music! :sunglasses:

Will do. Just one more question (sorry!). Should I uncomment on the reduce usb jitter settings in the Sound.sh file since im using a usb dac, or does it automatically detect what kind of device your using?

Yes if you are using a USB dac the line should look like this, with the modprobe line uncommented. Its not sophisticated enough to detect it.

afterward just do a ./Sound.sh to activate it.

#USB Dacs Uncomment to reduce USB latency
modprobe snd-usb-audio nrpacks=1

Great, thanks!

I just tried this on a new install of DietPi with allo gui. Was this supposed to leave a file called sound.sh on my system. It didn’t.

It should place /usr/bin/Sound.sh: https://github.com/dynobot/Linux-Audio-Adjustments/blob/master/basic-install.sh#L13

So you should be able to call it from command line via Sound.sh command.

Cool…the Sound Audio Tweaks got a write up in HACKADAY web blog.

https://hackaday.com/category/linux-hacks/


April 10, 2019 by Brian Benchoff 27 Comments
Audio systems in Linux are terrible. You’ve never known true pain until you’ve tried to set up a recording or broadcasting workstation running Linux. I did, twenty years ago, and nothing has changed since. This wasn’t really a problem when Linux was either used in server spaces or some nerd’s battle station, but now we have small single board computers that everyone uses and wants to turn into a modular synth. Welcome to paintown, because the Linux audio stack is terrible.

For the past ten years, [Dynobot] has been working on improving audio in Linux. This is a decade of reading manuals from IBM and Oracle, and a deep knowledge of how to adjust settings so audio actually works. All of this work is now combined into a single script that improves everything. This means the priority of the Audio group is changed, the thread priority is better, the latency is better, and for anyone who wants to set up a local streaming service, the network latency is better. It’s not everything, and there’s no mention of recording multitrack audio, but we’ll accept the baby steps here.

Nice recordings DKCPlayer This may be a good reference for me to use when recording WAV sound effects for the DKCLB… Ive been too busy to do that as of yet.

Seems the new correct network address of the tutorial is:

https://github.com/tml3nr/Linux-Audio-Adjustments

Had problem finding it at first with original adress posted in first post of thread.

User changed from dynobot to tml3nr, so you need to edit the url in basic-install.sh as well or it won’t work because of a 404

Fork from https://github.com/brianlight/Linux-Audio-Adjustments? I’m confused now :rofl:.

But https://github.com/dynobot/Linux-Audio-Adjustments exists regularly as well with newest commit (no 404). I’d stay with the original repo as long as even the contained links/scripts contain all “dynobot”.

But I guess Edward can make things clear :slight_smile:.

Wow thanks I just stumbled onto this and will definitely install it in the near future.
Thanks for putting it out there

I just had a quick browse through your install script and had one small request
instead of

[[ -f /etc/security/limits.conf ]] && mv /etc/security/limits.conf /etc/security/limits.conf.bak

maybe incremental backups to avoid
install *2+ overwrites the original file
if something goes wrong you have two broken files

Just an idea.
Thanks it really looks good.

Or even better: Use /etc/security/limits.d/audio_adjustments.conf and leave limits.conf untouched?

At best open an issue or do a PR on the repository :slight_smile:.