ALSA: Difference between revisions
NirLichtman (talk | contribs) (Add instructions regarding unmuting as part of initial setup) |
DenysNykula (talk | contribs) (Mention snd-seq required by USB MIDI controllers) |
||
| Line 45: | Line 45: | ||
To list all the detected sound cards and their assigned numbers, use the command:{{Cmd|$ cat /proc/asound/cards}} | To list all the detected sound cards and their assigned numbers, use the command:{{Cmd|$ cat /proc/asound/cards}} | ||
=== MIDI === | |||
If your USB MIDI controller isn't found by music production applications such as {{pkg|mixxx}} and {{pkg|lmms}}, load the ALSA Sequencer kernel module before starting the applications: {{Cmd|# modprobe snd-seq}} | |||
You can add {{ic|snd-seq}} to {{Path|/etc/modules}} to make it autoload at boot. | |||
== See also == | == See also == | ||
Latest revision as of 00:03, 20 March 2026
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 make sure they are not muted (mute is denoted by MM and can be toggled using the M key). Audio should now work (you can use the F1 key to get additional help within alsamixer).
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
MIDI
If your USB MIDI controller isn't found by music production applications such as mixxx and lmms, load the ALSA Sequencer kernel module before starting the applications:
# modprobe snd-seq
You can add snd-seq to /etc/modules to make it autoload at boot.