yay101
100+ Head-Fier
- Joined
- Feb 24, 2013
- Posts
- 449
- Likes
- 68
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.
Output options:
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.
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:
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.
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.
Using the command:
Change the autospawn line to read:
That's it. No joke, you are done. Just restart your machine.
Playback!
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.
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.
Output options:
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.
The only requirement is nano, no gui or desktop environment is necessary. Installing nano on debian or ubuntu is as simple as:
sudo apt-get install nano
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:
sudo apt-get update && sudo apt-get install -y alsa alsa-utils gstreamer0.10-alsa
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:
aplay -l
The output on my machine is:
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: DAC [UAC1 DAC], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #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:
hw:card#,device#
So in my case it is:
hw:1,0
Setting defaults is the final step. Run the following in a terminal:
sudo nano /etc/asound.conf
I suggest cleaning out this entire file so it is blank then putting the below contents in.
pcm.!default {
type hw
card 0
device 0
}
ctl.!default {
type hw
card 0
device 0
}
Simply replace the card and device numbers with the ones you found above.
For instance my config reads:
pcm.!default {
type hw
card 1
device 0
}
ctl.!default {
type hw
card 1
device 0
}
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.
Using the command:
sudo nano /etc/pulse/client.conf
Change the autospawn line to read:
autospawn = no
That's it. No joke, you are done. Just restart your machine.
Playback!
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.