ALSA: Difference between revisions
m (correct typo for config file reference in troubleshooting) |
Prabuanand (talk | contribs) m (rewrote for consistency) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[https://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture Advanced Linux Sound Architecture (ALSA)] provides audio and MIDI functionality to the Linux operating system. As part of the Linux kernel, it provides an application programming interface (API) for sound card device drivers. | |||
== Installation == | |||
{{Cmd|# apk add {{pkg|alsa-utils}} {{pkg|alsaconf}}}} | First you will need to install the Alsa packages, Linux sound driver and volume adjuster: {{Cmd|# apk add {{pkg|alsa-utils}} {{pkg|alsaconf}}}} | ||
== | == Configuration == | ||
Then you will need to add all your users (including root) to the <code>audio</code> group. | Then you will need to add all your users (including root) to the <code>audio</code> group. | ||
Line 13: | Line 13: | ||
</nowiki>}} | </nowiki>}} | ||
Find the default sound card. | Find the default sound card.: {{Cmd|# 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 ({{Key|F1}} - help, {{Key|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, ...) | ||
Line 23: | Line 21: | ||
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. | 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. | ||
{{ | 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 below lines separated by a space for each. For example, if the default sound card you want is "1". | ||
Use your favourite editor to edit the {{Path|~/.asoundrc}} file as follows:{{Cat|~/.asoundrc|defaults.ctl.card 1 | |||
{{Cat|/ | |||
defaults.ctl.card 1 | |||
defaults.pcm.card 1 | defaults.pcm.card 1 | ||
}} | }} | ||
The {{Path|~/.asoundrc}} file installed in a user's home directory($HOME) is called from {{Path|/usr/share/alsa/alsa.conf}}. It is also possible to install the above in a system-wide configuration file as {{Path|/etc/asound.conf}}. When an ALSA application starts both configuration files are read but the settings in the {{Path|~/.asoundrc}} file override the settings in the {{Path|/etc/asound.conf}} settings. | |||
Most programs require a restart to reread {{Path|~/.asoundrc}} or {{Path|/etc/asound.conf}}. This includes desktop environment audio daemons, such as [[PulseAudio]]. For most changes, you will need to restart the sound server. | |||
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. | ||
Gstreamer can now catch the device once the [[#Service management|service is started]] and the audio mixer will be working. | |||
=== Service management === | |||
Use standard start|stop|restart [[OpenRC]] commands to manage {{ic|alsa}} service. | |||
Note that {{ic|alsa}} service is not started on install. To start, issue the command:{{Cmd|# rc-service alsa start}} | |||
To enable the Alsa user service, issue the command:{{Cmd|# rc-update add alsa}} | |||
== Troubleshooting == | == Troubleshooting == | ||
To list all the detected sound cards and their assigned numbers, use the command:{{Cmd|$ cat /proc/asound/cards}} | |||
== See also == | |||
* [https://www.alsa-project.org/wiki/Main_Page Official website] | |||
* [https://alsa.opensrc.org/ Unofficial alsa wiki] | |||
* [[Sound_Setup|Main page for Sound Setup]] | |||
[[Category:Sound]] | [[Category:Sound]] | ||
[[Category:Drivers]] | [[Category:Drivers]] | ||
Latest revision as of 16:59, 21 August 2025
Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux operating system. As part of the Linux kernel, it provides an application programming interface (API) for sound card device drivers.
Installation
First you will need to install the Alsa packages, Linux sound driver and volume adjuster:
# apk add alsa-utils alsaconf
Configuration
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.
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 below lines separated by a space for each. For example, if the default sound card you want is "1".
Use your favourite editor to edit the ~/.asoundrc file as follows:
Contents of ~/.asoundrc
The ~/.asoundrc file installed in a user's home directory($HOME) is called from /usr/share/alsa/alsa.conf. It is also possible to install the above in a system-wide configuration file as /etc/asound.conf. When an ALSA application starts both configuration files are read but the settings in the ~/.asoundrc file override the settings in the /etc/asound.conf settings.
Most programs require a restart to reread ~/.asoundrc or /etc/asound.conf. This includes desktop environment audio daemons, such as PulseAudio. For most changes, you will need to restart the sound server.
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.
Gstreamer can now catch the device once the service is started and the audio mixer will be working.
Service management
Use standard start|stop|restart OpenRC commands to manage alsa
service.
Note that alsa
service is not started on install. To start, issue the command:
# rc-service alsa start
To enable the Alsa user service, issue the command:
# rc-update add alsa
Troubleshooting
To list all the detected sound cards and their assigned numbers, use the command:
$ cat /proc/asound/cards