https://wiki.archlinux.org/api.php?action=feedcontributions&user=Zunguguzunguzeng&feedformat=atomArchWiki - User contributions [en]2024-03-28T23:44:04ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Advanced_Linux_Sound_Architecture_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)&diff=167036Advanced Linux Sound Architecture (Русский)2011-10-22T20:07:13Z<p>Zunguguzunguzeng: /* Настройка вывода через SPDIF */ (иЗмените)</p>
<hr />
<div>[[Category:Аудиосистема (Русский)]]<br />
[[Category:Русский]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
{{out of date}}<br />
<br />
Этот документ описывает процесс настройки ALSA для ядер версии 2.6. Посмотрите также, как [[Allow_multiple_programs_to_play_sound_at_once|разрешить одновременно проигрывать звук нескольким программам]].<br />
<br />
== Установка ==<br />
=== Модули ядра ===<br />
ALSA включено в ядро 2.6 и есть во всех пакетах '''kernel26*'''. Если вы компилируете ядро самостоятельно, не забудьте включить ALSA модуль, который вам нужен.<br />
Все необходимые модули будут найдены и загружены автоматически с помощью udev. Никакой особой настройки не требуется, если вы не используете ISA карты. '''НИКОГДА''' не используйте <code>alsaconf</code>, если у вас PCI или ISAPNP звуковая карта: строчки, добавленные в modprobe.conf могут сломать автоопределение udev.<br />
=== Пользовательские утилиты === <br />
* Необходимо для родных ALSA программ и управления:<br />
<br />
# pacman -S alsa-lib alsa-utils<br />
<br />
* Рекомендуется, если вы хотите использовать приложения с поддержкой OSS в комбинации с dmix:<br />
<br />
# pacman -S alsa-oss<br />
{{Note|Since <tt>udev>&#61;171</tt>, the OSS emulation modules (<tt>snd_seq_oss, snd_pcm_oss, snd_mixer_oss</tt>) are not automatically loaded by default.}}<br />
'''ОБРАТИТЕ ВНИМАНИЕ:''' Начиная с udev>=171, OSS-модули, по-умолчанию, автоматически не загружаются. При необходимости загрузите вручную: sudo modprobe snd-mixer-oss и добавьте в /etc/rc.conf, в секцию модулей: MODULES=(... snd-mixer-oss) (Например, TVtime использует snd-mixer-oss для программного управления звуком.)<br />
<br />
У всех alsa программ в качестве зависимости есть alsa-lib.<br />
<br />
== Настройка ==<br />
<br />
=== Проверка загруженных модулей ===<br />
<br />
Вы можете рассчитывать, что udev автоматически найдёт вашу звуковую карту, включая модули совместимости OSS. Вы можете проверить это с помощью следующей команды:<br />
<br />
$ lsmod|grep 'snd'<br />
snd_usb_audio 69696 0 <br />
snd_usb_lib 13504 1 snd_usb_audio<br />
snd_rawmidi 20064 1 snd_usb_lib<br />
snd_hwdep 7044 1 snd_usb_audio<br />
snd_seq_oss 29412 0 <br />
snd_seq_midi_event 6080 1 snd_seq_oss<br />
snd_seq 46220 4 snd_seq_oss,snd_seq_midi_event<br />
snd_seq_device 6796 3 snd_rawmidi,snd_seq_oss,snd_seq<br />
snd_pcm_oss 45216 0 <br />
snd_mixer_oss 15232 1 snd_pcm_oss<br />
snd_intel8x0 27932 0 <br />
snd_ac97_codec 87648 1 snd_intel8x0<br />
snd_ac97_bus 1792 1 snd_ac97_codec<br />
snd_pcm 76296 4 snd_usb_audio,snd_pcm_oss,snd_intel8x0,snd_ac97_codec<br />
snd_timer 19780 2 snd_seq,snd_pcm<br />
snd 43776 12 snd_usb_audio,snd_rawmidi,snd_hwdep,snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer<br />
snd_page_alloc 7944 2 snd_intel8x0,snd_pcm<br />
<br />
Если вывод имеет похожий вид, то ваши звуковые модули успешно обнаружились (обратите внимание, что в этом случае, snd_intel8x0 и snd_usb_audio являются драйверами для устройств). Вы также можете проверить каталог '''/dev/snd''' на правильные права:<br />
<br />
$ ls -l /dev/snd/<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
<br />
Если у вас есть хотя бы '''controlC0''' и '''pcmC0D0p''' или что-то похожее, то ваши звуковые модули обнаружились и загрузились правильно.<br />
<br />
Если это не так, то ваши модули не были обнаружены. '''Если вы хотите получить помощь на форумах или IRC, пожалуйста, введите вывод команд, использовавшихся выше.''' Для решения этой ситуации вы можете попробовать загрузить модули вручную:<br />
<br />
* Узнайте имя модуля для вашей звуковой карты: http://www.alsa-project.org/alsa-doc/ Модуль будет иметь префикс 'snd-' (например, 'snd-via82xx').<br />
* Загрузите модули:<br />
# modprobe snd-NAME-OF-MODULE<br />
# modprobe snd-pcm-oss<br />
* Проверьте файлы в '''/dev/snd''' (смотрите выше) и/или что '''alsamixer''' или '''amixer''' достаточный уровень звука.<br />
* Добавьте '''snd-NAME-OF-MODULE''' и '''snd-pcm-oss''' в список MODULES в '''/etc/rc.conf''', чтобы они загрузились в следующий раз (удостоверьтесь, что '''snd-NAME-OF-MODULE''' находится перед '''snd-pcm-oss''').<br />
<br />
=== Выставление звука на каналах и проверка звуковой карты ===<br />
<br />
В этом разделе мы подразумеваем, что вы выполняете команды от суперпользователя. Если вы хотите выполнять эти шаги от пользователя, то перейдите сначала к следующей секции, ''Настройка прав доступа''.<br />
<br />
* Включение звука<br />
<br />
Рекомендуется использовать 'alsamixer' для настройки вашего микшера и включения звука на каналах.<br><br />
'''ОБРАТИТЕ ВНИМАНИЕ:''' когда вы используете '''alsamixer''', включите звук нажатием '''M''', а не только повысьте уровень звука.<br />
'''ОБРАТИТЕ ВНИМАНИЕ:''' при использовании amixer для выставления уровня громкости следует использовать знак процента %. '''amixer''' понимает знак процента (%), а не числа. <br />
<br />
# amixer set Master 90% unmute<br />
# amixer set PCM 85% unmute<br />
<br />
* Попробуйте проиграть wav-файл:<br />
<br />
# aplay mywav.wav<br />
<br />
'''ОБРАТИТЕ ВНИМАНИЕ:''' на некоторых карточках (как минимум, на Soundblaster Audigy LS) требуется отключить или заглушить цифровой выход, чтобы слушать аналоговый звук.<br />
<br />
* [[Allow multiple programs to play sound at once|Как разрешить нескольким программам выводить звук одновременно]]<br />
<br />
=== Настройка прав ===<br />
<br />
Для того чтобы можно было пользоваться звуковой картой пользователем, проделайте следующие шаги:<br />
<br />
* Добавьте пользователя в группу audio:<br />
# gpasswd -a USERNAME audio<br />
<br />
* Выйдите пользователем из системы и войдите заново.<br />
<br />
=== Восстановление звуковых настроек при загрузке ===<br />
<br />
* Запустите 'alsactl' один раз, чтобы создать '/etc/asound.state':<br />
<br />
alsactl store<br />
<br />
* Отредактируйте '/etc/rc.conf' и добавьте 'alsa' в список демонов, загружающихся при старте системы. Это позволит сохранять настройки микшера при каждом выключении системы и восстанавливать их при загрузке.<br />
<br />
=== Настройка вывода через SPDIF ===<br />
<br />
(от gralves с форумов Gentoo)<br />
* В GNOME Volume Control, во вкладке Options, измените IEC958 на PCM. Эта опция может быть включена в настройках.<br />
* Если у вас не установлен GNOME Volume Control: <br />
** Отредактируйте файл /etc/asound.state. В нём хранятся alsasound хранит настройки вашего микшера.<br />
** Найдите строчку вида: 'IEC958 Playback Switch'. Рядом с ней вы найдёте строчку типа <code>value:false</code>. Измените её на <code>value:true</code>.<br />
** Теперь найдите строчку 'IEC958 Playback AC97-SPSA' и измените её значение на 0. <br />
** Перезапустите alsa.<br />
<br />
Есть другой способ включить вывод через SPDIF автоматически при загрузке системы (проверено на SoundBlaster Audigy):<br />
* добавьте следующие строчки в /etc/rc.local:<br />
<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
Вы можете увидеть имя цифрового выхода вашей карты с помощью:<br />
<br />
amixer scontrols<br />
<br />
=== KDE ===<br />
* Запустите KDE:<br />
$ startx<br />
<br />
* Установите предпочитаемый уровень звука (у каждого пользователя сои настройки):<br />
$ alsamixer<br />
<br />
* <b>KDE 3.5</b>. Зайдите в K Menu -> Multimedia -> KMix<br />
** Выберите Settings > Configure KMix...<br />
** Выключите опцию "Restore volumes on login"<br />
** Нажмите OK. Теперь ваш уровень звука будет одинаковым как в командной строке, так и в KDE.<br />
<br />
== Проблемы ==<br />
=== Если у вас всё ещё нет звука ===<br />
<br />
Даже если ваши драйвера установлены корректно, выставлен правильный уровень звука, ничего не выключено, вы можете ничего не слышать! Добавление следующей строчки к <code>/etc/modprobe.d/modprobe.conf</code> решает эту проблемы (по крайней мере для модуля <code>via82xx</code>):<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
=== Плохое качество звука ===<br />
<br />
Если качество звука у вас плохое, можете попробовать выставить такой уровень PCM (в alsamixer), чтобы gain был равен 0.</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166436ArchWiki:Sandbox2011-10-19T08:41:35Z<p>Zunguguzunguzeng: </p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
'''ALSA''' уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью '''ALSA'''. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после следующего входа в систему.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звук из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'', если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} (сделанный в ''ncurses'') (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорят о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы ''Master'' и ''PCM'' с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB (его уровень можно увидеть левом верхнем углу: {{Codeline|Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, для других карточек они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' осуществляется кнопкой {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Измените Change -c в соответствии со своей аудиосистемой. Для системы 7.1 используйте ''-c 8'':<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
Если не работает, читайте [[#Настройка]] и [[#Поиск проблем]], чтобы разобраться.<br />
<br />
Если всё получилось, то осталось лишь сохранить настройки микшера:<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
Этой командой создаётся файл {{Filename|/var/lib/alsa/asound.state}}, содержащий установки ''alsamixer''а.<br />
<br />
Потом добавьте демон ''alsa'' в секцию ''DAEMONS'' файла {{Filename|/etc/rc.conf}}, чтобы микшер автоматически восстанавливал значения при загрузке:<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|демон ''alsa'' просто восстанавливает настройки каналов, читая их из {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Настройка==<br />
{{poor writing}}<br />
Если вы так ничего не слышите, то проверьте ещё раз настройки микшера, и попробуйте запустить ''alsaconf'' от имени ''root'':<br />
# alsaconf<br />
<br />
Все необходимые модули ''udev'' должен определить и подгрузить автоматически. Особых настроек потребоваться не должно, (если только для карт ''ISA'').<br />
{{Warning|Не используйте ''alsaconf'' если у вас звуковая карта ''PCI'' или ''ISAPNP'', так как записи в ''modprobe.conf'', которые делает ''alsaconf'', могут нарушить автоопределение ''udev''а.}}<br />
===Установка дефолтной звуковой карты===<br />
====В окружении ядра====<br />
Чтобы предотвратить конфликты другого оборудования со звуковой картой, узнайте название модели: [http://linux.die.net/man/8/lspci lspci(8)], и названия модулей ''ALSA'' с помощью ''ls'':<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Или лучше (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====Пользовательский способ====<br />
Этот способ не требует прав администратора, изменения делаются от имени простого пользователя, и вступают в силу сразу после перезапуска приложения.<br />
<br />
В файле {{Filename|/usr/share/alsa/alsa.conf}} содержится список настроек, которые ''alsa'' применяет по умолчанию. Он может быть переписан в файл {{Filename|~/.asoundrc}}.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
Опции 'pcm' определяют какая именно карта будет использоваться для воспроизведения звука. В свою очередь опции 'ctl' определяют какую карту будут использовать программы управления, такие как ''alsamixer'', ''amixer'' итп.<br />
<br />
Чтобы выяснить какие цифры какое устройство обозначают, используйте {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Как узнать, загрузились ли модули===<br />
<br />
Допустим, что ''udev'' определил устройства правильно, вы можете это проверить:<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
Если вывод команды схож с приведённым выше, значит звуковые драйвера успешно определились.<br />
{{Note|Начиная с {{Codeline|udev>&#61;171}}, ''OSS'' модули ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются по умолчанию, это надо сделать вручную: {{Codeline|modprobe}} и/или добавьте их в секцию {{Codeline|MODULES}}, в [[rc.conf|{{Filename|/etc/rc.conf}}]], если необходимо.}}<br />
<br />
Вам также возможно захочется заглянуть в папку '''/dev/snd''', чтобы просмотреть названия файлов устройств:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|При обращении за помощью в ''IRC'', или на форумы, пишите вывод этих команд.}}<br />
<br />
если у вас присутствуют по крайней мере устройства '''controlC0''' и '''pcmC0D0p''' или аналоги, значит звуковые модули определены и загружены правильно.<br />
<br />
В случае, если модули определились неправильно, можете попробовать загрузить их вручную:<br />
<br />
* Найдите модуль для своей звуковой карты здесь: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix], перед названием модуля нужно поставить 'snd-' (например: 'snd-via82xx').<br />
* Загрузите модули:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Сверьтесь с файлами устройств в '''/dev/snd''' (см. выше) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166435ArchWiki:Sandbox2011-10-19T08:00:39Z<p>Zunguguzunguzeng: </p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
'''ALSA''' уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью '''ALSA'''. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после следующего входа в систему.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звук из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'', если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} (сделанный в ''ncurses'') (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорят о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы ''Master'' и ''PCM'' с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB,<br />
его уровень можно увидеть левом верхнем углу {{Codeline|Item: Master [dB gain: 0,00, 0,00]}}. Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, так что они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' по кнопке {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Изменяя Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
Если не работает, читайте [[#Configuration]] и [[#Troubleshooting]], чтобы разобраться.<br />
<br />
Если всё получилось, то осталось лишь сохранить настройки микшера:<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
Этой командой создаётся файл {{Filename|/var/lib/alsa/asound.state}}, содержащий установки ''alsamixer''а.<br />
<br />
Потом добавьте демон ''alsa'' в секцию ''DAEMONS'' файла {{Filename|/etc/rc.conf}}, чтобы микшер автоматически восстанавливал свои значения при загрузке:<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|демон ''alsa'' просто восстанавливает настройки каналов, читая их из {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Настройка==<br />
{{poor writing}}<br />
Если вы так ничего не слышите, то проверьте ещё раз настройки микшера, и попробуйте запустить ''alsaconf'' от имени ''root''а:<br />
# alsaconf<br />
<br />
Все необходимые модули ''udev'' должен определить и подгрузить автоматически. Особых настроек потребоваться не должно, если только под карточку ''ISA''.<br />
{{Warning|Не используйте ''alsaconf'' если у вас звуковая карта ''PCI'' или ''ISAPNP'', так как записи в ''modprobe.conf'', которые делает ''alsaconf'', могут остановить автоопределение ''udev''а.}}<br />
===Установка дефолтной звуковой карты===<br />
====В окружении ядра====<br />
Чтобы предотвратить конфликты другого оборудования со звуковой картой, узнайте название модели: [http://linux.die.net/man/8/lspci lspci(8)], и названия модулей ''ALSA'' с помощью ''ls'':<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Или лучше (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====Пользовательский способ====<br />
Этот способ не требует прав администратора, изменения делаются от имени пользователя, и вступают в силу сразу после рестарта приложения.<br />
<br />
В файле {{Filename|/usr/share/alsa/alsa.conf}} содержится список настроек, которые ''alsa'' применяет по умолчанию. Он может быть переписан в файл {{Filename|~/.asoundrc}}.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
Опции 'pcm' влияют какая именно карта будет использоваться для воспроизведения звука. В свою очередь опции 'ctl' определяют какую карту будут использовать программы управления, такие как ''alsamixer'', ''amixer'' итп.<br />
<br />
Чтобы выяснить какие цифры какое устройство обозначают, используйте {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Как узнать, загрузились ли модули===<br />
<br />
Допустим, что ''udev'' определил устройства правильно, вы можете это проверить:<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
Если вывод команды схож с приведённым выше, значит звуковые драйвера успешно определились.<br />
{{Note|Начиная с {{Codeline|udev>&#61;171}}, ''OSS'' модули ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются по умолчанию, это надо сделать вручную: {{Codeline|modprobe}} и/или добавьте их в секцию {{Codeline|MODULES}}, в [[rc.conf|{{Filename|/etc/rc.conf}}]], если необходимо.}}<br />
<br />
Вам также возможно захочется заглянуть в папку '''/dev/snd''' за файлами устройств:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166434ArchWiki:Sandbox2011-10-19T07:59:13Z<p>Zunguguzunguzeng: </p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
'''ALSA''' уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью '''ALSA'''. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после следующего входа в систему.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звук из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'', если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} (сделанный в ''ncurses'') (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорят о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы ''Master'' и ''PCM'' с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB,<br />
его уровень можно увидеть левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}. Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, так что они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' по кнопке {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Изменяя Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
Если не работает, читайте [[#Configuration]] и [[#Troubleshooting]], чтобы разобраться.<br />
<br />
Если всё получилось, то осталось лишь сохранить настройки микшера:<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
Этой командой создаётся файл {{Filename|/var/lib/alsa/asound.state}}, содержащий установки ''alsamixer''а.<br />
<br />
Потом добавьте демон ''alsa'' в секцию ''DAEMONS'' файла {{Filename|/etc/rc.conf}}, чтобы микшер автоматически восстанавливал свои значения при загрузке:<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|демон ''alsa'' просто восстанавливает настройки каналов, читая их из {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Настройка==<br />
{{poor writing}}<br />
Если вы так ничего не слышите, то проверьте ещё раз настройки микшера, и попробуйте запустить ''alsaconf'' от имени ''root''а:<br />
# alsaconf<br />
<br />
Все необходимые модули ''udev'' должен определить и подгрузить автоматически. Особых настроек потребоваться не должно, если только под карточку ''ISA''.<br />
{{Warning|Не используйте ''alsaconf'' если у вас звуковая карта ''PCI'' или ''ISAPNP'', так как записи в ''modprobe.conf'', которые делает ''alsaconf'', могут остановить автоопределение ''udev''а.}}<br />
===Установка дефолтной звуковой карты===<br />
====В окружении ядра====<br />
Чтобы предотвратить конфликты другого оборудования со звуковой картой, узнайте название модели: [http://linux.die.net/man/8/lspci lspci(8)], и названия модулей ''ALSA'' с помощью ''ls'':<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Или лучше (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====Пользовательский способ====<br />
Этот способ не требует прав администратора, изменения делаются от имени пользователя, и вступают в силу сразу после рестарта приложения.<br />
<br />
В файле {{Filename|/usr/share/alsa/alsa.conf}} содержится список настроек, которые ''alsa'' применяет по умолчанию. Он может быть переписан в файл {{Filename|~/.asoundrc}}.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
Опции 'pcm' влияют какая именно карта будет использоваться для воспроизведения звука. В свою очередь опции 'ctl' определяют какую карту будут использовать программы управления, такие как ''alsamixer'', ''amixer'' итп.<br />
<br />
Чтобы выяснить какие цифры какое устройство обозначают, используйте {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Как узнать, загрузились ли модули===<br />
<br />
Допустим, что ''udev'' определил устройства правильно, вы можете это проверить:<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
Если вывод команды схож с приведённым выше, значит звуковые драйвера успешно определились.<br />
{{Note|Начиная с {{Codeline|udev>&#61;171}}, ''OSS'' модули ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются по умолчанию, это надо сделать вручную: {{Codeline|modprobe}} и/или добавьте их в секцию {{Codeline|MODULES}}, в [[rc.conf|{{Filename|/etc/rc.conf}}]], если необходимо.}}<br />
<br />
Вам также возможно захочется заглянуть в папку '''/dev/snd''' за файлами устройств:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166433ArchWiki:Sandbox2011-10-19T07:53:42Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
'''ALSA''' уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью '''ALSA'''. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после следующего входа в систему.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звук из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'', если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB.<br />
(В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, так что они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' по кнопке {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Изменяя Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
Если не работает, читайте [[#Configuration]] и [[#Troubleshooting]], чтобы разобраться.<br />
<br />
Если всё получилось, то осталось лишь сохранить настройки микшера:<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
Этой командой создаётся файл {{Filename|/var/lib/alsa/asound.state}}, содержащий установки ''alsamixer''а.<br />
<br />
Потом добавьте демон ''alsa'' в секцию ''DAEMONS'' файла {{Filename|/etc/rc.conf}}, чтобы микшер автоматически восстанавливал свои значения при загрузке:<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|демон ''alsa'' просто восстанавливает настройки каналов, читая их из {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Настройка==<br />
{{poor writing}}<br />
Если вы так ничего не слышите, то проверьте ещё раз настройки микшера, и попробуйте запустить ''alsaconf'' от имени ''root''а:<br />
# alsaconf<br />
<br />
Все необходимые модули ''udev'' должен определить и подгрузить автоматически. Особых настроек потребоваться не должно, если только под карточку ''ISA''.<br />
{{Warning|Не используйте ''alsaconf'' если у вас звуковая карта ''PCI'' или ''ISAPNP'', так как записи в ''modprobe.conf'', которые делает ''alsaconf'', могут остановить автоопределение ''udev''а.}}<br />
===Установка дефолтной звуковой карты===<br />
====В окружении ядра====<br />
Чтобы предотвратить конфликты другого оборудования со звуковой картой, узнайте название модели: [http://linux.die.net/man/8/lspci lspci(8)], и названия модулей ''ALSA'' с помощью ''ls'':<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Или лучше (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====Пользовательский способ====<br />
Этот способ не требует прав администратора, изменения делаются от имени пользователя, и вступают в силу сразу после рестарта приложения.<br />
<br />
В файле {{Filename|/usr/share/alsa/alsa.conf}} содержится список настроек, которые ''alsa'' применяет по умолчанию. Он может быть переписан в файл {{Filename|~/.asoundrc}}.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
Опции 'pcm' влияют какая именно карта будет использоваться для воспроизведения звука. В свою очередь опции 'ctl' определяют какую карту будут использовать программы управления, такие как ''alsamixer'', ''amixer'' итп.<br />
<br />
Чтобы выяснить какие цифры какое устройство обозначают, используйте {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Как узнать, загрузились ли модули===<br />
<br />
Допустим, что ''udev'' определил устройства правильно, вы можете это проверить:<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
Если вывод команды схож с приведённым выше, значит звуковые драйвера успешно определились.<br />
{{Note|Начиная с {{Codeline|udev>&#61;171}}, ''OSS'' модули ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются по умолчанию, это надо сделать вручную: {{Codeline|modprobe}} и/или добавьте их в секцию {{Codeline|MODULES}}, в [[rc.conf|{{Filename|/etc/rc.conf}}]], если необходимо.}}<br />
<br />
Вам также возможно захочется заглянуть в папку '''/dev/snd''' за файлами устройств:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166323ArchWiki:Sandbox2011-10-17T16:34:26Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB.<br />
(В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, так что они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' по кнопке {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Изменяя Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
Если не работает, читайте [[#Configuration]] и [[#Troubleshooting]], чтобы разобраться.<br />
<br />
Если всё получилось, то осталось лишь сохранить настройки микшера:<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
Этой командой создаётся файл {{Filename|/var/lib/alsa/asound.state}}, содержащий установки ''alsamixer''а.<br />
<br />
Потом добавьте демон ''alsa'' в секцию ''DAEMONS'' файла {{Filename|/etc/rc.conf}}, чтобы микшер автоматически восстанавливал свои значения при загрузке:<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|демон ''alsa'' просто восстанавливает настройки каналов, читая их из {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Настройка==<br />
{{poor writing}}<br />
Если вы так ничего не слышите, то проверьте ещё раз настройки микшера, и попробуйте запустить ''alsaconf'' от имени ''root''а:<br />
# alsaconf<br />
<br />
Все необходимые модули ''udev'' должен определить и подгрузить автоматически. Особых настроек потребоваться не должно, если только под карточку ''ISA''.<br />
{{Warning|Не используйте ''alsaconf'' если у вас звуковая карта ''PCI'' или ''ISAPNP'', так как записи в ''modprobe.conf'', которые делает ''alsaconf'', могут остановить автоопределение ''udev''а.}}<br />
===Установка дефолтной звуковой карты===<br />
====В окружении ядра====<br />
Чтобы предотвратить конфликты другого оборудования со звуковой картой, узнайте название модели: [http://linux.die.net/man/8/lspci lspci(8)], и названия модулей ''ALSA'' с помощью ''ls'':<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Или лучше (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====Пользовательский способ====<br />
Этот способ не требует прав администратора, изменения делаются от имени пользователя, и вступают в силу сразу после рестарта приложения.<br />
<br />
В файле {{Filename|/usr/share/alsa/alsa.conf}} содержится список настроек, которые ''alsa'' применяет по умолчанию. Он может быть переписан в файл {{Filename|~/.asoundrc}}.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
Опции 'pcm' влияют какая именно карта будет использоваться для воспроизведения звука. В свою очередь опции 'ctl' определяют какую карту будут использовать программы управления, такие как ''alsamixer'', ''amixer'' итп.<br />
<br />
Чтобы выяснить какие цифры какое устройство обозначают, используйте {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Как узнать, загрузились ли модули===<br />
<br />
Допустим, что ''udev'' определил устройства правильно, вы можете это проверить:<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
Если вывод команды схож с приведённым выше, значит звуковые драйвера успешно определились.<br />
{{Note|Начиная с {{Codeline|udev>&#61;171}}, ''OSS'' модули ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются по умолчанию, это надо сделать вручную: {{Codeline|modprobe}} и/или добавьте их в секцию {{Codeline|MODULES}}, в [[rc.conf|{{Filename|/etc/rc.conf}}]], если необходимо.}}<br />
<br />
Вам также возможно захочется заглянуть в папку '''/dev/snd''' за файлами устройств:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166322ArchWiki:Sandbox2011-10-17T16:25:13Z<p>Zunguguzunguzeng: remake of alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB.<br />
(В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, так что они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' по кнопке {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Изменяя Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
Если не работает, читайте [[#Configuration]] и [[#Troubleshooting]], чтобы разобраться.<br />
<br />
Если всё получилось, то осталось лишь сохранить настройки микшера:<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
Этой командой создаётся файл {{Filename|/var/lib/alsa/asound.state}}, содержащий установки ''alsamixer''а.<br />
<br />
Потом добавьте демон ''alsa'' в секцию ''DAEMONS'' файла {{Filename|/etc/rc.conf}}, чтобы микшер автоматически восстанавливал свои значения при загрузке:<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|демон ''alsa'' просто восстанавливает настройки каналов, читая их из {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Настройка==<br />
{{poor writing}}<br />
Если вы так ничего не слышите, то проверьте ещё раз настройки микшера, и попробуйте запустить ''alsaconf'' от имени ''root''а:<br />
# alsaconf<br />
<br />
Все необходимые модули ''udev'' должен определить и подгрузить автоматически. Особых настроек потребоваться не должно, если только под карточку ''ISA''.<br />
{{Warning|Не используйте ''alsaconf'' если у вас звуковая карта ''PCI'' или ''ISAPNP'', так как записи в ''modprobe.conf'', которые делает ''alsaconf'', могут остановить автоопределение ''udev''а.}}<br />
===Установка дефолтной звуковой карты===<br />
====В окружении ядра====<br />
Чтобы предотвратить конфликты другого оборудования со звуковой картой, узнайте название модели: [http://linux.die.net/man/8/lspci lspci(8)], и названия модулей ''ALSA'' с помощью ''ls'':<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Или лучше (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====Пользовательский способ====<br />
Этот способ не требует прав администратора, изменения делаются от имени пользователя, и вступают в силу сразу после рестарта приложения.<br />
<br />
В файле {{Filename|/usr/share/alsa/alsa.conf}} содержится список настроек, которые ''alsa'' применяет по умолчанию. Он может быть переписан в файл {{Filename|~/.asoundrc}}.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
Опции 'pcm' влияют какая именно карта будет использоваться для воспроизведения звука. В свою очередь опции 'ctl' определяют какую карту будут использовать программы управления, такие как ''alsamixer'', ''amixer'' итп.<br />
<br />
Чтобы выяснить какие цифры какое устройство обозначают, используйте {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Как узнать, загрузились ли модули===<br />
<br />
Допустим, что ''udev'' определил устройства правильно, вы можете это проверить:<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
Если вывод команды схож с приведённым выше, значит звуковые драйвера успешно определились.<br />
{{Note|Начиная с {{Codeline|udev>&#61;171}}, ''OSS'' модули ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются по умолчанию, это надо сделать вручную: {{Codeline|modprobe}} и/или добавьте их в секцию {{Codeline|MODULES}}, в [[rc.conf|{{Filename|/etc/rc.conf}}]], если необходимо.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166313ArchWiki:Sandbox2011-10-17T16:04:18Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB.<br />
(В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, так что они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' по кнопке {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Изменяя Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
Если не работает, читайте [[#Configuration]] и [[#Troubleshooting]], чтобы разобраться.<br />
<br />
Если всё получилось, то осталось лишь сохранить настройки микшера:<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
Этой командой создаётся файл {{Filename|/var/lib/alsa/asound.state}}, содержащий установки ''alsamixer''а.<br />
<br />
Потом добавьте демон ''alsa'' в секцию ''DAEMONS'' файла {{Filename|/etc/rc.conf}}, чтобы микшер автоматически восстанавливал свои значения при загрузке:<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|демон ''alsa'' просто восстанавливает настройки каналов, читая их из {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Настройка==<br />
{{poor writing}}<br />
Если вы так ничего не слышите, то проверьте ещё раз настройки микшера, и попробуйте запустить ''alsaconf'' от имени ''root''а:<br />
# alsaconf<br />
<br />
Все необходимые модули ''udev'' должен определить и подгрузить автоматически. Особых настроек потребоваться не должно, если только под карточку ''ISA''.<br />
{{Warning|Не используйте ''alsaconf'' если у вас звуковая карта ''PCI'' или ''ISAPNP'', так как записи в ''modprobe.conf'', которые делает ''alsaconf'', могут остановить автоопределение ''udev''а.}}<br />
===Установка дефолтной звуковой карты===<br />
====В окружении ядра====<br />
Чтобы предотвратить конфликты другого оборудования со звуковой картой, узнайте название модели: [http://linux.die.net/man/8/lspci lspci(8)], и названия модулей ''ALSA'' с помощью ''ls'':<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Или лучше (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====Пользовательский способ====<br />
Этот способ не требует прав администратора, изменения делаются от имени пользователя, и вступают в силу сразу после рестарта приложения.<br />
<br />
В файле {{Filename|/usr/share/alsa/alsa.conf}} содержится список настроек, которые ''alsa'' применяет по умолчанию. Он может быть переписан в файл {{Filename|~/.asoundrc}}.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
Опции 'pcm' влияют какая именно карта будет использоваться для воспроизведения звука. В свою очередь опции 'ctl' определяют какую карту будут использовать программы управления, такие как ''alsamixer'', ''amixer'' итп.<br />
<br />
Чтобы выяснить какие цифры какое устройство обозначают, используйте {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166310ArchWiki:Sandbox2011-10-17T15:24:42Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB.<br />
(В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, так что они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' по кнопке {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Изменяя Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Настройка==<br />
{{poor writing}}<br />
Если вы так ничего не слышите, то проверьте ещё раз настройки микшера, и попробуйте запустить ''alsaconf'' от имени ''root''а:<br />
# alsaconf<br />
<br />
Все необходимые модули ''udev'' должен определить и подгрузить автоматически. Особых настроек потребоваться не должно, если только под карточку ''ISA''.<br />
{{Warning|Не используйте ''alsaconf'' если у вас звуковая карта ''PCI'' или ''ISAPNP'', так как записи в ''modprobe.conf'', которые делает ''alsaconf'', могут остановить автоопределение ''udev''а.}}<br />
===Установка дефолтной звуковой карты===<br />
====В окружении ядра====<br />
Чтобы предотвратить конфликты другого оборудования со звуковой картой, узнайте название модели: [http://linux.die.net/man/8/lspci lspci(8)], и названия модулей ''ALSA'' с помощью ''ls'':<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Или лучше (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====Пользовательский способ====<br />
Этот способ не требует прав администратора, изменения делаются от имени пользователя, и вступают в силу сразу после рестарта приложения.<br />
<br />
В файле {{Filename|/usr/share/alsa/alsa.conf}} содержится список настроек, которые ''alsa'' применяет по умолчанию. Он может быть переписан в файл {{Filename|~/.asoundrc}}.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
Опции 'pcm' влияют какая именно карта будет использоваться для воспроизведения звука. В свою очередь опции 'ctl' определяют какую карту будут использовать программы управления, такие как ''alsamixer'', ''amixer'' итп.<br />
<br />
Чтобы выяснить какие цифры какое устройство обозначают, используйте {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166283ArchWiki:Sandbox2011-10-17T12:19:35Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB.<br />
(В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
Для 5.1 или 7.1 surround надо включить остальные каналы, такие как: Front, Surround, Center, LFE (subwoofer) и Side (это названия каналов Intel HD Audio, так что они могут отличаться). Здесь надо заметить, что таким образом качество обычного стерео повышено не будет (как повысить качество читай [[#Upmixing/Downmixing]]).<br />
<br />
Выход из ''alsamixer'' по кнопке {{Keypress|Esc}}.<br />
<br />
{{Note|У некоторых карточек должен быть выключен digital output, чтобы услышать аналоговый звук. Для Soundblaster Audigy LS надо отключать IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|У некоторых машин, (таких как Thinkpad T61), есть канал ''Speaker'', его нужно включить и прибавить.}}<br />
<br />
{{Note|У некоторых машин также приходится включать каналы ''Front'' и ''Headphone''.}}<br />
<br />
Дальше проверка, как работает/не работает звук:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Изменяя Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166276ArchWiki:Sandbox2011-10-17T11:33:25Z<p>Zunguguzunguzeng: /* Включение каналов */ {{Codeline:Item: Master [dB gain: 0,00, 0,00]}} one line</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB.<br />
(В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166274ArchWiki:Sandbox2011-10-17T11:30:42Z<p>Zunguguzunguzeng: /* Включение звука каналов */ -звука</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB. (В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166273ArchWiki:Sandbox2011-10-17T11:29:57Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение звука каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}}, и увеличьте громкость, чтобы ''gain'' стал 0dB. (В левом верхнем углу {{Codeline:Item: Master [dB gain: 0,00, 0,00]}}). Больший уровень ''gain'' может стать причиной искажений и шума.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166262ArchWiki:Sandbox2011-10-17T10:13:06Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение звука каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в интерфейсе на ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
Буквы "MM" под обозначением канала говорит о том, что канал заглушен, а "00" о том, что включен.<br />
<br />
Включите каналы Master и PCM с помощью стрелок на клавиатуре, и клавиши {{keypress|M}}. Используйте клавишу {{keypress|↑}} key to increase the volume and obtain a value of zero dB gain. The gain may be found in the upper left next to the 'Item:' field. Higher values of gain will produce distorted sound.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166260ArchWiki:Sandbox2011-10-17T09:59:17Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Установите пакет ''alsa-oss'' если хотите, чтобы ваши OSS-приложения работали с ''dmix'' (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|С версии {{Codeline|udev>&#61;171}}, модули эмуляции OSS ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) не загружаются автоматически по умолчанию.}}<br />
Установите пакет ''alsa-plugins'' если вам нужны [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] и другие дополнительные программы:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Включение звука каналов==<br />
Текущая версия ALSA устанавливается с '''заглушенными по умолчанию''' каналами. Включать каналы нужно вручную.<br />
<br />
Для этого прекрасно подойдёт {{Codeline|alsamixer}} в интерфейсе на ''ncurses'' (либо можно использовать ''amixer'' из командной строки):<br />
{{Cli|$ alsamixer}}<br />
<br />
The label "MM" below a channel indicates that the channel is muted, and "00" indicates that it is open.<br />
<br />
Unmute the Master and PCM channels by scrolling to them with cursor left/right and pressing {{keypress|M}}. Use the {{keypress|↑}} key to increase the volume and obtain a value of zero dB gain. The gain may be found in the upper left next to the 'Item:' field. Higher values of gain will produce distorted sound.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166259ArchWiki:Sandbox2011-10-17T09:31:46Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя пользовательскую библиотеку для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Пользователи должны состоять в группе ''audio'', чтобы воспроизводить звук с помощью ALSA. Для добавления пользователя в группу ''audio'' можно воспользоваться следующей командой:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|Изменения вступят в силу только после того, как пользователь вновь залогинится в системе.}}<br />
<br />
===Пользовательские утилиты===<br />
Пакет ''alsa-utils'' включает в себя программу ''alsamixer'', которая позволяет настраивать звуковое устройство из консоли, или терминала. Устанавливается с помощью ''pacman'':<br />
{{Cli|# pacman -S alsa-utils}}<br />
Install the alsa-oss package if you want OSS applications to work with dmix (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not automatically loaded by default.}}<br />
Install the alsa-plugins package if you want [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] and other advanced features:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Unmuting the channels==<br />
The current version of ALSA installs with all channels '''muted by default'''. You will need to unmute the channels manually.<br />
<br />
It is easiest to use {{Codeline|alsamixer}} ncurses UI to accomplish this (alternatively, use amixer from the commandline):<br />
{{Cli|$ alsamixer}}<br />
<br />
The label "MM" below a channel indicates that the channel is muted, and "00" indicates that it is open.<br />
<br />
Unmute the Master and PCM channels by scrolling to them with cursor left/right and pressing {{keypress|M}}. Use the {{keypress|↑}} key to increase the volume and obtain a value of zero dB gain. The gain may be found in the upper left next to the 'Item:' field. Higher values of gain will produce distorted sound.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166258ArchWiki:Sandbox2011-10-17T09:19:36Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя библиотеку пользовательского пространства для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Установка==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev автоматически проверит оборудование, загрузив соответствующий вашей звуковой карте модуль ядра. Так что звук уже должен работать, просто по умолчанию все каналы заглушены.<br />
<br />
Users must be in the audio group to play sound with ALSA. To add a user to the audio group, use the following command:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|This will not take effect until the user logs back in.}}<br />
<br />
===User-space utilities===<br />
The alsa-utils package contains the alsamixer userspace tool, which allows configuration of the sound device from the console or terminal. Install it with pacman:<br />
{{Cli|# pacman -S alsa-utils}}<br />
Install the alsa-oss package if you want OSS applications to work with dmix (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not automatically loaded by default.}}<br />
Install the alsa-plugins package if you want [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] and other advanced features:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Unmuting the channels==<br />
The current version of ALSA installs with all channels '''muted by default'''. You will need to unmute the channels manually.<br />
<br />
It is easiest to use {{Codeline|alsamixer}} ncurses UI to accomplish this (alternatively, use amixer from the commandline):<br />
{{Cli|$ alsamixer}}<br />
<br />
The label "MM" below a channel indicates that the channel is muted, and "00" indicates that it is open.<br />
<br />
Unmute the Master and PCM channels by scrolling to them with cursor left/right and pressing {{keypress|M}}. Use the {{keypress|↑}} key to increase the volume and obtain a value of zero dB gain. The gain may be found in the upper left next to the 'Item:' field. Higher values of gain will produce distorted sound.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166257ArchWiki:Sandbox2011-10-17T09:14:12Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя библиотеку пользовательского пространства для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|Другое звуковое окружение можно найти на странице [[Open Sound System]].}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Использование, настройка и решение проблем в ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Installation==<br />
ALSA уже включена в ядро Арча по умолчанию, как набор модулей, так что в установке нет необходимости.<br />
<br />
udev will automatically probe your hardware at boot, loading the corresponding kernel module for your audio card. Therefore, your sound should already be working, but upstream sources mute all channels by default.<br />
<br />
Users must be in the audio group to play sound with ALSA. To add a user to the audio group, use the following command:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|This will not take effect until the user logs back in.}}<br />
<br />
===User-space utilities===<br />
The alsa-utils package contains the alsamixer userspace tool, which allows configuration of the sound device from the console or terminal. Install it with pacman:<br />
{{Cli|# pacman -S alsa-utils}}<br />
Install the alsa-oss package if you want OSS applications to work with dmix (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not automatically loaded by default.}}<br />
Install the alsa-plugins package if you want [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] and other advanced features:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Unmuting the channels==<br />
The current version of ALSA installs with all channels '''muted by default'''. You will need to unmute the channels manually.<br />
<br />
It is easiest to use {{Codeline|alsamixer}} ncurses UI to accomplish this (alternatively, use amixer from the commandline):<br />
{{Cli|$ alsamixer}}<br />
<br />
The label "MM" below a channel indicates that the channel is muted, and "00" indicates that it is open.<br />
<br />
Unmute the Master and PCM channels by scrolling to them with cursor left/right and pressing {{keypress|M}}. Use the {{keypress|↑}} key to increase the volume and obtain a value of zero dB gain. The gain may be found in the upper left next to the 'Item:' field. Higher values of gain will produce distorted sound.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166255ArchWiki:Sandbox2011-10-17T09:10:19Z<p>Zunguguzunguzeng: recreating alsa page</p>
<hr />
<div>[[Category:Audio/Video (Русский)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
<br />
<br />
[[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') это компонент ядра, призванный заменить оригинальную Open Sound System (OSSv3) в предоставлении драйверов звуковым картам. Помимо драйверов звуковых устройств, '''ALSA''' также включает в себя библиотеку пользовательского пространства для разработчиков приложений, которые хотели бы использовать возможности драйвера с API более высокого уровня чем простое взаимодействие с драйвером ядра.<br />
<br />
{{Note|For an alternative sound environment, see the [[Open Sound System]] page.}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Using, configuring and troubleshooting ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Installation==<br />
ALSA is included in the default Arch kernel as a set of modules, so installing it is not necessary.<br />
<br />
udev will automatically probe your hardware at boot, loading the corresponding kernel module for your audio card. Therefore, your sound should already be working, but upstream sources mute all channels by default.<br />
<br />
Users must be in the audio group to play sound with ALSA. To add a user to the audio group, use the following command:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|This will not take effect until the user logs back in.}}<br />
<br />
===User-space utilities===<br />
The alsa-utils package contains the alsamixer userspace tool, which allows configuration of the sound device from the console or terminal. Install it with pacman:<br />
{{Cli|# pacman -S alsa-utils}}<br />
Install the alsa-oss package if you want OSS applications to work with dmix (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not automatically loaded by default.}}<br />
Install the alsa-plugins package if you want [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] and other advanced features:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Unmuting the channels==<br />
The current version of ALSA installs with all channels '''muted by default'''. You will need to unmute the channels manually.<br />
<br />
It is easiest to use {{Codeline|alsamixer}} ncurses UI to accomplish this (alternatively, use amixer from the commandline):<br />
{{Cli|$ alsamixer}}<br />
<br />
The label "MM" below a channel indicates that the channel is muted, and "00" indicates that it is open.<br />
<br />
Unmute the Master and PCM channels by scrolling to them with cursor left/right and pressing {{keypress|M}}. Use the {{keypress|↑}} key to increase the volume and obtain a value of zero dB gain. The gain may be found in the upper left next to the 'Item:' field. Higher values of gain will produce distorted sound.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166254ArchWiki:Sandbox2011-10-17T09:02:53Z<p>Zunguguzunguzeng: </p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
{{i18n|Advanced Linux Sound Architecture}}<br />
[[de:Alsa]]<br />
[[fr:Alsa]]<br />
<br />
The [[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') is a Linux kernel component intended to replace the original Open Sound System (OSSv3) for providing device drivers for sound cards. Besides the sound device drivers, '''ALSA''' also bundles a user space library for application developers who want to use driver features with a higher level API than direct interaction with the kernel drivers.<br />
<br />
{{Note|For an alternative sound environment, see the [[Open Sound System]] page.}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Using, configuring and troubleshooting ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Installation==<br />
ALSA is included in the default Arch kernel as a set of modules, so installing it is not necessary.<br />
<br />
udev will automatically probe your hardware at boot, loading the corresponding kernel module for your audio card. Therefore, your sound should already be working, but upstream sources mute all channels by default.<br />
<br />
Users must be in the audio group to play sound with ALSA. To add a user to the audio group, use the following command:<br />
{{Cli|# gpasswd -a ''yourusername'' audio}}<br />
<br />
{{Note|This will not take effect until the user logs back in.}}<br />
<br />
===User-space utilities===<br />
The alsa-utils package contains the alsamixer userspace tool, which allows configuration of the sound device from the console or terminal. Install it with pacman:<br />
{{Cli|# pacman -S alsa-utils}}<br />
Install the alsa-oss package if you want OSS applications to work with dmix (software mixing):<br />
{{Cli|# pacman -S alsa-oss}}<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not automatically loaded by default.}}<br />
Install the alsa-plugins package if you want [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] and other advanced features:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
==Unmuting the channels==<br />
The current version of ALSA installs with all channels '''muted by default'''. You will need to unmute the channels manually.<br />
<br />
It is easiest to use {{Codeline|alsamixer}} ncurses UI to accomplish this (alternatively, use amixer from the commandline):<br />
{{Cli|$ alsamixer}}<br />
<br />
The label "MM" below a channel indicates that the channel is muted, and "00" indicates that it is open.<br />
<br />
Unmute the Master and PCM channels by scrolling to them with cursor left/right and pressing {{keypress|M}}. Use the {{keypress|↑}} key to increase the volume and obtain a value of zero dB gain. The gain may be found in the upper left next to the 'Item:' field. Higher values of gain will produce distorted sound.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.}}<br />
<br />
<!--Is this still true?--><br />
{{Note|Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.}}<br />
<br />
{{Note|Some machines may also require the Front and Headphone channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
{{Cli|$ speaker-test -c 2}}<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
{{Cli|$ speaker-test -c 8}}<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
If it works, you just need to save your mixer settings.<br />
{{Cli|# alsactl -f /var/lib/alsa/asound.state store}}<br />
This will create the file {{Filename|/var/lib/alsa/asound.state}}, saving the alsamixer settings.<br />
<br />
Then, add the alsa ''daemon'' to your DAEMONS section in {{Filename|/etc/rc.conf}} to automatically restore the mixer settings at boot.<br />
{{File|/etc/rc.conf|content=DAEMONS=(... '''@alsa''' ...)}}<br />
{{Note|The alsa daemon merely restores your volume mixer levels on boot up by reading {{Filename|/var/lib/alsa/asound.state}}. It is separate from the alsa audio library (and kernel level API).}}<br />
<br />
==Configuration==<br />
{{poor writing}}<br />
If you cannot hear anything, double check your mixer settings, being sure to unmute PCM, MASTER (and some machines such as the IBM Thinkpad have an additional 'SPEAKER' channel) and try the alsaconf utility as root:<br />
# alsaconf<br />
<br />
All necessary modules should be detected and loaded automatically by udev. No special configuration is required unless an ISA card is being used.<br />
{{Warning|Do not use alsaconf if you have a PCI or ISAPNP sound card, as the entries alsaconf adds to the modprobe.conf file might break udev's autodetection.}}<br />
===Set the default sound card===<br />
====In Kernel Space====<br />
Telephony-capable modems and modern graphics cards with HDMI output can conflict with the sound card for the default sound card slot. (pcspkr is another, non-ALSA PC speaker module. It will not conflict with ALSA sound cards.) To prevent this, discover your sound card model name with [http://linux.die.net/man/8/lspci lspci(8)] and your ALSA driver module names with ls(1):<br />
<br />
{{Command|ls -l /sys/module/snd/holders|total 0<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec -> ../../snd_hda_codec<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_codec_realtek -> ../../snd_hda_codec_realtek<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hda_intel -> ../../snd_hda_intel<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_hwdep -> ../../snd_hwdep<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_pcm -> ../../snd_pcm<br />
lrwxrwxrwx 1 root root 0 Apr 25 00:56 snd_timer -> ../../snd_timer}}<br />
<br />
Or better (source[http://ubuntuforums.org/showthread.php?t=205449]):<br />
$ cat /proc/asound/modules<br />
<br />
Then add the names of your sound card modules to (source[http://alsa.opensrc.org/MultipleCards#The_newer_.22slots.3D.22_method]):<br />
<br />
{{File|name=/etc/modprobe.d/alsa.conf|content=<br />
options snd slots=snd-intel8x0<br />
}}<br />
<br />
These entries ensure that the Intel 82801DB-ICH4 sound card will become card 0 and the PC speaker will become card 1.<br />
<br />
{{Note| You will need to unload all your sound modules and reload them for the changes to take effect. It might be easier to reboot. Your choice. }}<br />
{{Note| This method will NOT work if the conflicting devices use the same module. If you would prefer to not configure sound on a per user basis as in the section below, you can directly modify {{Filename|/usr/share/alsa/alsa.conf}}. For example, replace all "card 0" with "card 1" .}}<br />
<br />
====In User Space====<br />
This method does not require root permissions, is on a per-user basis, and takes effect as soon as any software has been restarted (like your media player, for example).<br />
<br />
Located in {{Filename|/usr/share/alsa/alsa.conf}} is a list of defaults that alsa uses out of the box. These can be overridden in a {{Filename|~/.asoundrc}} file.<br />
{{File|name=~/.asoundrc|content=<br />
pcm.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
ctl.!default {<br />
type hw<br />
card 1<br />
device 0<br />
}<br />
}}<br />
The 'pcm' options affect which card and device will be used for audio playback. However it is the 'ctl' option affects which card is used by control utilities like alsamixer, amixer, and the like.<br />
<br />
To find out which numbers correspond to what audio device, use {{Codeline|aplay -l}}.<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{Codeline|udev>&#61;171}}, the OSS emulation modules ({{Codeline|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: load them with {{Codeline|modprobe}} and/or add them in the {{Codeline|MODULES}} array in [[rc.conf|{{Filename|/etc/rc.conf}}]] if they are needed.}}<br />
<br />
You might also want to check the directory '''/dev/snd''' for the right device files:<br />
<br />
$ ls -l /dev/snd<br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your soundcard: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: 'snd-via82xx').<br />
* Load modules:<br />
# modprobe snd-NAME-OF-MODULE<br />
* Check for the device files in '''/dev/snd''' (see above) and/or try if '''alsamixer''' or '''amixer''' have reasonable output.<br />
* Add '''snd-NAME-OF-MODULE''' and '''snd-pcm-oss''' to the list of MODULES in {{Filename|/etc/rc.conf}} to ensure they are loaded next time (make sure '''snd-NAME-OF-MODULE''' is before '''snd-pcm-oss''').<br />
<br />
===Restore ALSA Mixer settings at startup===<br />
* Run {{Codeline|alsactl -f /var/lib/alsa/asound.state store}} once to create {{Filename|/var/lib/alsa/asound.state}}.<br />
<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
* Edit {{Filename|/etc/[[rc.conf]]}} and add {{Codeline|"alsa"}} to the list of daemons to start on boot-up. This will store the mixer settings on every shutdown and restore them when you boot.<br />
<br />
* If the mixer settings are not loaded on boot-up, add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
# alsactl -f /var/lib/alsa/asound.state restore<br />
<br />
* These methods still may not work, or you may prefer to have audio settings for individual users. In this case, run {{Codeline|alsactl store -f ~/.asoundrc}} as a normal user. This will save and restore volume settings on a per user basis. To automate this process, add the respective commands to {{Filename|~/.bash_login}} and {{Filename|~/.bash_logout}}, or the correct locations for the shell of your choice.<br />
<br />
For zsh, use {{Filename|~/.zlogin}} and {{Filename|~/.zlogout}}.<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{Filename|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=27066 alsaequal] from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# Or if you want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line.<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
<br />
Then Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
not sure if this is really needed - more important is to shut down all applications using ALSA...<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in '''$HOME/.alsaequal.bin'''.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or eg. you can make symlink to your '''.alsaequal.bin''' in his home...<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
* You will need, in addition to the aforementioned userspace utilities, alsa-plugins.<br />
# pacman -S alsa-plugins<br />
* Get the ladspa and swh-plugins packages too if you do not already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you have not already created either an {{Filename|~/.asoundrc}} or a {{Filename|/etc/asound.conf}} file, then create either one<br />
$ vim ~/.asoundrc<br />
* Insert the following into your ALSA configuration file ({{Filename|~/.asoundrc}} or {{Filename|/etc/asound.conf}}):<br />
<br />
{{file |name=/etc/asound.conf |content=pcm.eq {<br />
type ladspa<br><br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br><br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br><br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br><br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br><br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br><br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br><br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
}}<br />
<br />
*Reload your alsa settings (as root).<br />
# /etc/rc.d/alsa restart<br />
<br />
*You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install alsa-plugins and libsamplerate:<br />
{{Cli|# pacman -S alsa-plugins libsamplerate}}<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{File|name=/etc/asound.conf|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{File|name=~/asoundrc|content=defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install alsa-plugins:<br />
{{Cli|# pacman -S alsa-plugins}}<br />
<br />
Then add the following to your alsa configuration file of choice (either /etc/asound.conf or ~/.asoundrc):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice.<br />
<br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
{{poor writing}}<br />
Use soundcard that supports hardware mixing: old SoundBlaster Live! series (emu10k1 chip) and new Audigy series (emu10k2 chip) cards are known to work.<br />
<br />
The SoundBlaster Live! 5.1 is fairly easy to find and is cheap to buy.<br />
<br />
'''Note:''' new cheap Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1 '''do not''' support hardware mixing (they use other chips).<br />
<br />
99% of motherboards with integrated sound '''do not''' support hardware mixing.<br />
<br />
An exception is the onboard VIA8237 chip which supports 4-stream hardware mixing. However it does only 3 for some motherboards (the 4th makes no sound), or is just broken. Even if it works, the quality is not good compared to other solutions.<br />
<br />
For Arch64 and the 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), and to get sound from Enemy Territory, it works this by setting these:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{Codeline|ondemand}} or {{Codeline|conservative}}. Currently, the solution is to switch back to the {{Codeline|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While its quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{Codeline|ipc_key_add_uid 0}} to the {{Codeline|pcm.dmixer}} block disables this locking. The following is a snippet of the {{Codeline|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, then change this section of {{Codeline|/etc/asound.conf}}:<br />
<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card FOO<br />
}<br />
</pre><br />
Replace FOO with the desired audio device, as reported in the /proc/asound/cards file. An example of the file is shown below.<br />
<pre><br />
0 [U0x46d0x9a1 ]: USB-Audio - USB Device 0x46d:0x9a1<br />
USB Device 0x46d:0x9a1 at usb-0000:00:12.2-2, high speed<br />
1 [SB ]: HDA-Intel - HDA ATI SB<br />
HDA ATI SB at 0xf9ff4000 irq 16<br />
</pre><br />
Device 0 is the microphone built into a webcam, while device 1 is the integrated sound card. If you have copied the {{Codeline|/etc/asound.conf}} from above as is, alsa will attempt to initialize the microphone as an audio output device, but will fail and you will have no sound. Rather than setting FOO to the number, you set it to the name next to the number, like so:<br />
<pre><br />
ctl.dmixer {<br />
type hw<br />
card SB<br />
}<br />
</pre><br />
<br />
If you use dmix, you will want to have a configuration such as this one:<br />
<pre><br />
ctl.!default {<br />
type hw<br />
card Intel #adapt this to your card<br />
#device 0 #not required, defaults to 0 (see the output of aplay -L)<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 #required and must be unique<br />
slave.pcm {<br />
type hw<br />
card Intel #same as above<br />
#device 0 #same as above<br />
}<br />
}<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm dmixer<br />
}<br />
</pre><br />
<br />
To make most programs use Alsa, make sure {{Codeline|/etc/libao.conf}} only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{Codeline|~/.mplayer/config}} (or {{Codeline|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{Codeline|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{Codeline|alsamixer}} (e.g. ALC662) and the model can be set in {{Filename|/etc/modprobe.d/modprobe.conf}} or {{Filename|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{Filename|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
<pre># ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss</pre><br />
<br />
===Conflicting PC Speaker===<br />
<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{Codeline|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{Codeline|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{Codeline|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
Make sure that all the volume levels are up under recording in alsamixer, and that CAPTURE is active on the microphone (in alsamixer, select it and press space). As the pulseaudio wrapper is shown as "default" in alsamixer, your may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure first by testing the microphone with a different device.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{Codeline|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (i.e. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your ~/.asoundrc file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use 'arecord -L' to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{Cli|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
<br />
There may be an issue with two conflicting modules loaded, namely {{Codeline|snd_intel8x0}} and {{Codeline|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{File|/etc/modprobe.d/modprobe.conf|content=blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{Codeline|alsamixer}} or {{Codeline|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{filename|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
===Pops When Starting and Stopping Playback===<br />
<br />
Some modules can power off your sound card when not in use. this can make an audible noise when powering down your sound card. If you find this annoying try "modinfo snd-MY-MODULE", and look for a module option that adjusts or disables this feature.<br />
<br />
for example: to disable the power saving mode using snd-hda-intel add "options snd-hda-intel power_save=0" in /etc/modprobe.d/modprobe.conf. or try it with "modprobe snd-hda-intel power_save=0"<br />
<br />
===Alsamixer Does Not Run===<br />
<br />
If running alsamixer does not work and you wind up with the following error<br />
alsamixer: function snd_ctl_open failed for default: No such device or directory<br />
<br />
You should first check /etc/group to ensure that your current user is in the 'audio' group. Do not forget to log out and log in again for the group changes.<br />
<br />
Then you might need to re-install your kernel. Run 'pacman -S linux' or whichever patchset you prefer to use.<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in rc.local as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
% aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
% aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding.<br />
<br />
'''If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the 'radeon.audio=1' boot parameter, or alternatively set up the option in your modprobe configuration files.'''<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
<br />
You can restart alsa with the example below or you may reboot, and audio should now work.<br />
{{Note|Any programs running that use alsa will be closed.}}<br />
# /etc/rc.d/alsa force-restart<br />
<br />
===No Adjustable PCM Channel===<br />
You may find that you lack adjustable PCM channel. In this case try to remove all sound-related stuff from MODULES section in /etc/rc.conf, except for snd-NAME-OF-MODULE.<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{Filename|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using asoundconf (currently only available from the AUR) to set the headset as the primary sound output. ''note: before running please make sure you have usb audio module enabled<br />
#modprobe snd-usb-audio<br />
<br />
you can add this to /etc/rc.conf if you wish''<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
===Error 'Unkown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via kdesu or gtksu.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==External Resources==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=Help:Editing_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)&diff=166250Help:Editing (Русский)2011-10-17T05:34:56Z<p>Zunguguzunguzeng: /* Обсуждения пользователей */ опечатка</p>
<hr />
<div>[[Category:ArchWiki Help (Русский)]]<br />
[[Category:Руководства (Русский)]]<br />
[[Category:Русский]]<br />
{{i18n|Help:Editing}}<br />
<br />
''Это краткое руководство по редактированию wiki страниц на Arch Linux Wiki. Для подробного изучения вопроса смотрите [[Help:Editing]]. Если вы хотите испытать информацию о редактировании страниц, полученную здесь, поиграйте в [[sandbox|песочнице]].''<br />
<br />
= Регистрация и вход =<br />
Регистрация в ArchWiki необязательна. Вы можете просматривать все страницы проекта и без неё. Но зарегистрированным и опознанным участникам предоставляются некоторые дополнительные функции, а так же права редактировать статьи и участвовать в обсуждениях.<br />
<br />
Создать учетную запись может каждый. Просто нажмите на ссылку "[[Special:Userlogin|create account]]", которая есть вверху каждой страницы. Вам нужна всего одна учётная запись на все викистраницы.<br />
<br />
= Редактирование =<br />
Как и во всех wiki, вы можете редактировать любую незащищённую страницу. Ваши изменения будут заметны сразу же. Просто нажмите на ссылку "'''править'''", которая появляется вверху каждой части страницы. Для того чтобы редактировать всю страницу, найдите ссылку "'''Править эту статью'''" в низу страницы. <br />
<br />
Объясните вашу правку в "[[Wikipedia:Wikipedia:Edit summary|кратком описании изменений]]" (поле для ввода между окном редактирования и кнопками '''Записать страницу''' и '''Предварительный просмотр'''). Например: "typo" или "added info on xyz" (комментарии лучше всего оставлять на английском языке).<br />
<br />
Используйте [[Help:Show preview|предварительный просмотр]], чтобы проверить вашу правку и получить информацию о форматировании страницы непосредственно перед сохранением. Не забудьте '''Записать страницу''' прежде чем уйти со страницы.<br />
<br />
Если вы [[Special:Userlogin|вошли в систему ArchWiki]], вы можете отметить вашу правку как [[Wikipedia:Wikipedia:Minor edit|незначительную]], нажав на checkbox ''Незначительное изменение'', чтобы люди знали, что ваша правка не вносит особых изменений.<br />
<br />
Чтобы попробовать свои силы в редактировании, откройте новое окно и пройдите в [[sandbox|песочницу]] (тестовая страница для редактирования), потом нажмите на "'''править'''". Добавьте что-нибудь и нажмите "Записать страницу".<br />
<br />
= Добавление новой страницы =<br />
Для того, чтобы добавить новую страницу в какую-либо категорию (скажем, "Моя Новая Страница" в "Некая Категория"), вам необходимо:<br />
#"Отредактировать" страницу с вашим новым названием, зайдя на "<nowiki>http://wiki.archlinux.org/index.php/Моя_Новая_Страница</nowiki>" <br />
#Добавить строчку <nowiki>[[Category:Некая Категория]]</nowiki> в первую строчку вашей страницы.<br />
Вот и всё.<br />
<br />
=Форматирование=<br />
Большая часть форматирования может быть сделана средствами вики, так что вам не придется изучать [[Help:HTML|HTML]].<br />
<br />
==Жирный и курсив==<br />
Слова или фразы '''жирным''' шрифтом или ''курсивом'' выделяются несколькими апострофами (') вокруг:<br />
<br />
*<tt><nowiki>''курсив''</nowiki></tt> выглядит как ''курсив''. (2 апострофа с каждой стороны)<br />
*<tt><nowiki>'''жирный'''</nowiki></tt> выглядит как '''жирный'''. (3 апострофа с каждой стороны)<br />
*<tt><nowiki>'''''жирный курсив'''''</nowiki></tt> выглядит как '''''жирный курсив'''''. (2&nbsp;+&nbsp;3&nbsp;=&nbsp;5 апострофов с каждой стороны)<br />
<br />
==Заголовки и подзаголовки==<br />
Заголовки и подзаголовки это простейший путь улучшить структуру статьи. Если вы видите две или более темы для изложения, вы можете разделить вашу статью вставкой заголовка в каждую секцию.<br />
<br />
Заголовки могут быть созданы таким образом:<br />
*<tt><nowiki>=Главный заголовок=</nowiki></tt> (1 знак равенства)<br />
*<tt><nowiki>==Подзаголовок==</nowiki></tt> (2 знака равенства)<br />
*<tt><nowiki>===Заголовок более низкого уровня===</nowiki></tt> (3 знака равенства)<br />
*<tt><nowiki>====Заголовок еще более низкого уровня====</nowiki></tt> (4 знака равенства)<br />
*<tt><nowiki>=====Заголовок самой мелкой секции=====</nowiki></tt> (5 знаков равенства)<br />
<br />
Если статья имеет хотя бы три заголовка, будет автоматически создано содержание (TOC). Если вы не хотите этого, поместите слово <nowiki>__NOTOC__</nowiki> в вашей статье. <br />
Попробуйте поэкспериментировать в [[sandbox|песочнице]] и посмотрите как изменяется содержание.<br />
<br />
==Отступы==<br />
Для того, чтобы сдвинуть текст вправо поместите двоеточие(<tt>:</tt>) в начало строки. Чем больше двоеточий вы поставите, тем дальше сдвинется текст. Новая строка ('''Enter''' или '''Return''') отмечает начало нового параграфа.<br />
<br />
Пример:<br />
Этот текст выровнен по левому краю.<br />
:Этот текст чуть правее.<br />
::Этот - еще правее.<br />
Будет показано как:<br />
<br />
:Этот текст выровнен по левому краю.<br />
::Этот текст чуть правее.<br />
:::Этот - еще правее.<br />
<br />
==Пункты==<br />
Для вставки маркера перед пунктом списка используйте звездочку (<tt>*</tt>). Используется аналогичное выравнивание: больше звездочек - больше отступ.<br />
<br />
Пример:<br />
*Первый пункт<br />
*Второй пункт<br />
**Подпункт второго пункта<br />
*Забавно, не правда ли?<br />
<br />
Будет показано как:<br />
:*Первый пункт<br />
:*Второй пункт<br />
:**Подпункт второго пункта<br />
:*Забавно, не правда ли?<br />
<br />
==Пронумерованые списки==<br />
Вы можете также создавать пронумерованые списки. Для этого используйте решетку (<tt>#</tt>). Больше <tt>#</tt> - дальше отступ.<br />
<br />
Пример:<br />
#Первый пункт<br />
#Второй пункт<br />
##Подпункт второго пункта<br />
#Третий пункт<br />
<br />
Будет выглядеть так:<br />
#Первый пункт<br />
#Второй пункт<br />
##Подпункт второго пункта<br />
#Третий пункт<br />
<br />
==Код (преформатированый текст)==<br />
Чтобы добавить код (преформатированый текст) в wiki, начинайте каждую строчку с одного пробела.<br />
<br />
=Ссылки=<br />
Ссылки важны в вики т.к. позволяют читателю перемещаться по сайту.<br />
<br />
==Внутренние ссылки==<br />
Вы можете сделать очень много перекрестных ссылок в вики используя внутренние ссылки. Вы можете создавать ссылки как на существующие статьи, так и на статьи, которые должны будут появиться в будущем.<br />
<br />
Для того что бы сделать такую ссылку просто окружите нужный текст двойными квадратными скобками.<br />
<br />
Например, если вы хотите сделать ссылку на статью ''Wikia'', нужно написать так:<br />
:<tt><nowiki>[[Wikia]]</nowiki></tt><br />
<br />
Если вы не хотите использовать заголовок статьи в качестве ссылки, вы можете добавить альтернативное имя после вертикальной черты-разделителя "|" (SHIFT + BACKSLASH на большинстве клавиатур).<br />
<br />
Например, вы хотите сделать ссылку на [[Arch Linux]], но хотите, чтобы это выглядело как "домашнюю страницу". Вы должны написать так:<br />
:<tt>Посмотрите <nowiki>[[Arch Linux|домашнюю страницу]]</nowiki>...</tt><br />
<br />
Это будет отображено как:<br />
:Посмотрите [[Arch Linux|домашнюю страницу]]...<br />
<br />
Если вы хотите использовать какой-либо суффикс для ссылки, вы можете добавить дополнительные символы вне двойных квадратных скобок.<br />
<br />
Например:<br />
<br />
:<tt>Add questions to the Arch Linux for <nowiki>[[quiz]]zes</nowiki>.</tt><br />
<br />
Это будет отображено как:<br />
<br />
:Add questions to the Arch Linux for [[quiz]]zes.<br />
<br />
==Межъязыковые ссылки==<br />
{{out of date}}<br />
ArchWiki позволяет писать статьи на многих языках. Очень полезной является возможность объединить перекрестными ссылками статьи на разных языках на одну и ту же тему. <br />
Если статья существует более чем на одном языке, в ArchWiki есть возможность добавить список языков("i18n-box"), который содержит ссылки на эту же статью на других языках. <br />
<br />
Для добавления i18n-box в статью, напишите в начале статьи:<br />
<br />
<nowiki>{{i18n_links_start}}</nowiki><br />
<nowiki>{{i18n_entry|Deutsch|German Title of the Article}}</nowiki><br />
<nowiki>{{i18n_entry|Français|French Title of the Article}}</nowiki><br />
<nowiki>{{i18n_links_end}}</nowiki><br />
<br />
Если заголовок статьи на вашем языке такой же как и английский, тогда к нему должно быть добавлено название языка в скобках на вашем языке.<br />
<br />
Пример:<br />
<br />
Gnome<br />
Gnome (Deutsch)<br />
Gnome (Français)<br />
Gnome (Русский)<br />
<br />
==Ссылки между wiki==<br />
Для ссылки на документ другой wiki, вы можете использовать [[название вики|title]] с последующим двоеточием и заголовком нужной статьи, вместо использования полного адреса (URL).<br />
<br />
Например, главная страница [[creatures]] wiki - [[Creatures:Main Page]], ссылка на которую должна быть набрана вот так:<br />
:<nowiki>[[Creatures:Main Page]]</nowiki><br />
:а не так <nowiki>http://wiki.archlinux.org/index.php/Main_Page</nowiki><br />
<br />
==Внешние ссылки==<br />
Если вы хотите сослаться куда то за пределы Wikicities, просто напишите полный адрес (URL) для нужной страницы.<br />
<br />
:http://www.google.com/<br />
<br />
Часто нужен нормальный текст вместо адреса. В этом случае окружите ссылку одинарными квадратными скобками и напишите нужный текст после '''пробела''' (а ''не'' вертикальной черты). Так если вы хотите получить такой вид - [http://www.google.com/ Искать в гугле], просто напишите:<br />
:<tt><nowiki>[http://www.google.com/ Искать в гугле]</nowiki></tt><br />
<br />
=Перенаправления=<br />
Для автоматического перенаправления на другую страницу, напишите <nowiki>#REDIRECT</nowiki> и в двойных квадратных скобках название статьи на которую перенаправлять. <br />
<br />
Например для перенаправления со статьи "Кошки" на "Кот":<br />
<br />
#REDIRECT [[Кот]]<br />
<br />
Теперь можно писать в строке поиска и в строке адреса как Кошки, так и Кот. В любом случае пользователь попадет на страницу Кот.<br />
<br />
= Запросы =<br />
Хотите какую-либо инструкцию? Хотите что-то узнать? Добавьте запрос на страницу [[Requests|запросов]]!<br />
<br />
=Переменные и шаблоны вики=<br />
Используйте <nowiki>{{SITENAME}}</nowiki> чтобы увидеть название текущей wiki. Например, '''''<nowiki>{{SITENAME}}</nowiki>''''' на этом сайте покажет '''''{{SITENAME}}'''''.<br />
<br />
Вы можете создавать свои шаблоны. После создания страницы Template:XXX, используйте команду <nowiki>{{XXX}} </nowiki> включив ее в текущую страницу. Так вы можете тиражировать то, что должно быть включено во множество страниц.<br />
<br />
=Страницы обсуждений=<br />
Обсуждения или "talk" страницы созданы для общения между пользователями вики.<br />
<br />
Для обсуждения любой страницы нажмите на ссылку "обсуждение". Добавьте в конец свой коментарий или после того коментария на который вы отвечаете.<br />
<br />
Подписывайте свой коментарий с помощью символов <tt><nowiki>~~~~</nowiki></tt> для вставки имени пользователя и времени.<br />
<br />
Используйте [[#Отступы]] для форматирования дискуссии. Обычно ответ отодвигают на один отступ вправо от предыдущего коментария. <br />
<br />
Поэкспериментируйте на [[talk:Sandbox|странице обсуждения в песочнице]].<br />
<br />
==Обсуждения пользователей==<br />
Каждый пользователь имеет свою страницу обсуждения, на которой другие могут оставить открытые сообщения. Если кто-то туда что-либо напишет, вы увидите надпись "У вас есть новые сообщения", со ссылкой на эту страницу.<br />
<br />
Вы можете ответить на странице обсуждения того пользователя, который вам написал вместо ответа на своей странице. В этом случае он тоже получит извещение.<br />
<br />
= Особые категории =<br />
Существуют особые категории, помогающие в работе с ArchWiki. <br />
<br />
== Статья ещё не закончена, чтобы ей пользоваться ==<br />
Категория [http://wiki.archlinux.org/index.php/Category:Stub stub] (обрезок) содержит все статьи, помеченные флагом <pre>{{stub}}</pre> Причины, по которым статья может попасть в эту категорию:<br />
* статья слишком коротка<br />
* статья ничего не объясняет<br />
* статья содержит неоконченные части<br />
<br />
== Статья ещё не переведена ==<br />
Категория [https://wiki.archlinux.org/index.php/Category:Request:Translation "требуется перевод"] содержит все статьи, которые были помечены флагом <pre>{{translateme}}</pre> Причины, по которым статья может попасть в эту категорию:<br />
* части статьи находятся не в должном языке<br />
* содержимое не переведено, а просто скопировано с другого языка<br />
* статья на языке оригинала была усовершенстована, поэтому в переводе некоторые моменты отсутсвуют<br />
<br />
== Статьи, возможно, содержащие неверную или сбивающую информацию ==<br />
Категория [[:Category:Request:Correction|Request:Corrections]] содержит все статьи, которые были помечены флагом <pre>{{accuracy}}</pre> Причины, по которым статья может находиться в этой категории:<br />
* пользователи наблюдают возможно неверную или сбивающую с толку информацию и обсуждают в Talk: этой страницы, как исправить статью. <br />
* статья содержит устаревшую информацию, которую надо обновить.<br />
Этот флаг подробнее объясняется в статье [[Accuracy_dispute]].</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166249ArchWiki:Sandbox2011-10-17T05:21:14Z<p>Zunguguzunguzeng: /* My heading */ test</p>
<hr />
<div>[[Category:Sandbox]]<br />
{{i18n|Sandbox}}<br />
{{DISPLAYTITLE:新標題}}<br />
'''Welcome to the ArchWiki. Feel free to train your Wiki editing skills on this page.'''<br />
<br />
{{Article summary start}}<br />
{{Article summary text|My text.}}<br />
{{Sandbox|Sandbox}}<br />
{{Article summary heading|Links}}<br />
{{Article summary link|Archlinux.org|http://archlinux.org}}<br />
{{Article summary end}}<br />
<br />
{{Sandbox|expansion}}<br />
<br />
Some pointers to learn the right syntax:<br />
* http://en.wikipedia.org/wiki/Wikipedia:Cheatsheet<br />
* http://en.wikipedia.org/wiki/Wikipedia:How_to_edit_a_page<br />
* http://meta.wikimedia.org/wiki/Category:Documentation<br />
* http://en.wikipedia.org/wiki/Help:Table<br />
<br />
<br><hr> <!-- Your stuff goes below this line, okay? --><br />
<br />
==Arch linux==<br />
<br />
archlinux is the best linux distro available<br />
<br />
ǝlqɐlıɐʌɐ oɹʇsıp xnuıl ʇsǝq ǝɥʇ sı xnuılɥɔɹɐ<br />
<br />
#<!-- floating sidebar? --><br />
#<div class="toc" style="position:fixed;left:0;bottom:0;width:139px;height:120px;">This is a test</div><br />
<br />
This is <pre style="display: inline;">inline</pre> maybe?<br />
<br />
<br />
Maybe <pre style="display: inline; padding: 0.1em 0.2em;">this one</pre> can be inline instead... (am I really discussing even here???)<br />
<br />
<br />
#**abcds <br><br />
--------[[Image:Tango-two-arrows.png]]<br />
#**sdfaf<br />
# pacman -S foo bar<br />
<br />
<br />
<code> fsdgsdfgdhdfgh</code><br />
<br />
=My heading=<br />
*first<br />
*secound<br />
**first<br />
***#first<br />
***#first<br />
**secound<br />
*first<br />
<br />
=A very big heading=<br />
<br />
test test 321<br />
BLAH TEST<br />
<br />
{{Keypress|Return}}<br />
<br />
<br />
# cat /boot/vmlinuz26 > /dev/dsp<br />
# pacman -S foo bar<br />
<br />
Pacman utils<br />
<br />
$ pacman -Ss <the-name-of-a-package><br />
$ sudo pacman -S <the-name-of-a-package><br />
<br />
or (as root)<br />
<br />
# pacman -Ss <the-name-of-a-package><br />
# pacman -S <the-name-of-a-package><br />
<br />
{{File|name=File Name|content=File Content}}<br />
<br />
{{Kernel|content=Kernel Content}}<br />
<br />
{{Note|Note text}}<br />
<br />
{{Tip|Tip text}}<br />
<br />
{{Warning|Warning text}}<br />
<br />
{{Codeline|pacman --sync --refresh --sysupgrade}}<br />
<br />
{{Filename|/etc/rc.local}}<br />
<br />
{{Progressbar|13}}<br />
{{Progressbar|50}}<br />
<br />
{| border="1"<br />
| A || B<br />
|- <br />
| C || D <br />
|}<br />
<br />
== Q and A ==<br />
Q: Isn't is possible to add remote image files to wiki?<br />
<br />
A: No. The setting is disabled. Contact a wiki admin to upload images<br />
to the wiki, which can then be used as such:<br />
<br />
That's a test!<br />
<br />
[[Image:Tango-two-arrows.png]]<br />
<br />
=Top Level Heading (title)=<br />
<br />
==Article headings==<br />
===Inner headings===<br />
====Innerer headings====<br />
=====Innererer headings=====<br />
======Inest headings======<br />
=======Aargh!=======<br />
<br />
==And Here's the Code==<br />
line1<br />
line2<br />
line3<br />
line4<br />
line5<br />
==And Here's the Code==<br />
(second part)<br />
<br />
==OK. Another heading==<br />
= Columns =<br />
== Testing columns ==<br />
<div style="float: left; width: 50%; border: 1px "><br />
* Info for first column<br />
More info for first column<br />
</div><div style="float: left; width: 50%"><br />
* Info for second column<br />
More info for second column<br />
</div><br />
[[#Columns]]<br />
<br />
== Testing two ==<br />
{| border="1" width="100%"<br />
| <span style="color: #ff9900"><b>FEATURE RICH</b></span> <ul><br />
<li>CGI, FastCGI, LSAPI, PHP, Servlet/JSP, Proxy</li><br />
<li>SSL, IPv4, IPv6</li><br />
<li>Best Ruby on Rail support</li><br />
<li>Apache compatible .htaccess support</li><br />
<li>mod_security compatible request filtering</li><br />
<li>Apache compatible URL rewrite engine</li><br />
<li>MS FrontPage Server Extension</li><br />
</ul><br />
|<span style="color: #ff9900"><b>FAST</b></span><br />
<ul><br />
<li>Up to <b>9</b> times faster than Apache</li><br />
<li>PHP performance increases 50%</li><br />
<li>Best Ruby on Rail performance</li><br />
<li>3 times faster than Apache in SSL</li><br />
<li>Efficient CGI daemon</li><br />
<li>High performance Perl daemon</li><br />
<li>SSL Hardware acceleration</li><br />
</ul><br />
|-<br />
|<span style="color: #ff9900"><b>USER FRIENDLY</b></span><br />
<ul><br />
<li>Easy installation</li><br />
<li>Automatic PHP Setup</li><br />
<li>Easy server management through Admin GUI</li><br />
<li>Apply changes on the fly</li><br />
<li>Real-time service monitoring</li><br />
<li>Automatic update agent</li><br />
<li>Virtual host template configuration</li><br />
</ul> <br />
|<span style="color: #ff9900"><b>SECURE</b></span><br />
<ul><br />
<li>Strictest HTTP request validation</li><br />
<li>Deny any buffer-overrun attempts</li><br />
<li>Anti-DDoS: Throttling &amp; Connection Accounting</li><br />
<li>System overloading prevention</li><br />
<li>Chroot web server process</li><br />
<li>CGI/FCGI/LSAPI/PHP/RUBY suEXEC </li><br />
<li>Virtual host chroot</li><br />
</ul><br />
|-<br />
|<span style="color: #ff9900"><b>RELIABLE</b></span><br />
<ul><br />
<li>Watch Dog monitoring</li><br />
<li>Recover from service failure instantly</li><br />
<li>Zero down time graceful restart</li><br />
</ul><br />
|<span style="color: #ff9900"><b>SCALABLE</b></span><br />
<ul><br />
<li>Small memory footprint</li><br />
<li>Thousands of concurrent connections</li><br />
<li>Increase scalability of external web applications </li><br />
</ul><br />
|-<br />
| colspan="2" |<span style="color: #ff9900"><b>EASILY FIT INTO YOUR EXISTING WEB INFRASTRUCTURE</b></span><br />
<ul><br />
<li>Apache interchangeable, operate directly from Apache httpd.conf</li><br />
<li>Web hosting control panel compatible: cPanel, DirectAdmin, Plesk, etc</li><br />
<li>Migration from other web servers is quick and easy </li><br />
<li>No need to purchase extra hardware to cope with your current web server's lack of performance</li><br />
<li> Or have LiteSpeed serve as a content accelerator, compression proxy or security guard in front of your current web/Application server, improving performance, scalability and security.</li><br />
</ul><br />
|}<br />
<br />
== Extra two ==<br />
{| border="1" width="100%"<br />
| <span style="color: #ff9900">'''FEATURE RICH'''</span> <br />
<br />
* CGI, FastCGI, LSAPI, PHP, Servlet/JSP, Proxy<br />
* SSL, IPv4, IPv6<br />
* Best Ruby on Rail support<br />
* Apache compatible .htaccess support<br />
* mod_security compatible request filtering<br />
* Apache compatible URL rewrite engine<br />
* MS FrontPage Server Extension<br />
|<span style="color: #ff9900">'''FAST'''</span><br />
<br />
* Up to '''9''' times faster than Apache<br />
* PHP performance increases 50%<br />
* Best Ruby on Rail performance<br />
* 3 times faster than Apache in SSL<br />
* Efficient CGI daemon<br />
* High performance Perl daemon<br />
* SSL Hardware acceleration<br />
|-<br />
|<span style="color: #ff9900">'''USER FRIENDLY'''</span><br />
<br />
* Easy installation<br />
* Automatic PHP Setup<br />
* Easy server management through Admin GUI<br />
* Apply changes on the fly<br />
* Real-time service monitoring<br />
* Automatic update agent<br />
* Virtual host template configuration <br />
|<span style="color: #ff9900">'''SECURE'''</span><br />
<br />
* Strictest HTTP request validation<br />
* Deny any buffer-overrun attempts<br />
* Anti-DDoS: Throttling &amp; Connection Accounting<br />
* System overloading prevention<br />
* Chroot web server process<br />
* CGI/FCGI/LSAPI/PHP/RUBY suEXEC <br />
* Virtual host chroot<br />
|-<br />
|<span style="color: #ff9900">'''RELIABLE'''</span><br />
<br />
* Watch Dog monitoring<br />
* Recover from service failure instantly<br />
* Zero down time graceful restart<br />
|<span style="color: #ff9900">'''SCALABLE'''</span><br />
<br />
* Small memory footprint<br />
* Thousands of concurrent connections<br />
* Increase scalability of external web applications <br />
|-<br />
| colspan="2" |<span style="color: #ff9900">'''EASILY FIT INTO YOUR EXISTING WEB INFRASTRUCTURE'''</span><br />
<br />
* Apache interchangeable, operate directly from Apache httpd.conf<br />
* Web hosting control panel compatible: cPanel, DirectAdmin, Plesk, etc<br />
* Migration from other web servers is quick and easy <br />
* No need to purchase extra hardware to cope with your current web server's lack of performance<br />
* Or have LiteSpeed serve as a content accelerator, compression proxy or security guard in front of your current web/Application server, improving performance, scalability and security.<br />
|}<br />
test</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=ArchWiki:Sandbox&diff=166248ArchWiki:Sandbox2011-10-17T05:18:55Z<p>Zunguguzunguzeng: test</p>
<hr />
<div>[[Category:Sandbox]]<br />
{{i18n|Sandbox}}<br />
{{DISPLAYTITLE:新標題}}<br />
'''Welcome to the ArchWiki. Feel free to train your Wiki editing skills on this page.'''<br />
<br />
{{Article summary start}}<br />
{{Article summary text|My text.}}<br />
{{Sandbox|Sandbox}}<br />
{{Article summary heading|Links}}<br />
{{Article summary link|Archlinux.org|http://archlinux.org}}<br />
{{Article summary end}}<br />
<br />
{{Sandbox|expansion}}<br />
<br />
Some pointers to learn the right syntax:<br />
* http://en.wikipedia.org/wiki/Wikipedia:Cheatsheet<br />
* http://en.wikipedia.org/wiki/Wikipedia:How_to_edit_a_page<br />
* http://meta.wikimedia.org/wiki/Category:Documentation<br />
* http://en.wikipedia.org/wiki/Help:Table<br />
<br />
<br><hr> <!-- Your stuff goes below this line, okay? --><br />
<br />
==Arch linux==<br />
<br />
archlinux is the best linux distro available<br />
<br />
ǝlqɐlıɐʌɐ oɹʇsıp xnuıl ʇsǝq ǝɥʇ sı xnuılɥɔɹɐ<br />
<br />
#<!-- floating sidebar? --><br />
#<div class="toc" style="position:fixed;left:0;bottom:0;width:139px;height:120px;">This is a test</div><br />
<br />
This is <pre style="display: inline;">inline</pre> maybe?<br />
<br />
<br />
Maybe <pre style="display: inline; padding: 0.1em 0.2em;">this one</pre> can be inline instead... (am I really discussing even here???)<br />
<br />
<br />
#**abcds <br><br />
--------[[Image:Tango-two-arrows.png]]<br />
#**sdfaf<br />
# pacman -S foo bar<br />
<br />
<br />
<code> fsdgsdfgdhdfgh</code><br />
<br />
=My heading=<br />
<br />
=A very big heading=<br />
<br />
test test 321<br />
BLAH TEST<br />
<br />
{{Keypress|Return}}<br />
<br />
<br />
# cat /boot/vmlinuz26 > /dev/dsp<br />
# pacman -S foo bar<br />
<br />
Pacman utils<br />
<br />
$ pacman -Ss <the-name-of-a-package><br />
$ sudo pacman -S <the-name-of-a-package><br />
<br />
or (as root)<br />
<br />
# pacman -Ss <the-name-of-a-package><br />
# pacman -S <the-name-of-a-package><br />
<br />
{{File|name=File Name|content=File Content}}<br />
<br />
{{Kernel|content=Kernel Content}}<br />
<br />
{{Note|Note text}}<br />
<br />
{{Tip|Tip text}}<br />
<br />
{{Warning|Warning text}}<br />
<br />
{{Codeline|pacman --sync --refresh --sysupgrade}}<br />
<br />
{{Filename|/etc/rc.local}}<br />
<br />
{{Progressbar|13}}<br />
{{Progressbar|50}}<br />
<br />
{| border="1"<br />
| A || B<br />
|- <br />
| C || D <br />
|}<br />
<br />
== Q and A ==<br />
Q: Isn't is possible to add remote image files to wiki?<br />
<br />
A: No. The setting is disabled. Contact a wiki admin to upload images<br />
to the wiki, which can then be used as such:<br />
<br />
That's a test!<br />
<br />
[[Image:Tango-two-arrows.png]]<br />
<br />
=Top Level Heading (title)=<br />
<br />
==Article headings==<br />
===Inner headings===<br />
====Innerer headings====<br />
=====Innererer headings=====<br />
======Inest headings======<br />
=======Aargh!=======<br />
<br />
==And Here's the Code==<br />
line1<br />
line2<br />
line3<br />
line4<br />
line5<br />
==And Here's the Code==<br />
(second part)<br />
<br />
==OK. Another heading==<br />
= Columns =<br />
== Testing columns ==<br />
<div style="float: left; width: 50%; border: 1px "><br />
* Info for first column<br />
More info for first column<br />
</div><div style="float: left; width: 50%"><br />
* Info for second column<br />
More info for second column<br />
</div><br />
[[#Columns]]<br />
<br />
== Testing two ==<br />
{| border="1" width="100%"<br />
| <span style="color: #ff9900"><b>FEATURE RICH</b></span> <ul><br />
<li>CGI, FastCGI, LSAPI, PHP, Servlet/JSP, Proxy</li><br />
<li>SSL, IPv4, IPv6</li><br />
<li>Best Ruby on Rail support</li><br />
<li>Apache compatible .htaccess support</li><br />
<li>mod_security compatible request filtering</li><br />
<li>Apache compatible URL rewrite engine</li><br />
<li>MS FrontPage Server Extension</li><br />
</ul><br />
|<span style="color: #ff9900"><b>FAST</b></span><br />
<ul><br />
<li>Up to <b>9</b> times faster than Apache</li><br />
<li>PHP performance increases 50%</li><br />
<li>Best Ruby on Rail performance</li><br />
<li>3 times faster than Apache in SSL</li><br />
<li>Efficient CGI daemon</li><br />
<li>High performance Perl daemon</li><br />
<li>SSL Hardware acceleration</li><br />
</ul><br />
|-<br />
|<span style="color: #ff9900"><b>USER FRIENDLY</b></span><br />
<ul><br />
<li>Easy installation</li><br />
<li>Automatic PHP Setup</li><br />
<li>Easy server management through Admin GUI</li><br />
<li>Apply changes on the fly</li><br />
<li>Real-time service monitoring</li><br />
<li>Automatic update agent</li><br />
<li>Virtual host template configuration</li><br />
</ul> <br />
|<span style="color: #ff9900"><b>SECURE</b></span><br />
<ul><br />
<li>Strictest HTTP request validation</li><br />
<li>Deny any buffer-overrun attempts</li><br />
<li>Anti-DDoS: Throttling &amp; Connection Accounting</li><br />
<li>System overloading prevention</li><br />
<li>Chroot web server process</li><br />
<li>CGI/FCGI/LSAPI/PHP/RUBY suEXEC </li><br />
<li>Virtual host chroot</li><br />
</ul><br />
|-<br />
|<span style="color: #ff9900"><b>RELIABLE</b></span><br />
<ul><br />
<li>Watch Dog monitoring</li><br />
<li>Recover from service failure instantly</li><br />
<li>Zero down time graceful restart</li><br />
</ul><br />
|<span style="color: #ff9900"><b>SCALABLE</b></span><br />
<ul><br />
<li>Small memory footprint</li><br />
<li>Thousands of concurrent connections</li><br />
<li>Increase scalability of external web applications </li><br />
</ul><br />
|-<br />
| colspan="2" |<span style="color: #ff9900"><b>EASILY FIT INTO YOUR EXISTING WEB INFRASTRUCTURE</b></span><br />
<ul><br />
<li>Apache interchangeable, operate directly from Apache httpd.conf</li><br />
<li>Web hosting control panel compatible: cPanel, DirectAdmin, Plesk, etc</li><br />
<li>Migration from other web servers is quick and easy </li><br />
<li>No need to purchase extra hardware to cope with your current web server's lack of performance</li><br />
<li> Or have LiteSpeed serve as a content accelerator, compression proxy or security guard in front of your current web/Application server, improving performance, scalability and security.</li><br />
</ul><br />
|}<br />
<br />
== Extra two ==<br />
{| border="1" width="100%"<br />
| <span style="color: #ff9900">'''FEATURE RICH'''</span> <br />
<br />
* CGI, FastCGI, LSAPI, PHP, Servlet/JSP, Proxy<br />
* SSL, IPv4, IPv6<br />
* Best Ruby on Rail support<br />
* Apache compatible .htaccess support<br />
* mod_security compatible request filtering<br />
* Apache compatible URL rewrite engine<br />
* MS FrontPage Server Extension<br />
|<span style="color: #ff9900">'''FAST'''</span><br />
<br />
* Up to '''9''' times faster than Apache<br />
* PHP performance increases 50%<br />
* Best Ruby on Rail performance<br />
* 3 times faster than Apache in SSL<br />
* Efficient CGI daemon<br />
* High performance Perl daemon<br />
* SSL Hardware acceleration<br />
|-<br />
|<span style="color: #ff9900">'''USER FRIENDLY'''</span><br />
<br />
* Easy installation<br />
* Automatic PHP Setup<br />
* Easy server management through Admin GUI<br />
* Apply changes on the fly<br />
* Real-time service monitoring<br />
* Automatic update agent<br />
* Virtual host template configuration <br />
|<span style="color: #ff9900">'''SECURE'''</span><br />
<br />
* Strictest HTTP request validation<br />
* Deny any buffer-overrun attempts<br />
* Anti-DDoS: Throttling &amp; Connection Accounting<br />
* System overloading prevention<br />
* Chroot web server process<br />
* CGI/FCGI/LSAPI/PHP/RUBY suEXEC <br />
* Virtual host chroot<br />
|-<br />
|<span style="color: #ff9900">'''RELIABLE'''</span><br />
<br />
* Watch Dog monitoring<br />
* Recover from service failure instantly<br />
* Zero down time graceful restart<br />
|<span style="color: #ff9900">'''SCALABLE'''</span><br />
<br />
* Small memory footprint<br />
* Thousands of concurrent connections<br />
* Increase scalability of external web applications <br />
|-<br />
| colspan="2" |<span style="color: #ff9900">'''EASILY FIT INTO YOUR EXISTING WEB INFRASTRUCTURE'''</span><br />
<br />
* Apache interchangeable, operate directly from Apache httpd.conf<br />
* Web hosting control panel compatible: cPanel, DirectAdmin, Plesk, etc<br />
* Migration from other web servers is quick and easy <br />
* No need to purchase extra hardware to cope with your current web server's lack of performance<br />
* Or have LiteSpeed serve as a content accelerator, compression proxy or security guard in front of your current web/Application server, improving performance, scalability and security.<br />
|}<br />
test</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=Mkinitcpio_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)&diff=166247Mkinitcpio (Русский)2011-10-17T04:38:54Z<p>Zunguguzunguzeng: исправил опечатку</p>
<hr />
<div>[[Category:Русский]]<br />
[[Category:Загрузка (Русский)]]<br />
[[Category:Руководство пользователя (Русский)]]<br />
{{i18n|mkinitcpio}}<br />
{{Article summary start}}<br />
{{Article summary text|Статья объясняет как использовать mkinitcpio}}<br />
<!-- {{Article summary heading|Related}} --><br />
{{Article summary end}}<br />
<br />
== Введение ==<br />
<br />
'''mkinitcpio''' - следующее поколение '''программ для создания initramfs'''. У нее есть много преимуществ перед '''mkinitrd''' и '''mkinitramfs'''.<br />
<br />
* Использует '''klibc''' и '''kinit''', разработанные авторами ядра Linux для уменьшения накладных расходов на ранней стадии загрузки.<br />
* Может использовать '''udev''' для определения апаратных средств, что предотвращает загрузки большого количества лишних модулей.<br />
* Возможность расширять функциональность при помощи специальных обработчиков, которые могут быть включены в другие пакеты.<br />
* Поддерживает '''lvm2''', '''dm-crypt''', '''raid''', '''swsusp''' и '''suspend2''' и загрузку с устройств '''usb mass storage'''.<br />
* Много опций передается прямо из строки аргументов ядра.<br />
* '''mkinitcpio''' позволяет включать образ ram-диска в образ ядра.<br />
<br />
'''mkinitcpio''' разработан '''phrakture''' и '''tpowa''' с помощью community.<br />
<br />
== Установка mkinitcpio ==<br />
=== Из текущего репозитория ===<br />
<br />
'''mkinitcpio''' находится в репозитории current. Вы можете установить его командой<br />
# pacman -S mkinitcpio<br />
<br />
=== Из git ===<br />
<br />
Последнюю development версию '''mkinitcpio''', можно получить из git командой<br />
# git clone git://projects.archlinux.org/mkinitcpio.git<br />
<br />
== Для ядер >=2.6.17 ==<br />
Будет создано 2 образа во время установки/обновления:<br />
<br />
Если вы используете '''kernel26'''<br />
/boot/kernel26.img --> образ с необходимыми драйверами для загрузки на этом компьютере<br />
/boot/kernel26-fallback.img --> образ со всем драйверами<br />
Если вы используете '''kernel26beyond'''<br />
/boot/kernel26beyond.img --> образ с необходимыми драйверами для загрузки на этом компьютере<br />
/boot/kernel26beyond-fallback.img --> образ со всем драйверами<br />
Настройте свой загрузчик на использование нужного образа.<br />
<br />
=== Предупреждения ===<br />
==== Пользователям '''lvm2''', '''raid''' и '''encrypt''' ====<br />
{{Warning|1='''lvm2''', '''raid''' и '''encrypt''' НЕ ВКЛЮЧЕНЫ по умолчанию.<br />
Прочитайте эту страницу чтобы узнать как их включить и настроить.}}<br />
<br />
==== Пользователям более одного контроллера дисков ====<br />
{{Warning|1=Если у вас более одного контроллера дисков использующих одно пространство имен устройств (например 2 SCSI/SATA или IDE контроллера) и они требуют разных модулей, укажите правильный порядок в MODULES="" в файле /etc/mkinitcpio.conf и в вашем файле конфигурации fallback, иначе устройства могут поменяться местами и вы получите kernel panic при загрузке.<br />
<br />
Более правильный путь - использовать [[Persistent block device naming]], чтобы быть уверенным, что вы смонтировали действительно то, что хотели.}}<br />
<br />
==== Незагружаемые модули ====<br />
{{Warning|1=Если вам нужно загрузить один из следующих модулей для нормального монтирования корневого раздела, поместите его в MODULES="" в /etc/mkinitcpio.conf и в файл конфигурации fallback.<br />
<br />
- '''SCSI КОНТРОЛЛЕРЫ''' (status stock kernel 2.6.18)<br />
<pre><br />
scsi_transport_sas ultrastor qlogicfas eata BusLogic pas16 wd7000 sym53c416<br />
g_NCR5380_mmio fdomain u14-34f dtc initio in2000 imm t128 aha1542 aha152x<br />
atp870u g_NCR5380 NCR53c406a qlogicfas408 megaraid_mm advansys<br />
</pre><br />
}}<br />
<br />
=== Редактирование файлов конфигурации ===<br />
<br />
=== '''Модификация основного образа''' ===<br />
To change the defaults for the main image edit the following file:<br />
<br />
/etc/mkinitcpio.conf<br />
<br />
mkinitcpio использует этот файл по умолчанию.<br />
<br />
=== '''Редактирование fallback образа''' ===<br />
To change the defaults for the fallback images, edit one of the following files:<br />
отредактируйте '''/boot/mkinitcpio.d/kernel26-fallback.conf'''<br />
и выставьте файл который вы отредактировали в '''NoUpgrade =''' в '/etc/pacman.conf'. Это должно быть нормально, если вы не используете специальные настройки вида lvm или raid.<br />
<br />
=== Настройка обработчиков (HOOKS) ===<br />
<br />
Это наиболее важная часть конфигурирования mkinitcpio. Строка HOOKS содержит обработчики, которые исполняются при создании образа и во время выполнения в том же порядке, в котором они указаны. Строка имеет следующий формат:<br />
<br />
HOOKS="foo1 foo2 foo3 bar1 bar2"<br />
<br />
==== Доступные обработчики ====<br />
<br />
{| border="2" cellspacing="0" cellpadding="4" rules="all" style="margin:1em 1em 1em 0; border-style:solid; border-width:1px; border-collapse:collapse; empty-cells:show"<br />
|-<br />
! Hook || При установке || Во время выполнения<br />
|-<br />
| '''base''' || Устанавливает базовые каталоги, klibc и основные библиотеки. Всегда используйте его, за исключением случаев, когда вы действительно знаете, что делаете. || <br />
|-<br />
| '''udev''' || Добавляет udev в образ ram-диска || Udev автоматически создает файл устройства для корня и загружает необходимые модули для его работы. Рекомендуется использовать.<br />
|-<br />
| '''modload''' || || Альтернативный механизм автоопределения, но работает медленнее чем udev. Оставлен для совместимости, используйте udev вместо него.<br />
|-<br />
| '''autodetect''' || Уменьшает размер initramfs пытаясь определить какие модули вам нужны. Проверьте список модулей которые он добавил. Он должен запускаться раньше других подсистем. Все обработчики выполняемые до него будут включать все модули. || <br />
|-<br />
| '''ide''' || Добавляет модули IDE. Используйте если ваш корневой раздел на IDE диске. Поставьте '''autodetect''' до него, для уменьшения количества модулей || Загружает модули IDE. Вам потребуется '''udev''' или '''modload''' обработчики если вы не указали список модулей явно (см. секцию MODULES ниже).<br />
|-<br />
| '''pata''' || Добавляет IDE модули. Используйте если корневой раздел - IDE диск и вы хотите использовать PATA вместо IDE. Также рекомендуется '''autodetect''' || Загружает модули. Вам потребуется '''udev''' или '''modload''' если только вы не указали все в секции MODULES. PATA - новый набор IDE драйверов. При его использовании /dev/hd? меняются на /dev/sd?. См.: http://archlinux.org/news/272/<br />
|-<br />
| '''sata''' || Добавляет SATA модули. || Загружает SATA модули.<br />
|-<br />
| '''scsi''' || Добавляет SCSI модули. || Загружает SCSI модули.<br />
|-<br />
| '''usb''' || Добавляет USB модули для usb-storage. || Загружает USB модули.<br />
|-<br />
| '''usbinput''' || Добавляет USB HID модули. Используйте если нужна USB клавиатура на ранней стадии загрузки (например для ввода пароля в режиме failsafe || Загружает модули.<br />
|-<br />
| '''fw''' || Добавляет поддержку Firewire в образ. Нужно для FW mass storage устройств. || Загружает FW модули.<br />
|-<br />
| '''net''' || Добавляет модули сетевых устройств. Для pcmcia добавьте соответствующий обработчик. || Загружает модули. См. также [[Configuring mkinitcpio (Русский)#.D0.98.D0.B7.D0.BC.D0.B5.D0.BD.D0.B5.D0.BD.D0.B8.D1.8F_.D1.81.D1.82.D1.80.D0.BE.D0.BA.D0.B8_.D0.BF.D0.B0.D1.80.D0.B0.D0.BC.D0.B5.D1.82.D1.80.D0.BE.D0.B2_.D1.8F.D0.B4.D1.80.D0.B0|Изменение строки параметров ядра]].<br />
|-<br />
| '''pcmcia''' || Добавляет pcmcia модули. Требует наличия pcmciautils.|| Загружает модули pcmcia.<br />
|-<br />
| '''dsdt''' || Добавляет пользовательский acpi dsdt файл. Запишите свой файл в /lib/initcpio/custom.dsdt || Ваш dsdt файл будет автоматически использован если он присутствует в initramfs.<br />
|-<br />
| '''filesystems''' || Добавляет драйвера файловых систем || Определяет файловые системы и загружает модули. ВНИМАНИЕ: это не работает с reiser4, вам придется добавлять драйвер этой ФС вручную.<br />
|-<br />
| '''lvm2''' || Добавляет поддержку lvm. Требует установленного пакета lvm2 || Включает поддержку lvm<br />
|-<br />
| '''raid''' || Добавляет модули для software raid. Требует пакет mdadm.|| Загружает модули и собирает raid устройства. См. секцию [[Configuring_mkinitcpio#.D0.98.D0.B7.D0.BC.D0.B5.D0.BD.D0.B5.D0.BD.D0.B8.D1.8F_.D1.81.D1.82.D1.80.D0.BE.D0.BA.D0.B8_.D0.BF.D0.B0.D1.80.D0.B0.D0.BC.D0.B5.D1.82.D1.80.D0.BE.D0.B2_.D1.8F.D0.B4.D1.80.D0.B0|Изменение строки параметров ядра]].<br />
|-<br />
| '''encrypt''' || Добавляет dm-crypt модуль и программу cryptsetup. Требует установленный пакет cryptsetup. || Определяет и разблокирует зашифрованый корневой раздел. См. секцию [[Configuring_mkinitcpio#.D0.98.D0.B7.D0.BC.D0.B5.D0.BD.D0.B5.D0.BD.D0.B8.D1.8F_.D1.81.D1.82.D1.80.D0.BE.D0.BA.D0.B8_.D0.BF.D0.B0.D1.80.D0.B0.D0.BC.D0.B5.D1.82.D1.80.D0.BE.D0.B2_.D1.8F.D0.B4.D1.80.D0.B0|Изменение строки параметров ядра]].<br />
|-<br />
| '''resume''' || || Пытается выполнить пробуждение после "suspend to disk". Работает с swsusp и [[Suspend to Disk|suspend2]]. См. также [[Configuring mkinitcpio (Русский)#.D0.98.D0.B7.D0.BC.D0.B5.D0.BD.D0.B5.D0.BD.D0.B8.D1.8F_.D1.81.D1.82.D1.80.D0.BE.D0.BA.D0.B8_.D0.BF.D0.B0.D1.80.D0.B0.D0.BC.D0.B5.D1.82.D1.80.D0.BE.D0.B2_.D1.8F.D0.B4.D1.80.D0.B0|Изменение строки параметров ядра]].<br />
|-<br />
| '''firmware''' || Добавляет файлы в /lib/firmware. || Загружает firmware.<br />
|-<br />
| '''keymap''' || Добавляет keymap и consolefonts из rc.conf. || Загружает указанную раскладку и шрифты.<br />
|}<br />
<br />
==== Примеры ====<br />
<br />
Эта конфигурация будет работать для большинства пользователей:<br />
<br />
HOOKS="base udev autodetect ide scsi sata filesystems"<br />
<br />
Если вы хотите загружать систему на разных машинах используйте:<br />
<br />
HOOKS="base udev ide scsi sata filesystems"<br />
<br />
Вы можете использовать зашифрованные тома на lvm2:<br />
<br />
HOOKS="base udev autodetect ide scsi sata lvm2 encrypt filesystems"<br />
<br />
=== Изменение переменной MODULES ===<br />
<br />
MODULES содержит список модулей для включения в образ и загрузки. Например это нужно если вы не хотите использовать '''udev''' или '''modload'''. Тогда можно добавить все нужные модули вручную:<br />
<br />
MODULES="piix ide_disk reiserfs"<br />
HOOKS="base autodetect ide filesystems"<br />
<br />
NOTE: Если вам нужен '''reiser4''', вы ДОЛЖНЫ добавить его в список модулей.<br />
<br />
=== Настройка BINARIES и FILES ===<br />
<br />
Эти опции добавляют в образ указанные файлы. Разница только в том, что BINARIES проверяет зависимости от библиотек, в то время как FILES просто копирует файлы.<br />
<br />
Пример:<br />
<br />
FILES="/etc/modprobe.d/modprobe.conf"<br />
<br />
BINARIES="/usr/bin/somefile"<br />
<br />
== Создание образа ==<br />
<br />
=== Пересоздание предопределенного образа / использование предустановок ===<br />
<br />
Если вы хотите перегенерировать образы, используйте команду<br />
# mkinitcpio -p kernel26<br />
Это пример для пакета ''kernel26'', но вы можете выполнить аналогичную команду и для других ядер.<br />
<br />
Если вы хотите изменить настройки образов, отредактируйте ''/etc/mkinitcpio.d/kernel26.preset'' (для пакета kernel26). '''Эти ''.preset'' файлы также будут использованы при обновлении ядра, не испортите их!'''<br />
<br />
=== Вручную ===<br />
<br />
Создайте образ командой:<br />
<br />
mkinitcpio -g /boot/kernel26.img<br />
<br />
Она создаст образ для текущего ядра в файле '''/boot/kernel26.img''', который является образом для ядра из пакета '''kernel26'''. Пользователи '''kernel26beyond''' должны написать:<br />
<br />
mkinitcpio -g /boot/kernel26beyond.img<br />
<br />
Если вы хотите сгенерировать образ для ядра, которое в данный момент не загружено, используйте:<br />
<br />
mkinitcpio -g /boot/kernel26.img -k 2.6.16-ARCH<br />
<br />
==== Перегенерация fallback-образа ====<br />
<br />
''Замечание:'' Нижеследующий текст предназначен для создания образа для текущего ядра. Для других ядер используйте ключ -k.<br />
<br />
Fallback образ должен быть уже создан если вы установили '''kernel26''' или '''kernel26beyond''', но в случае если вы хотите его пересоздать используйте:<br />
<br />
mkinitcpio -c /boot/mkinitcpio.d/kernel26-fallback.conf -g /boot/kernel26.img<br />
для beyond ядер<br />
mkinitcpio -c /boot/mkinitcpio.d/kernel26beyond-fallback.conf -g /boot/kernel26beyond.img<br />
<br />
См. '''mkinitcpio -h''' чтобы увидеть другие опции.<br />
<br />
Не забудьте добавить запись в загрузчик. Просто скопируйте старую запись и измените путь к initrd. Будьте аккуратны, всегда имейте провереный вариант загрузки в списке загрузчика. Вы можете использовать mkinitcpio с любыми вариантами ядер (kernel26, kernel26-beyond...).<br />
<br />
== Изменения строки параметров ядра ==<br />
<br />
Не зависимо от наличия initramfs некоторые опции приходится передавать через строку параметров ядра, как например корневое устройство. Некоторые из обработчиков mkinitcpio имеют специальные опции. Они и обсуждаются в этой главе.<br />
<br />
Если вы не знаете, что такое строка параметров ядра, читайте документацию по [[GRUB]] или [[Lilo]].<br />
<br />
=== Вход в безотказный режим ===<br />
<br />
Если Вы добавите опцию<br />
break=y<br />
в строку параметров ядра, то init остановится после инициализации и вы получите ''dash'' шелл. Это может быть использовано, чтобы проверить, что все хорошо. После выхода загрузка продолжится в обычном режиме.<br />
<br />
=== Запрет обработчиков ===<br />
<br />
Вы можете запретить обработчики при помощи параметра ''disablehooks'' в строке параметров ядра:<br />
<br />
disablehooks=hook1,hook2,hook2<br />
<br />
например,<br />
<br />
disablehooks=resume<br />
<br />
=== Запрет загрузки модулей ===<br />
<br />
Вы можете запретить загрузку некоторых модулей добавив параметр ''disablemodules'' в строку параметров ядра:<br />
<br />
disablemodules=mod1,mod2,mod3<br />
<br />
например,<br />
<br />
disablemodules=ata_piix<br />
<br />
=== Использование raid ===<br />
Добавьте обработчик raid в список HOOKS в /etc/mkinitcpio.conf<br />
<br />
'''Параметры ядра: '''<br />
Укажите md массивы с помощью: md= parameter: (см. ниже).<br />
Простого добавления вашего raid массива достаточно.<br />
Пример: md=0,/dev/sda3,/dev/sda4 md=1,/dev/hda1,/dev/hdb1<br />
<br />
Затем добавьте следующее в строку kernel в '''grub/menu.lst''':<br />
Пример: md=0,/dev/sda3,/dev/sda4 md=1,/dev/hda1,/dev/hdb1<br />
Т.е. это будет выглядеть так:<br />
kernel /vmlinuz26beyond root=/dev/md0 ro md=0,/dev/sda1,/dev/sdb1<br />
Эта строка создает два md массива с постоянными суперблоками<br />
<br />
'''Настройка:'''<br />
- для старых raid массивов без постоянных суперблоков:<br />
md=<номер устройства md>,<уровень raid>,<chunk size factor>,<fault level>,dev0,dev1<br />
- для raid массивом с постоянными суперблоками:<br />
md=<номер устройства md>,dev0,dev1,...,devn<br />
- для сборки partitionable массивов:<br />
md=d<md device no.>,dev0,dev1,...,devn<br />
<br />
'''Параметры:'''<br />
- <номер устройства md> = номер устройства:<br />
0 значит md0, 1 значит md1, ...<br />
- <уровень raid> = -1 линейный режим, 0 striped режим<br />
другие режимы поддерживаются только с постоянным суперблоком<br />
- <chunk size factor> = (только для raid-0 и raid-1):<br />
Установить chunk size as 4k << n.<br />
- <fault level> = игнорируется<br />
- <dev0-devn>: т.е. /dev/hda1,/dev/hdc1,/dev/sda1,/dev/sdb1<br />
<br />
=== Использование net ===<br />
<br />
'''Параметры ядра:''' <br />
<br />
'''ip=''' <br />
<br />
Описание интерфейса может быть в короткой форме, которая состоит просто из имени интерфейса (eth0 или какой либо еще), или в длинной форме. Длинная форма содержит семь элементов, разделенных двоеточием:<br />
<br />
ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf><br />
nfsaddrs= это алиас для ip= и может использоваться также.<br />
<br />
''Разъяснение параметров:''<br />
<client-ip> IP адрес клиента. Если пустой, то автоматически назначается<br />
протоколом RARP/BOOTP/DHCP. Какой протокол используется<br />
зависит от параметра <autoconf>. Если его значение не пустое,<br />
то autocnf работает корректно.<br />
<br />
<server-ip> IP адрес NFS сервера. Если используется RARP для определения<br />
адреса клиента и этот параметр не пуст, то принимаются ответы<br />
только от указанного сервера.<br />
Для использования разных RARP и NFS серверов,<br />
укажите ваш RARP сервер здесь (или оставьте пустым), и<br />
укажите ваш NFS сервер в параметре `nfsroot'<br />
(см. выше). Если тут пусто, будет использован сервер, ответивший<br />
на RARP/BOOTP/DHCP запрос.<br />
<br />
<gw-ip> IP адрес шлюза если сервер в другой подсети. Если тут пусто,<br />
предполагается, что сервер находится в одной подсети, если значение<br />
не получено по BOOTP/DHCP.<br />
<br />
<netmask> Маска подсети для локального интерфейса. Если тут пусто,<br />
используется маска по умолчанию в зависимости от класса IP,<br />
если конечно не переопределена значением из BOOTP/DHCP ответа.<br />
<br />
<hostname> Имя машины клиента. Если пусто, используется IP адрес в виде ASCII<br />
строки, или значение полученное по BOOTP/DHCP.<br />
<br />
<device> Имя сетевого устройства. Если тут пусто, все устройства будут использованы<br />
для RARP/BOOTP/DHCP запросов, и все настройки будут получены из первого<br />
пришедшего ответа. Если вы имеете только одно сетевое устройство, можно спокойно<br />
оставить поле пустым.<br />
<br />
<autoconf> Какой метод использовать для автонастройки: 'rarp', 'bootp', или 'dhcp'.<br />
Если значение 'both', 'all' или пусто, все протоколы будут использованы.<br />
'off', 'static' или 'none' означают запрет автонастройки.<br />
''Примеры:''<br />
ip=127.0.0.1:::::lo:none --> Разрешить lo интерфейс.<br />
ip=192.168.1.1:::::eth2:none --> Статический eth2 интерфейс.<br />
ip=:::::eth0:dhcp --> Разрешить dhcp протокол для настройки интерфейса eth0.<br />
'''nfsroot='''<br />
<br />
Если параметр 'nfsroot' НЕ передан, будет использовано значение по умолчанию "/tftpboot/%s".<br />
<br />
nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]<br />
<br />
''Описание параметров:''<br />
<br />
<server-ip> IP адрес NFS сервера. Если параметр отсутствует<br />
адрес по умолчанию определяется по переменной<br />
`ip' (см. ниже). Одно из применений этого параметра -<br />
использование разных серверов для <br />
RARP и NFS. Обычно можете оставить этот параметр пустым.<br />
<br />
<root-dir> Путь к директории, которая будет корневой на клиенте. Если тут<br />
написано "%s", то оно будет заменено на ASCII представление IP<br />
клиента.<br />
<br />
<nfs-options> Стандартные опции NFS. Все опции разделены запятыми.<br />
Если опция отсутствует будут использованы следующие значения по умолчанию:<br />
port = как скажет portmap демон на сервере<br />
rsize = 1024<br />
wsize = 1024<br />
timeo = 7<br />
retrans = 3<br />
acregmin = 3<br />
acregmax = 60<br />
acdirmin = 30<br />
acdirmax = 60<br />
flags = hard, nointr, noposix, cto, ac<br />
<br />
'''root=/dev/nfs'''<br />
Если вы не используете параметр nfsroot=, вам нужно установить root=/dev/nfs <br />
для загрузки с автонастройкой корня в nfs.<br />
<br />
=== Использование lvm ===<br />
<br />
Если ваш корень находится на lvm, вы должны добавить обработчик '''lvm2'''. Также, вы должны передать имя корневого устройства ядру в формате<br />
<br />
root=/dev/mapper/<имя-группы-томов>-<логическое-имя-тома><br />
<br />
например<br />
<br />
root=/dev/mapper/myvg-root<br />
<br />
=== Использование шифрования на корневом разделе ===<br />
<br />
Если ваш корневой раздел зашифрован, вы должны добавить обработчик '''encrypt'''. Затем укажите ядру корневой раздел также, как если бы он не был зашифрован.<br />
<br />
Например для sata/scsi:<br />
root=/dev/sda5<br />
<br />
или для зашифрованного lvm:<br />
root=/dev/mapper/myvg-root<br />
<br />
Корневое устройство автоматически поменяется на ''/dev/mapper/root''.<br />
<br />
==== Использование LUKS томов ====<br />
<br />
Если вы используете LUKS для шифровани дисков, скрипт инициализации поймет это автоматически, если вы указали обработчик '''encrypt'''. Он спросит пароль для разблокирования тома.<br />
<br />
Если этого не происходит, попробуйте добавить filesystem-module в список модулей в фале /etc/mkinitcpio.conf если он не вкомпилирован в ядро.<br />
<br />
==== Использование legacy cryptsetup томов ====<br />
<br />
Если вы используете legacy cryptsetup том, вы должны указать все опции, необходимые для его разблокировки в строке параметров ядра. Опции формата<br />
<br />
crypto=hash:cipher:keysize:offset:skip<br />
<br />
представляют опции cryptsetup: --hash, --cipher, --keysize, --offset и --skip. Если вы пропустите опцию, будет использовано значение по умолчанию, т.е. вы можете написать просто<br />
<br />
crypto=::::<br />
<br />
если вы создали том с настройками по умолчанию.<br />
<br />
'''ЗАМЕЧАНИЕ:''' По техническим причинам невозможно проверить корректность пароля для legacy cryptsetup тома. Если вы ошибетесь, у вас просто не получится его смонтировать. Рекомендуется использовать LUKS вместо legacy cryptsetup.<br />
<br />
==== Использование loop-aes томов ====<br />
<br />
'''mkinitcpio''' пока не поддерживает loop-aes.<br />
<br />
== Использование спящего режима (на диск) ==<br />
<br />
Если вы хотите, чтобы ваш компьютер засыпал на диск, вы должны добавить обработчик '''resume'''.<br />
<br />
==== swsusp ====<br />
<br />
''TODO''<br />
<br />
==== µswsusp ====<br />
<br />
µswsusp пока не поддерживается.<br />
<br />
==== suspend2 ====<br />
<br />
Если вы используете [[Suspend to Disk|suspend2]], вы должны указать обработчик ''resume2'' в параметрах ядра. Если вы используете запись в своп, пишите:<br />
<br />
resume2=swap:/dev/hda3<br />
<br />
где ''/dev/hda3'' ваш своп раздел. Если вы пишите память в файл, используйте<br />
<br />
resume2=file:/dev/hda2:0x123456<br />
<br />
где ''/dev/hda2'' раздел с файлом (обычно корневой раздел) и ''0x123456'' - смещение до файла. Вы можете получить его с помощью команд:<br />
<br />
echo "/suspend2_file" > /proc/suspend2/filewriter_target<br />
cat /proc/suspend2/resume2<br />
<br />
где /suspend2_file - путь к файлу, куда записывается образ памяти. Это (естественно) работает и для томов lvm. Также можно использовать и зашифрованные разделы<br />
<br />
resume2=file:/dev/mapper/root:0x123456<br />
<br />
где ''0x123456'' снова смещение. Восстановление с зашифрованного своп раздела не поддерживается.<br />
<br />
=== Примеры конфигурационных файлов загрузчиков ===<br />
<br />
Если Вы используете beyond kernel, замените имена фалов ''kernel26.img'' и ''kernel26-fallback.img'' на ''kernel26beyond.img'' и ''kernel26beyond-fallback.img'' соответственно. Так же замените "vmlinuz26" на "vmlinuz26beyond".<br />
<br />
==== GRUB ====<br />
<br />
Для тех у кого /boot на отдельном разделе диска:<br />
<br />
# (0) Arch Linux<br />
title Arch Linux<br />
root (hd0,3)<br />
kernel /vmlinuz26 root=/dev/hda4 vga=791 ro<br />
initrd /kernel26.img<br />
<br />
title Arch Linux Fallback<br />
root (hd0,3)<br />
kernel /vmlinuz26 root=/dev/hda4 vga=791 ro<br />
initrd /kernel26-fallback.img<br />
<br />
Для тех у кого /boot '''не''' на отдельном разделе диска:<br />
<br />
# (0) Arch Linux<br />
title Arch Linux<br />
root (hd0,3)<br />
kernel /boot/vmlinuz26 root=/dev/hda4 vga=791 ro<br />
initrd /boot/kernel26.img<br />
<br />
title Arch Linux Fallback<br />
root (hd0,3)<br />
kernel /boot/vmlinuz26 root=/dev/hda4 vga=791 ro<br />
initrd /boot/kernel26-fallback.img<br />
<br />
==== LILO ====<br />
<br />
Если Вы используете загрузчик LILO, то рекомендуется использовать ''append="root=/dev/XYZ"'' вместо ''root=/dev/XYZ''. Если у Вас уже есть глобальная опция ''append'', тогда используйте ''addappend''.<br />
<br />
boot=/dev/hdX <br />
default = ArchLinux<br />
timeout=50 <br />
vga=791<br />
lba32<br />
prompt<br />
<br />
# для образа автоопределения железа<br />
image=/boot/vmlinuz26<br />
label=ArchLinux<br />
append="root=/dev/hdXY"<br />
initrd=/boot/kernel26.img<br />
read-only<br />
<br />
# fallback image если другие образы не работают (Will most prob. never be used)<br />
image=/boot/vmlinuz26<br />
label=ArchLinuxFallBack<br />
append="root=/dev/hdXY"<br />
initrd=/boot/kernel26-fallback.img<br />
read-only<br />
<br />
== Возможные проблемы ==<br />
=== piix ide контролер и ядро beyond ===<br />
==== Проблема ====<br />
Если mkinitcpio не хочет определять ваш жесткий диск выдавая ошибки вида "Can't find device dev(0,0)" при переключении kinit, то это скорее всего из-за конфликта между драйвером ata_piix и piix. Ядро beyond содержит несколько патчей libata которые вызывают *конфликт* ata_piix с piix.<br />
<br />
==== Решение ====<br />
Измените /etc/mkinitcpio.conf так, чтобы он содержал только одну запись: или ide, или sata, или scsi, в зависимости от того откуда вы хотите загружать систему.<br />
<br />
== Я параноик! ==<br />
Если вам действительно нужно знать, что включено в initrd, вы можете вытаскивать и класть внутрь образа файлы. Это просто cpio архив, но...<br />
<br />
=== Предупреждение о cpio ===<br />
Использование cpio для извлечения опасно (от root'а), так как оно пытается извлечь файлы в /, ломая существующую систему загрузки. Для исправления, вам придется переставить все пакеты, файлы которых были перезаписаны с помощью pacman.static. Список файлов выдаст команда bsdtar -t -f kernel26.img<br />
=== Использование bsdtar для извлечения ===<br />
bsdtar извлекает файлы в текущий каталог.<br />
<br />
Используйте команду:<br />
bsdtar -x -f /boot/kernel26.img</div>Zunguguzunguzenghttps://wiki.archlinux.org/index.php?title=Partitioning_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)&diff=166245Partitioning (Русский)2011-10-17T03:37:46Z<p>Zunguguzunguzeng: /* Content from BG */</p>
<hr />
<div>{{i18n|Partitioning}}<br />
{{translateme}}<br />
{{stub}}<br />
<br />
{{Note|В настоящий момент статья переводится. Вы можете помочь завершить перевод скорее :)}}<br />
{{Warning|Оригинальная английская статья ещё не завершена, к моменту начала перевода текст может оказаться устаревшим.}}<br />
<br />
== Обзор ==<br />
<br />
* Что такое разделы жёсткого диска?<br />
* Зачем разбивать на разделы жёсткий диск?<br />
<br />
'''Разбиение''' жёсткого диска позволяет логически разделить всё доступное пространство на части, которые будут независимыми друг от друга. Информация о разделах хранится внутри MBR жёсткого диска.<br />
<br />
Существует несколько причин для разбиение диска на разделы:<br />
* на компьютере используется несколько операционных систем (двойная, мультизагрузка)<br />
* есть необходимость использовать раздел подкачки swap<br />
* необходимо разделить данные логически (например, видеоклипы от фонотеки)<br />
* и др.<br />
<br />
{{Box YELLOW|Важно:|На диске может быть до 4 "первичных" (primary) разделов, или же до 3 первичных + 1 расширенный (extended) раздел. Расширенный раздел служит "контейнером" для "логических" разделов, последних может быть сколько угодно.}}<br />
<br />
'''Все разделы первичные'''<br />
+-------------+-------------+-------------+---------------------------------+<br />
| Первичный 1 | Первичный 2 | Первичный 3 | Первичный 4 |<br />
+-------------+-------------+-------------+---------------------------------+<br />
<br />
'''Два первичных раздела и один расширенный, с двумя логическими'''<br />
+----------------+------------------+---------------------------------------+<br />
| Первичный 1 | Первичный 2 | Расширенный |<br />
| | | +--------------------+--------------+ |<br />
| | | | Логический 1 | Логический 2 | |<br />
| | | +-----------------------------------+ |<br />
+----------------+------------------+-------------+-------------------------+<br />
<br />
== Инструменты для работы с разделами ==<br />
* fdisk & cfdisk<br />
* GNU Parted<br />
* QtParted & GParted<br />
<br />
== Стратегии разбиения на разделы ==<br />
* "Всё в одном"<br />
* Отдельный раздел /boot<br />
* Отдельный разделSeparate /home<br />
* Отдельный разделSeparate /var<br />
* Отдельный разделSeparate /usr<br />
<br />
== Важные моменты ==<br />
* Размеры разделов <!-- separate section, or combined with schemes? --><br />
* Файловые системы<br />
* LVM<br />
<br />
==Creating new partitions==<br />
<br />
==Resizing partitions==<br />
<br />
==Content from BG==<br />
<br />
{{Warning|Операции над разделами жёсткого диска могут привести к потере данных. Настоятельно рекомендуем Вам создавать резервные копии важной информации.}}<br />
<br />
{{Warning|Нажатие кнопки Cancel, в меню подготовки жёсткого диска, не отменит выбранные операции - смотри {{Bug|19805}}. Если вам необходимо прервать установку в этом месте, нажмите <Control>+C, чтобы полностью и немедленно покинуть установщик.}}<br />
<br />
{{Note|Разбиение жесткого диска, при желании, можно провести до установки Archlinux, например используя [http://gparted.sourceforge.net/download.php GParted] или другой подобный инструмент. Если диск уже был разбит до установки, то начните с [[#Set Filesystem Mountpoints| Set Filesystem Mountpoints]]}}<br />
<br />
Посмотреть на текущую таблицу разделов можно с помощью программы <code>/sbin/fdisk</code> с ключом <code>-l</code> (маленькая L).<br />
<br />
Откройте другую виртуальную консоль (<ALT>+F3) и введите:<br />
# fdisk -l<br />
Отметьте для себя все диски/разделы, которые вы будите использовать при установке Arch.<br />
<br />
Вернитесь назад в консоль, где запущен скрипт установки <ALT>+F1<br />
<br />
Выберете пункт &quot;Prepare Hard Drive&quot;.<br />
* Вариант 1: Auto Prepare<br />
Этот пункт поделит диск со следующими параметрами:<br />
<br />
* Загрузочный раздел с ФС ext2; точка монтирования: /boot; размер по умолчанию: 32MB. ''Вам будет предложено изменить размер по своему усмотрению.''<br />
* Раздел подкачки swap, размер по умолчанию: 256MB. ''Вам будет предложено изменить размер по своему усмотрению.''<br />
* Отдельные корневой(/) и /home разделы, (размеры тоже можно указать вручную). Возможные файловые системы: ext2, ext3, ext4, reiserfs, xfs and jfs, однако, обратите внимание, что при выборе опции Auto Prepare, файловые системы ''/ и /home будут одного типа''.<br />
<br />
Будьте внимательны, опция Auto-prepare полностью сотрёт выбранный жёсткий диск. Внимательно прочитайте <font color="red">предупреждение</font>, предоставленное установщиком, и убедитесь,что действия производятся над нужным разделом.<br />
<br />
* Вариант 2: '''(Рекомендуемый)''' Partition Hard Drives (with cfdisk)<br />
<br />
Эта опция предоставит наиболее надёжный и настраиваемый способ разбивки, отвечающий вашим персональным нуждам.<br />
<br />
''Здесь более продвинутые пользователи GNU/Linux, хорошо знакомые с ручной разбивкой диска, могут сразу перейти к разделу '''[[#D: Select Packages|D: Select Packages]]'''.''<br />
<br />
{{Note|Если вы устанавливаете систему на USB flash носитель, смотрите "[[Installing Arch Linux on a USB key]]".}}<br />
<br />
====Partition Hard Drives====<br />
<br />
=====Partition Info=====<br />
<br />
Partitioning a hard disk drive defines specific areas (the partitions) within the disk, that will each appear and behave as a separate disk and upon which a filesystem may be created (formatted).<br />
*There are 3 types of disk partitions:<br />
#Primary<br />
#Extended<br />
#Logical<br />
'''Primary''' partitions can be bootable, and are limited to 4 partitions per disk or raid volume. If a partitioning scheme requires more than 4 partitions, an '''extended''' partition which will contain '''logical''' partitions will be required.<br />
<br />
Extended partitions are not usable by themselves; they are merely a &quot;container&quot; for logical partitions. If required, a hard disk shall contain only one extended partition; which shall then be sub-divided into logical partitions.<br />
<br />
When partitioning a disk, one can observe this numbering scheme by creating primary partitions sda1 through sda3 followed by creating an extended partition, sda4, and subsequently creating logical partition(s) within the extended partition; sda5, sda6, and so on.<br />
<br />
=====Swap Partition=====<br />
A swap partition is a place on the drive where virtual ram resides, allowing the kernel to easily use disk storage for data that does not fit into physical RAM.<br />
<br />
Historically, the general rule for swap partition size was 2x the amount of physical RAM. Over time, as computers have gained ever larger memory capacities, this rule has become increasingly deprecated. Generally, on machines with up to 512MB RAM, the 2x rule is usually quite sufficient. If the installation machine provides gratuitous amounts of RAM (more than 1024 MB) it may be possible to completely forget a swap partition altogether, since the option to create a [[HOW TO: Create swap file|swap file]] is always available later. A 1 GB swap partition will be used in this example.<br />
{{Note|If using suspend-to-disk, (hibernate) a swap partition at least '''equal''' in size to the amount of physical RAM is required. Some Arch users even recommend oversizing it beyond the amount of physical RAM by 10-15%, to allow for possible bad sectors.}}<br />
<br />
=====Partition Scheme=====<br />
A disk partitioning scheme is a very personalized preference. Each user's choices will be unique to their own computing habits and requirements. If you would like to dual boot Arch Linux and a Windows operating system please see [[Windows and Arch Dual Boot]].<br />
<br />
Filesystem candidates for separate partitions include:<br />
<br />
'''/''' (root) ''The root filesystem is the primary filesystem from which all other filesystems stem; the top of the hierarchy. All files and directories appear under the root directory &quot;/&quot;, even if they are stored on different physical devices. The contents of the root filesystem must be adequate to boot, restore, recover, and/or repair the system. Therefore, certain directories under / are not themselves candidates for separate partitions. (See warning below).''<br />
<br />
'''/boot''' ''This directory contains the kernel and ramdisk images as well as the bootloader configuration file, and bootloader stages. /boot also stores data that is used before the kernel begins executing userspace programs. This may include saved master boot sectors and sector map files. /boot is essential for booting, but is unique in that it may still be kept on its own separate partition (if required).''<br />
<br />
'''/home''' ''Provides subdirectories, each named for a system user, for miscellaneous personal data storage as well as user-specific configuration files for applications.''<br />
<br />
'''/usr''' ''While root is the primary filesystem, /usr is the secondary hierarchy for all system users' data, including the majority of multi-user utilities and applications. /usr is shareable, read-only data. This means that /usr shall be shareable between various hosts and must not be written to, except in the case of system update/upgrade. Any information that is host-specific or varies with time is stored elsewhere.''<br />
<br />
'''/tmp''' ''directory for programs that require temporary files such as '.lck' files, which can be used to prevent multiple instances of their respective program until a task is completed, at which point the '.lck' file will be removed. Programs must not assume that any files or directories in /tmp are preserved between invocations of the program and files and directories located under /tmp will typically be deleted whenever the system is booted.''<br />
<br />
'''/var''' ''contains variable data; spool directories and files, administrative and logging data, pacman's cache, the ABS tree, etc. /var exists in order to make it possible to mount /usr as read-only. Everything that historically went into /usr that is written to during system operation (as opposed to installation and software maintenance) must reside under /var.''<br />
{{Warning | Besides /boot, directories essential for booting are: ''''''/bin', '/etc', '/lib', and '/sbin'. Therefore, they must not reside on a separate partition from /.'''''}}<br />
'''''There are several advantages for using discrete filesystems, rather than combining all into one partition''''':<br />
<br />
* Security: Each filesystem may be configured in /etc/fstab as 'nosuid', 'nodev', 'noexec', 'readonly', etc.<br />
* Stability: A user, or malfunctioning program can completely fill a filesystem with garbage if they have write permissions for it. Critical programs, which reside on a different filesystem remain unaffected.<br />
* Speed: A filesystem which gets written to frequently may become somewhat fragmented. (An effective method of avoiding fragmentation is to ensure that each filesystem is never in danger of filling up completely.) Separate filesystems remain unaffected, and each can be defragmented separately as well.<br />
* Integrity: If one filesystem becomes corrupted, separate filesystems remain unaffected.<br />
* Versatility: Sharing data across several systems becomes more expedient when independent filesystems are used. Separate filesystem types may also be chosen based upon the nature of data and usage.<br />
In this example, we shall use separate partitions for /, /var, /home, and a swap partition.<br />
<br />
{{Note | /var contains many small files. This should be taken into consideration when choosing a filesystem type for it, (if creating its own separate partition).}}<br />
<br />
=====How big should my partitions be?=====<br />
This question is best answered based upon individual needs.<br />
You may wish to simply create '''one partition for root and one partition for swap or only one root partition without swap''' or refer to the following examples and consider these guidelines to provide a frame of reference:<br />
* The root filesystem (/) in the example will contain the /usr directory, which can become moderately large, depending upon how much software is installed. 15-20 GB should be sufficient for most users.<br />
<br />
* The /var filesystem will contain, among other data, the [[ABS]] tree and the pacman cache. Keeping cached packages is useful and versatile; it provides the ability to downgrade packages if needed. /var tends to grow in size; the pacman cache can grow large over long periods of time, but can be safely cleared if needed. If you are using an SSD, you may wish to locate your /var on an HDD and keep the / and /home partitions on your SSD to avoid needless read/writes to the SSD. 8-12 Gigs on a desktop system should be sufficient for /var, depending largely upon how much software you intend to install. Servers tend to have relatively larger /var filesystems.<br />
<br />
* The /home filesystem is typically where user data, downloads, and multimedia reside. On a desktop system, /home is typically the largest filesystem on the drive by a large margin. Remember that if you chose to reinstall Arch, all the data on your /home partition will be untouched (so long as you have a separate /home partition). <br />
<br />
* An extra 25% of space added to each filesystem will provide a cushion for unforeseen occurrence, expansion, and serve as a preventive against fragmentation.<br />
'''''From the guidelines above, the example system shall contain a ~15GB root (/) partition, ~10GB /var, 1GB swap, and a /home containing the remaining disk space.'''''<br />
<br />
=====Create Partition:cfdisk=====<br />
Start by creating the primary partition that will contain the '''root''', (/) filesystem.<br />
<br />
Choose '''N'''ew -> Primary and enter the desired size for root (/). Put the partition at the beginning of the disk.<br />
<br />
Also choose the '''T'''ype by designating it as '83 Linux'. The created / partition shall appear as sda1 in our example.<br />
<br />
Now create a primary partition for /var, designating it as '''T'''ype 83 Linux. The created /var partition shall appear as sda2<br />
<br />
Next, create a partition for swap. Select an appropriate size and specify the '''T'''ype as 82 (Linux swap / Solaris). The created swap partition shall appear as sda3.<br />
<br />
Lastly, create a partition for your /home directory. Choose another primary partition and set the desired size.<br />
<br />
Likewise, select the '''T'''ype as 83 Linux. The created /home partition shall appear as sda4.<br />
<br />
Example:<br />
<br />
Name Flags Part Type FS Type [Label] Size (MB)<br />
-------------------------------------------------------------------------<br />
sda1 Primary Linux 15440 #root<br />
sda2 Primary Linux 10256 #/var<br />
sda3 Primary Linux swap / Solaris 1024 #swap<br />
sda4 Primary Linux 140480 #/home<br />
<br />
Choose '''W'''rite and type ''''yes''''. Beware that this operation may destroy data on your disk. Choose '''Q'''uit to leave the partitioner.<br />
Choose Done to leave this menu and continue with &quot;Set Filesystem Mountpoints&quot;.<br />
<br />
{{Note | Since the latest developments of the Linux kernel which include the libata and PATA modules, all IDE, SATA and SCSI drives have adopted the sd''x'' naming scheme. This is perfectly normal and should not be a concern.}}<br />
<br />
====Set Filesystem Mountpoints====<br />
Specify each partition and corresponding mountpoint to your requirements. (Recall that partitions end in a number. Therefore, '''sda''' is not itself a partition, but rather, signifies an entire drive)<br />
<br />
=====Filesystem Types=====<br />
Again, a filesystem type is a very subjective matter which comes down to personal preference. Each has its own advantages, disadvantages, and unique idiosyncrasies. Here is a very brief overview of supported filesystems:<br />
<br />
1. '''ext2''' ''Second Extended Filesystem''- Old, reliable GNU/Linux filesystem. Very stable, but ''without journaling support''. May be inconvenient for root (/) and /home, due to very long fsck's. ''An ext2 filesystem can easily be converted to ext3.'' Generally regarded as a good choice for /boot/.<br />
<br />
2. '''ext3''' ''Third Extended Filesystem''- Essentially the ext2 system, but with journaling support. ext3 is backward compatible with ext2. Extremely stable, mature, and by far the most widely used, supported and developed GNU/Linux FS.<br />
<br />
'''High Performance Filesystems:'''<br />
<br />
3. '''ext4''' ''Fourth Extended Filesystem''- Backward compatible with ext2 and ext3. Introduces support for volumes with sizes up to 1 exabyte and files with sizes up to 16 terabytes. Increases the 32,000 subdirectory limit in ext3 to 64,000. Offers online defragmentation ability. <br />
<br />
4. '''ReiserFS''' (V3)- Hans Reiser's high-performance journaling FS uses a very interesting method of data throughput based on an unconventional and creative algorithm. ReiserFS is touted as very fast, especially when dealing with many small files. ReiserFS is fast at formatting, yet comparatively slow at mounting. Quite mature and stable. ReiserFS is not actively developed at this time (Reiser4 is the new Reiser filesystem). Generally regarded as a good choice for /var/.<br />
<br />
5. '''JFS''' - IBM's '''J'''ournaled '''F'''ile'''S'''ystem- The first filesystem to offer journaling. JFS had many years of use in the IBM AIX® OS before being ported to GNU/Linux. JFS currently uses the least CPU resources of any GNU/Linux filesystem. Very fast at formatting, mounting and fsck's, and very good all-around performance, especially in conjunction with the deadline I/O scheduler. (See [[JFS]].) Not as widely supported as ext or ReiserFS, but very mature and stable.<br />
<br />
6. '''XFS''' - Another early journaling filesystem originally developed by Silicon Graphics for the IRIX OS and ported to GNU/Linux. XFS offers very fast throughput on large files and large filesystems. Very fast at formatting and mounting. Generally benchmarked as slower with many small files, in comparison to other filesystems. XFS is very mature and offers online defragmentation ability.<br />
* JFS and XFS filesystems cannot be ''shrunk'' by disk utilities (such as gparted or parted magic)<br />
<br />
===== A note on Journaling=====<br />
All above filesystems, except ext2, utilize [http://en.wikipedia.org/wiki/Journaling_file_system journaling]. Journaling file systems are fault-resilient file systems that use a journal to log changes before they are committed to the file system to avoid metadata corruption in the event of a crash. Note that not all journaling techniques are alike; specifically, only ext3 and ext4 offer ''data-mode journaling'', (though, not by default), which journals ''both'' data ''and'' meta-data (but with a significant speed penalty). The others only offer ''ordered-mode journaling'', which journals meta-data only. While all will return your filesystem to a valid state after recovering from a crash, ''data-mode journaling'' offers the greatest protection against file system corruption and data loss but can suffer from performance degradation, as all data is written twice (first to the journal, then to the disk). Depending upon how important your data is, this may be a consideration in choosing your filesystem type.<br />
<br />
'''''Moving on...'''''<br />
<br />
Choose and create the filesystem (format the partition) for / by selecting '''yes'''. You will now be prompted to add any additional partitions. In our example, sda2 and sda4 remain. For sda2, choose a filesystem type and mount it as /var. Finally, choose the filesystem type for sda4, and mount it as /home. <br />
{{Box Note |If you have not created and do not need a separate /boot partition, you may safely ignore the warning that it does not exist.}} Return to the main menu.</div>Zunguguzunguzeng