ALSA: Difference between revisions

From Alpine Linux
m (Amended code; amended style; added categories: Installation, Desktop)
m (Amended code; amended style; added categories: Installation, Desktop)
Line 1: Line 1:
First you will need to install Alsa packages, the Linux sound driver and volume adjuster.
First you will need to install Alsa packages, the Linux sound driver and volume adjuster.


<code># apk add alsa-utils alsa-utils-doc alsa-lib alsaconf</code>
# apk add alsa-utils alsa-utils-doc alsa-lib alsaconf


Then you will need to add all your users (including root) to /etc/group.
Then you will need to add all your users (including root) to <code>/etc/group</code>.


<code># nano /etc/group</code>
# nano /etc/group


Scroll down until you find the line that starts with "audio:x:18:" and add all the users, for example if the name of root is "root" and a user is "user", separated by commas.
Scroll down until you find the line that starts with <code>audio:x:18:</code> and add all the users, for example if the name of root is "root" and a user is "user", separated by commas.


<code>audio:x:18:root,user</code>
<code>audio:x:18:root,user</code>


Save your nano work by pressing Ctrl+O and confirm the changes by pressing enter. Then exit nano by pressing Ctrl+X.
Save your nano work by pressing ''Ctrl+O'' and confirm the changes by pressing ''Enter''. Then exit nano by pressing ''Ctrl+X''.


Find the default sound card.
Find the default sound card.


<code># alsamixer</code>
# alsamixer


The default sound card will show up. Try turning up the volume of Master and the device(s) such as speakers or microphones that you need, and audio should work.
The default sound card will show up. Try turning up the volume of Master and the device(s) such as speakers or microphones that you need, and audio should work.


If there are no volume controls visible, try hitting F6 on your keyboard and toggling between the sound cards (which all might have the same name in the context menu that pops up except for the numbers next to and before the names).
If there are no volume controls visible, try hitting ''F6'' on your keyboard and toggling between the sound cards (which all might have the same name in the context menu that pops up except for the numbers next to and before the names).


Once you've found the sound card name that gives you volume controls, set the unique number that showed up in the F6 context menu as your default soundcard.
Once you've found the sound card name that gives you volume controls, set the unique number that showed up in the ''F6'' context menu as your default soundcard.


<code># nano /usr/share/alsa/alsa.conf</code>
# nano /usr/share/alsa/alsa.conf


Scroll down until you find the lines that start with "defaults.ctl.card" and "defaults.pcm.card" and put the number (you found in the F6 context menu of the alsamixer command for the soundcard you want as your default) at the end of those lines separated by a space for each. For example, if the default sound card you want is "1".
Scroll down until you find the lines that start with <code>defaults.ctl.card</code> and <code>defaults.pcm.card</code> and put the number (you found in the ''F6'' context menu of the alsamixer command for the soundcard you want as your default) at the end of those lines separated by a space for each. For example, if the default sound card you want is "1".


<code>defaults.ctl.card 1</code>
<code>defaults.ctl.card 1</code>
<code>defaults.pcm.card 1</code>


<code>defaults.pcm.card 1</code>
Save your nano work by pressing ''Ctrl+O'' and confirm the changes by pressing ''Enter''. Then exit nano by pressing ''Ctrl+X''.


Save your nano work by pressing Ctrl+O and confirm the changes by pressing enter. Then exit nano by pressing Ctrl+X.
Try turning up the volume of Master and the device(s) such as speakers or microphones that you need with the <code>alsamixer</code> command, and audio should work.


Try turning up the volume of Master and the device(s) such as speakers or microphones that you need with the alsamixer command, and audio should work.


  {{Todo|Help needed - how to make the default sound card and device show up in the Audio Mixer GUI in the XFCE menu and taskbar, so that you can use a GUI instead of the alsamixer command in the terminal?}}
  {{Todo|Help needed - how to make the default sound card and device show up in the Audio Mixer GUI in the XFCE menu and taskbar, so that you can use a GUI instead of the alsamixer command in the terminal?}}

Revision as of 16:05, 16 September 2017

First you will need to install Alsa packages, the Linux sound driver and volume adjuster.

# apk add alsa-utils alsa-utils-doc alsa-lib alsaconf

Then you will need to add all your users (including root) to /etc/group.

# nano /etc/group

Scroll down until you find the line that starts with audio:x:18: and add all the users, for example if the name of root is "root" and a user is "user", separated by commas.

audio:x:18:root,user

Save your nano work by pressing Ctrl+O and confirm the changes by pressing Enter. Then exit nano by pressing Ctrl+X.

Find the default sound card.

# alsamixer

The default sound card will show up. Try turning up the volume of Master and the device(s) such as speakers or microphones that you need, and audio should work.

If there are no volume controls visible, try hitting F6 on your keyboard and toggling between the sound cards (which all might have the same name in the context menu that pops up except for the numbers next to and before the names).

Once you've found the sound card name that gives you volume controls, set the unique number that showed up in the F6 context menu as your default soundcard.

# nano /usr/share/alsa/alsa.conf

Scroll down until you find the lines that start with defaults.ctl.card and defaults.pcm.card and put the number (you found in the F6 context menu of the alsamixer command for the soundcard you want as your default) at the end of those lines separated by a space for each. For example, if the default sound card you want is "1".

defaults.ctl.card 1
defaults.pcm.card 1

Save your nano work by pressing Ctrl+O and confirm the changes by pressing Enter. Then exit nano by pressing Ctrl+X.

Try turning up the volume of Master and the device(s) such as speakers or microphones that you need with the alsamixer command, and audio should work.


Todo: Help needed - how to make the default sound card and device show up in the Audio Mixer GUI in the XFCE menu and taskbar, so that you can use a GUI instead of the alsamixer command in the terminal?