ALSA: Difference between revisions

From Alpine Linux
mNo edit summary
m (Remove added troubleshooting section, the recommendation doesn't work consistently.)
Tag: Manual revert
 
(16 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Move|ALSA|More specific. Indicates that this is the alsa-utils method of configuring sound.}}
== Install ==


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


# apk add alsa-utils alsa-utils-doc alsa-lib alsaconf
{{Cmd|# apk add {{pkg|alsa-utils}} {{pkg|alsaconf}}}}


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


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


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.
{{Cmd|<nowiki># addgroup $USER audio
 
# addgroup root audio
<code>audio:x:18:root,user</code>
</nowiki>}}
 
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.


# alsamixer
{{Cmd|# 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 (''F1'' - help, ''M'' - toggle mute, ...)
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 ({{Key|F1}} - help, {{Key|M}} - toggle mute, ...)


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 {{Key|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 {{Key|F6}} context menu as your default soundcard.


# nano /usr/share/alsa/alsa.conf
{{Cmd|# nano /usr/share/alsa/alsa.conf}}


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".
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 {{Key|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>
{{Cat|/usr/share/alsa/alsa.conf|...
<code>defaults.pcm.card 1</code>
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''.
Save your nano work by pressing {{Key|Ctrl}}+{{Key|O}} and confirm the changes by pressing {{Key|Enter}}. Then exit nano by pressing {{Key|Ctrl}}+{{Key|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 <code>alsamixer</code> command, and audio should work.


Alsa service is not started on install, you need to start it and to add it on rc.
Alsa service is not started on install, you need to start it and to add it on [[OpenRC]].
rc-service alsa start
{{Cmd|rc-service alsa start
rc-update add alsa
rc-update add alsa
}}


Gstreamer can now catch the device and the audio mixer is working.
Gstreamer can now catch the device and the audio mixer is working.
Line 45: Line 47:
[[Category:Desktop]]
[[Category:Desktop]]
[[Category:Multimedia]]
[[Category:Multimedia]]
[[Category:Sound]]
[[Category:Drivers]]
[[Category:Hardware]]

Latest revision as of 21:58, 29 October 2024

Install

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

# apk add alsa-utils alsaconf

Setup

Then you will need to add all your users (including root) to the audio group.

# addgroup $USER audio # addgroup root audio

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 (F1 - help, M - toggle mute, ...)

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".

Contents of /usr/share/alsa/alsa.conf

... 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.

Alsa service is not started on install, you need to start it and to add it on OpenRC.

rc-service alsa start rc-update add alsa

Gstreamer can now catch the device and the audio mixer is working.