My guide to Linux audio for beginners.
This applies to many, many distributions and should work regardless of the tools you prefer. I am not going into a great deal of detail to keep it short and easy to read for average users, don’t expect alsa vs oss vs jack vs pipe discussions.
There are several options for audio output in Linux. Where windows has kmixer (mixing, lossy) and wasapi (direct control, lossless) linux uses pulseaudio (mixing, lossy) and alsa (direct control, lossless).
The general rule is to have pulseaudio only on when you are not listening to music, this means you can still watch youtube videos and hear notifications from skype at the same time.
But when you are listening to music the aim is to have only one source, your player, having priority control over your sound card.
Ubuntu 14.04 and debian testing (Click to show)
The only requirement is nano, no gui or desktop environment is necessary. Installing nano on debian or ubuntu is as simple as:
Setting up Alsa and gstreamer support:
Firstly make sure alsa, alsa-utils gstreamer0.10-alsa are all installed and up to date.
For debian/ ubuntu:
Detecting your proper sound card:
For the uses of this guide i will assume you are using a USB DAC.
Running the below in a terminal will list your devices detected by alsa as valid output devices:
The output on my machine is:
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevice #0: subdevice #0
card 1: DAC [UAC1 DAC], device 0: USB Audio [USB Audio]
Subdevices: 0/1Subdevice #0: subdevice #0
Here you can easily see that card 1, device 0 is my usb sound card. If i was to use HDMI output i would set it to card 0 device 3 or card 0 device 7.
Note: Sometimes if you get two HDMI outputs one is actually your DVI output, its a cheap trick hardware OEMs use to add ports. You will have to try both to find out which one is actually your HDMI device.
Testing a device is as simple as using:
aplay -D hw:0,0 test.wav
Where hw:0,0 refers to your hardware detected above with aplay -l.
For Alsa playback applications we provide hardware addresses in the form:
So in my case it is:
Setting defaults is the final step. Run the following in a terminal:
I suggest cleaning out this entire file so it is blank then putting the below contents in.
Simply replace the card and device numbers with the ones you found above.
For instance my config reads:
You are done with alsa!
Turning off pulseaudio:
As of 14.04 the version of pulseaudio used is much easier to disable with only a single line needing to be edited.
That's it. No joke, you are done. Just restart your machine.
Setting up your music player to use alsa.
There are many options out there for playing back bitperfect audio in linux as far as music players go.
This post by Rizlaw is a great summary, albeit rather outdated. If you have more questions feel free to ask via pm, post a reply, or simply head over to the forums for your specific distro.
Edited by yay101 - 6/21/14 at 6:42am