ALSA: Difference between revisions

DoggoBit (talk | contribs)
No edit summary
Phobos (talk | contribs)
m Cleaned up tone somewhat, however this page likely could do with a cleanup and reformating
Tags: Mobile edit Mobile web edit Advanced mobile edit Visual edit
 
Line 7: Line 7:
In order to save the sound card state on shutdown sound must be enabled in <code>configuration.nix</code>
In order to save the sound card state on shutdown sound must be enabled in <code>configuration.nix</code>


<syntaxHighlight lang=nix>
<syntaxhighlight lang="nix">
sound.enable = true;
hardware.alsa.enablePersistence = true;
</syntaxHighlight>
</syntaxhighlight>
 


==Troubleshooting ALSA==
==Troubleshooting ALSA==


* on a console fire up alsamixer
* on a console launch [[wikipedia:Alsamixer|alsamixer]].


   alsamixer
   alsamixer


* you see plenty of vertical bars?
* If you see plenty of vertical bars:
** you should be okay
** You should be okay


* you see very few vertical bars and the sound card (top-left) is something like "PC Speaker"?
* If you see very few vertical bars and the sound card (top-left) is "PC Speaker" or similar:
** hit the 'S' key, you should be able to switch to the "real" audio card (if not your audio card is likely to not being supported yet).
** Hit the 'S' key, you should be able to switch to the "real" audio card (if not your audio card is likely to not being supported yet).
** when the real audio card is selected you should be viewing the "plenty vertical bars" thing.
** When the real audio card is selected you should be viewing the "plenty vertical bars" thing.
*** first thing to do is to disable pc speaker (kernel module "snd-pcsp", see below.
*** First thing to do is to disable PC speaker (kernel module "snd-pcsp", see below.


=== Make your audio card the default ALSA card ===
=== Make your audio card the default ALSA card ===


Sometimes the pc-speaker is the default audio card for ALSA. You can make your real sound card default instead.  For example, if your sound card is "hda-intel" then add
Occasionally the PC-speaker is the default audio card for ALSA. You can make your real sound card default instead.  For example, if your sound card is "hda-intel" then you would add the following to your configuration.
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
boot.extraModprobeConfig = ''
boot.extraModprobeConfig = ''
   options snd slots=snd-hda-intel
   options snd slots=snd-hda-intel
'';
'';
</syntaxHighlight>
</syntaxHighlight>At times, you may wish to disable one of multiple Intel cards. Here is how to disable the first card, but enable a second one.
to your <code>/etc/nixos/configuration.nix</code>.
 
Sometimes, we may want to disable one of intel cards. Here is how to disable first card, but enable the second one.
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
boot.extraModprobeConfig = ''
boot.extraModprobeConfig = ''
Line 42: Line 38:
'';
'';
</syntaxHighlight>
</syntaxHighlight>
Alternatively you can ...


=== Disable PC Speaker "audio card" ===
=== Disable PC Speaker "audio card" ===


edit <code>/etc/nixos/configuration.nix</code> and add "snd_pcsp" to <code>boot.blacklistedKernelModules</code> option:
Add "snd_pcsp" to the <code>boot.blacklistedKernelModules</code> option:


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 57: Line 51:
=== Other hardware specific problems ===
=== Other hardware specific problems ===


Some hardware specific problems can be resolved by adjusting the options for the sound module. For example, the microphone may be stuck on an unusably low volume. First you should be sure that you have already checked the settings in alsamixer to make sure nothing is muted, and also any physical buttons on your computer (I have twice overlooked the mute button on laptops!).  
Some hardware specific problems can be resolved by adjusting the options for the sound module. For example, the microphone may be stuck on a very low volume. First you should be sure that you have already checked the settings in alsamixer to make sure nothing is muted, and also any physical buttons on your computer.  


You should be able to look up the available options for ''model'' in [https://www.kernel.org/doc/Documentation/sound/hd-audio/models.rst models.rst]. You can try them out interactively as follows:
You should be able to look up the available options for model in [https://www.kernel.org/doc/Documentation/sound/hd-audio/models.rst models.rst]. You can try them out interactively as follows:


# Close any applications using the sound card
# Close any applications using the sound card
## See if any applications are using the sound card
## See if any applications are using the sound card
##: $ lsof /dev/snd/*
##: {{Code|$ lsof /dev/snd/*
##: COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
 
##: pulseaudi 14080 goibhniu   30u   CHR 116,7     0t0 5169 /dev/snd/controlC0
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
##: pulseaudi 14080 goibhniu   37u   CHR 116,7     0t0 5169 /dev/snd/controlC0
pulseaudi 14080 goibhniu 30u CHR 116,7 0t0 5169 /dev/snd/controlC0
## Kill them
pulseaudi 14080 goibhniu 37u CHR 116,7 0t0 5169 /dev/snd/controlC0|lang=console|line=no}}
## Kill any processes
##: for any process apart from pulseaudio you could just do:
##: for any process apart from pulseaudio you could just do:
##: $ kill -9 14080
##: $ kill -9 14080
Line 92: Line 87:
'';
'';
</syntaxHighlight>
</syntaxHighlight>
Much of this is taken from https://help.ubuntu.com/community/HdaIntelSoundHowto which also has additional tips.


[[Category:Audio]]
[[Category:Audio]]