https://wiki.archlinux.org/api.php?action=feedcontributions&user=Spatz&feedformat=atomArchWiki - User contributions [en]2024-03-29T04:40:42ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Ruby&diff=143200Ruby2011-05-30T18:29:55Z<p>Spatz: /* Bundler */ Fix previous change of mine with correct install locations</p>
<hr />
<div>[[Category:Development (English)]]<br />
Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.<br />
<br />
== Installing Ruby ==<br />
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here's a summary of the versions below and how to get them:<br />
<br />
=== Ruby 1.9 (Development) ===<br />
'''Summary:''' Use Ruby 1.9 for a new new Rails project, or when you're sure all your required gems are supported by Ruby 1.9<br />
<br />
Pros:<br />
* Vastly improved performance over 1.8<br />
* New features for concurrency such as fibers.<br />
* Various other language improvements, such as an improved CSV parser.<br />
<br />
Cons:<br />
* Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)<br />
* Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.<br />
<br />
{{Box Note | Visit http://isitruby19.com/ to determine if the gems/modules you require are compatible with Ruby 1.9 }}<br />
<br />
To install Ruby 1.9, simply run:<br />
# pacman -S ruby<br />
<br />
Ruby 1.9 also includes RubyGems (detailed below), so you can easily update to the latest RubyGems using:<br />
# gem update --system<br />
<br />
=== Ruby 1.8.7 (Stable) ===<br />
'''Summary:''' Use Ruby 1.8.7 if you're unsure, or are not working on any legacy systems.<br />
<br />
Pros:<br />
* Latest version of the 1.8 branch, capable of running most if not all recently updated gems and Ruby On Rails<br />
<br />
Cons:<br />
* Introduces certain breaking changes from 1.8.6, which causes older lesser-maintained gems and Rails prior to 2.0 not to work without "monkey patching".<br />
<br />
You can install [http://aur.archlinux.org/packages.php?ID=30221 ruby1.8] from the [[AUR]].<br />
<br />
RubyGems is not included with the ruby1.8 package, so install [http://aur.archlinux.org/packages.php?ID=30224 rubygems1.8] from the [[AUR]].<br />
<br />
=== Ruby 1.8.6 (Legacy) ===<br />
'''Summary:''' Use Ruby 1.8.6 if you are working on old project, older version of Rails (especially < 2.0), or simply want the least possible issues.<br />
<br />
Pros:<br />
* Compatible with just about anything <br />
<br />
Cons:<br />
* Missing some performance and language enhancements from 1.8.7<br />
* Support might be dropped with Rails 3.0 (in Beta at the time of writing)<br />
<br />
You can install [http://aur.archlinux.org/packages.php?ID=36898 ruby1.8.6-legacy] from the [[AUR]]. <br />
<br />
RubyGems is not included with the ruby1.8.6-legacy package, so install [http://aur.archlinux.org/packages.php?ID=33312 rubygems] from the [[AUR]].<br />
<br />
{{Box Note | This package will replace the official "ruby" package, as installing both Ruby 1.8 and 1.9 while possible, can cause erratic behaviour of some 3rd party code }}<br />
<br />
=== Multiple versions ===<br />
If you want to run multiple versions on the same system (e.g. '''1.9.1''' and '''1.8.7'''), the easiest way is to use [[RVM]].<br />
<br />
== RubyGems ==<br />
''gem'' is the package manager of sorts for Ruby modules (called Gems), somewhat comparable to what pacman is to Arch Linux. The ''gem'' command will be installed if you followed the installation instructions above.<br />
<br />
=== Running as root ===<br />
When running gem as root, gems will be installed for everyone on the machine. This has the advantage of simplicity and is the most reliable method, but updating or installing gems without everyone's knowledge (like on a shared server) might cause Ruby applications to break.<br />
<br />
When not running gem as root, the gems will be installed into {{Filename|~/.gem}} and not affect anyone else, although it might be worth noting that not all gems are happy with be installed in this way, and might insist on being installed by root (especially if they have native extensions).<br />
<br />
[[Ruby#Bundler|Bundler]] solves these problems to some extent by packaging gems into your application. See the section below on using bundler.<br />
<br />
=== Updating RubyGems ===<br />
# gem update --system<br />
<br />
=== Installing a gem ===<br />
This example installs the MySQL ruby gem:<br />
# gem install mysql<br />
<br />
The process can be speeded up somewhat if you don't need local documentation:<br />
# gem install mysql --no-rdoc --no-ri<br />
<br />
The gem will now be downloaded, compiled if necessary, and installed.<br />
<br />
=== Bundler ===<br />
[http://github.com/carlhuda/bundler Bundler] installs gems (including those with native extensions) directly into your application, which works very well for shared hosting and easy deployment of [[Ruby on Rails]] applications for example. Bundler also resolves dependencies as a whole, rather than individually like RubyGems, making things a lot easier.<br />
<br />
It might be a good idea to install bundler as a system-wide gem so everyone can use it:<br />
# gem install bundler<br />
<br />
To start a new bundle:<br />
$ bundle init<br />
<br />
Then add your required gems into "Gemfile" in the current directory (created by bundle init):<br />
<br />
{{File|name=Gemfile|content=<br />
gem "rails", "2.3.4"<br />
gem "mysql"<br />
}}<br />
<br />
Finally, run the following to install your gems:<br />
$ bundle install<br />
<br />
Or, alternatively, in order to install locally to {{Filename|vendor/bundle}} under the working directory:<br />
$ bundle install --deployment<br />
<br />
== Managing RubyGems using pacman ==<br />
<br />
Instead of using the gem command directly you can use pacman to manage the installed gems like normal packages. There are a lot of ruby packages available from [[AUR]]. Ruby packages follow the naming convention ruby-[gemname]. As an alternative you can use the tool [https://aur.archlinux.org/packages.php?ID=46196 pacgem] which automatically creates arch packages from gems and installs them afterwards using pacman.<br />
<br />
== See also ==<br />
* [[Ruby On Rails]]<br />
<br />
== References ==<br />
* Ruby - http://ruby-lang.org/<br />
* Rubyforge - http://rubyforge.org<br />
* Bundler - http://github.com/carlhuda/bundler</div>Spatzhttps://wiki.archlinux.org/index.php?title=Ruby&diff=143187Ruby2011-05-30T13:54:37Z<p>Spatz: /* Bundler */ Bundles are installed in .bundle, not ~/.bundle</p>
<hr />
<div>[[Category:Development (English)]]<br />
Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.<br />
<br />
== Installing Ruby ==<br />
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here's a summary of the versions below and how to get them:<br />
<br />
=== Ruby 1.9 (Development) ===<br />
'''Summary:''' Use Ruby 1.9 for a new new Rails project, or when you're sure all your required gems are supported by Ruby 1.9<br />
<br />
Pros:<br />
* Vastly improved performance over 1.8<br />
* New features for concurrency such as fibers.<br />
* Various other language improvements, such as an improved CSV parser.<br />
<br />
Cons:<br />
* Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)<br />
* Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.<br />
<br />
{{Box Note | Visit http://isitruby19.com/ to determine if the gems/modules you require are compatible with Ruby 1.9 }}<br />
<br />
To install Ruby 1.9, simply run:<br />
# pacman -S ruby<br />
<br />
Ruby 1.9 also includes RubyGems (detailed below), so you can easily update to the latest RubyGems using:<br />
# gem update --system<br />
<br />
=== Ruby 1.8.7 (Stable) ===<br />
'''Summary:''' Use Ruby 1.8.7 if you're unsure, or are not working on any legacy systems.<br />
<br />
Pros:<br />
* Latest version of the 1.8 branch, capable of running most if not all recently updated gems and Ruby On Rails<br />
<br />
Cons:<br />
* Introduces certain breaking changes from 1.8.6, which causes older lesser-maintained gems and Rails prior to 2.0 not to work without "monkey patching".<br />
<br />
You can install [http://aur.archlinux.org/packages.php?ID=30221 ruby1.8] from the [[AUR]].<br />
<br />
RubyGems is not included with the ruby1.8 package, so install [http://aur.archlinux.org/packages.php?ID=30224 rubygems1.8] from the [[AUR]].<br />
<br />
=== Ruby 1.8.6 (Legacy) ===<br />
'''Summary:''' Use Ruby 1.8.6 if you are working on old project, older version of Rails (especially < 2.0), or simply want the least possible issues.<br />
<br />
Pros:<br />
* Compatible with just about anything <br />
<br />
Cons:<br />
* Missing some performance and language enhancements from 1.8.7<br />
* Support might be dropped with Rails 3.0 (in Beta at the time of writing)<br />
<br />
You can install [http://aur.archlinux.org/packages.php?ID=36898 ruby1.8.6-legacy] from the [[AUR]]. <br />
<br />
RubyGems is not included with the ruby1.8.6-legacy package, so install [http://aur.archlinux.org/packages.php?ID=33312 rubygems] from the [[AUR]].<br />
<br />
{{Box Note | This package will replace the official "ruby" package, as installing both Ruby 1.8 and 1.9 while possible, can cause erratic behaviour of some 3rd party code }}<br />
<br />
=== Multiple versions ===<br />
If you want to run multiple versions on the same system (e.g. '''1.9.1''' and '''1.8.7'''), the easiest way is to use [[RVM]].<br />
<br />
== RubyGems ==<br />
''gem'' is the package manager of sorts for Ruby modules (called Gems), somewhat comparable to what pacman is to Arch Linux. The ''gem'' command will be installed if you followed the installation instructions above.<br />
<br />
=== Running as root ===<br />
When running gem as root, gems will be installed for everyone on the machine. This has the advantage of simplicity and is the most reliable method, but updating or installing gems without everyone's knowledge (like on a shared server) might cause Ruby applications to break.<br />
<br />
When not running gem as root, the gems will be installed into {{Filename|~/.gem}} and not affect anyone else, although it might be worth noting that not all gems are happy with be installed in this way, and might insist on being installed by root (especially if they have native extensions).<br />
<br />
[[Ruby#Bundler|Bundler]] solves these problems to some extent by packaging gems into your application. See the section below on using bundler.<br />
<br />
=== Updating RubyGems ===<br />
# gem update --system<br />
<br />
=== Installing a gem ===<br />
This example installs the MySQL ruby gem:<br />
# gem install mysql<br />
<br />
The process can be speeded up somewhat if you don't need local documentation:<br />
# gem install mysql --no-rdoc --no-ri<br />
<br />
The gem will now be downloaded, compiled if necessary, and installed.<br />
<br />
=== Bundler ===<br />
[http://github.com/carlhuda/bundler Bundler] installs gems (including those with native extensions) directly into your application, which works very well for shared hosting and easy deployment of [[Ruby on Rails]] applications for example. Bundler also resolves dependencies as a whole, rather than individually like RubyGems, making things a lot easier.<br />
<br />
It might be a good idea to install bundler as a system-wide gem so everyone can use it:<br />
# gem install bundler<br />
<br />
To start a new bundle:<br />
$ bundle init<br />
<br />
Then add your required gems into "Gemfile" in the current directory (created by bundle init):<br />
<br />
{{File|name=Gemfile|content=<br />
gem "rails", "2.3.4"<br />
gem "mysql"<br />
}}<br />
<br />
Finally, run the following to install your gems. They will all be installed locally into {{Filename|.bundle}}, eliminating the need for root access:<br />
$ bundle install<br />
<br />
== Managing RubyGems using pacman ==<br />
<br />
Instead of using the gem command directly you can use pacman to manage the installed gems like normal packages. There are a lot of ruby packages available from [[AUR]]. Ruby packages follow the naming convention ruby-[gemname]. As an alternative you can use the tool [https://aur.archlinux.org/packages.php?ID=46196 pacgem] which automatically creates arch packages from gems and installs them afterwards using pacman.<br />
<br />
== See also ==<br />
* [[Ruby On Rails]]<br />
<br />
== References ==<br />
* Ruby - http://ruby-lang.org/<br />
* Rubyforge - http://rubyforge.org<br />
* Bundler - http://github.com/carlhuda/bundler</div>Spatzhttps://wiki.archlinux.org/index.php?title=Advanced_Linux_Sound_Architecture&diff=139574Advanced Linux Sound Architecture2011-05-03T19:43:06Z<p>Spatz: /* HDMI Output Does Not Work */ Move closing brace to new line</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:ALSA (English)]]<br />
{{i18n|ALSA|Advanced Linux Sound Architecture}}<br />
[[pl:Advanced Linux Sound Architecture (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 isn't 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 won't 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 />
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 />
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 doesn't 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 /etc/rc.conf to automatically restore the mixer settings at boot.<br />
{{Cli|# nano /etc/rc.conf}}<br />
DAEMONS=(syslog-ng network crond '''@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 />
If you want the PC speaker completely disabled, you can additionally add the following to:<br />
<br />
{{file |name=/etc/rc.conf |content=MODULES=(... !pcspkr)<br />
}}<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 />
<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, including the OSS compatibility modules. You can check this with the command<br />
<br />
$ lsmod|grep '^snd' | column -t<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,<br />
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 />
If the output looks similar, your sound drivers have been successfully autodetected (note that in this case, snd_intel8x0 and snd_usb_audio are the drivers for the hardware devices). 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 />
# modprobe snd-pcm-oss<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 don't 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 don't<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 uncomment the following<br />
# line and comment 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's 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 don't already have them.<br />
# pacman -S ladspa swh-plugins<br />
* If you haven't 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've just installed them. Once you've logged<br />
# out/restarted this shouldn't 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 />
==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 don't need to setup dmix. Dmix is enabled as default for soundcards which don't support hardware mixing.}}<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 <tt>ondemand</tt> or <tt>conservative</tt>. Currently, the solution is to switch back to the <tt>performance</tt> 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 can't 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 <code>ipc_key_add_uid 0</code> to the <code>pcm.dmixer</code> block disables this locking. The following is a snippet of the <code>asound.conf</code>, 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 0666<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 <code>/etc/asound.conf</code>:<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've copied the <code>/etc/asound.conf</code> 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 />
To make most programs use Alsa, make sure <code>/etc/libao.conf</code> only contains the following.<br />
default_driver=alsa10<br />
<br />
If you use mpd and the configuration tips above don't 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 <code>~/.mplayer/config</code> (or <code>/etc/mplayer/mplayer.conf</code> 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 <code>aoss</code>, 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 <code>alsamixer</code> (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 <code>/etc/modprobe.d/modprobe.conf</code>:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with <code>via82xx</code><br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with <code>snd_intel8x0</code><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). 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:<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
You may want to see arecord's man page to play with it a little bit. Anyway, if you are unable to hear anything, your microphone may be broken or in the wrong hole.<br />
<br />
Some programs use try to use OSS as the main input software. Add the following line to <code>/etc/rc.conf</code> to prevent OSS modules from being loaded:<br />
<br />
MODULES=(!snd_pcm_oss !snd_mixer_oss !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 />
rmmod snd-hda-intel<br />
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 <code>snd_intel8x0</code> and <code>snd_intel8x0m</code>. In this case, edit <code>rc.conf</code> and in the MODULES array blacklist the latter one so that it reads <code>!snd_intel8x0m</code> afterwards.<br />
<br />
''Muting'' the "External Amplifier" in <code>alsamixer</code> or <code>amixer</code> may also help. See [http://alsa.opensrc.org/index.php/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's 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's 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. Don't 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 kernel26' 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 the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device, reboot, and audio should now work.<br />
<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<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 and snd-pcm-oss.<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 '''DON'T''' have (i.e. don't enable the sound for the center speaker if you don't 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 />
===KDE Settings===<br />
* Start up KDE:<br />
# startx<br />
<br />
* Set up the volumes as you want them for this user (each user has their own settings):<br />
# alsamixer<br />
<br />
Log out and log back in as user xyz to get sound to work (I had to kill X, logout then log back in as user xyz, then start X and open Firefox and bam audio working on YouTube)<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 />
==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]<br />
* [http://gentoo-wiki.com/HOWTO_Set_up_a_system-wide_equaliser_with_ALSA_and_LADSPA HOWTO Set up a system-wide equaliser with ALSA and LADSPA]</div>Spatzhttps://wiki.archlinux.org/index.php?title=Arch_User_Repository&diff=126846Arch User Repository2011-01-03T22:49:48Z<p>Spatz: /* FAQ */ Fix broken link</p>
<hr />
<div>[[Category:AUR (English)]]<br />
[[Category:About Arch (English)]]<br />
[[Category:Package development (English)]]<br />
[[Category:Package management (English)]]<br />
[[Category:Arch development (English)]]<br />
{{i18n|Arch User Repository}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|The Arch User Repository is a collection of user-submitted PKGBUILDs that supplement software available from the official repositories. This article describes how to build ''unsupported'' software packages from the AUR.}}<br />
{{Article summary heading|Overview}}<br />
{{Article summary text|{{Package management overview}}}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|AUR Helpers}}<br />
{{Article summary wiki|AUR Trusted User Guidelines}}<br />
{{Article summary heading|Resources}}<br />
{{Article summary link|AUR Web Interface|http://aur.archlinux.org}}<br />
{{Article summary link|AUR Mailing List|http://www.archlinux.org/mailman/listinfo/aur-general}}<br />
{{Article summary end}}<br />
<br />
The [[Arch User Repository]] (AUR) is a community-driven repository for Arch users. It contains package descriptions ([[PKGBUILD]]s) that allow you to compile a package from source with [[makepkg]] and then install it via [[pacman]]. The AUR was created to organize and share new packages from the community and to help expedite popular packages' inclusion into the [[#.5Bcommunity.5D|[community]]] repository. This document explains how users can access and utilize the AUR.<br />
<br />
A good number of new packages that enter the official repositories start in the AUR. In the AUR, users are able to contribute their own package builds (PKGBUILD and related files). The AUR community has the ability to vote for or against packages in the AUR. If a package becomes popular enough -- provided it has a compatible license and good packaging technique -- it may be entered into the [community] repository (directly accessible by <tt>pacman</tt> or <tt>abs</tt>).<br />
<br />
==Getting started==<br />
<br />
Users can search and download [[PKGBUILD]]s from the [http://aur.archlinux.org AUR Web Interface]. These PKGBUILDs can be built into installable packages using [[makepkg]], then installed using [[pacman]]. <br />
<br />
* Read the remainder of this article for more info and a short tutorial on installing AUR packages.<br />
* Visit the [http://aur.archlinux.org AUR Web Interface] to inform yourself on updates and happenings. There you will also find statistics and an up-to-date list of newest available packages available in AUR.<br />
* Glance over the [[#FAQ]] for answers to the most common questions.<br />
* You may wish to adjust {{Filename|/etc/makepkg.conf}} to better optimize for your processor prior to building packages from the AUR. A significant improvement in compile times can be realized on systems with multi-core processors by adjusting the MAKEFLAGS variable. Users can also enable hardware-specific optimizations in GCC via the CFLAGS variable. See [[makepkg.conf]] for more information.<br />
* Install "base-devel" ({{Codeline|pacman -S base-devel}}), because members of this group are not explicitly required by AUR packages which may not build without them (more info in [http://bbs.archlinux.org/viewtopic.php?pid=632355 this thread]).<br />
<br />
==History==<br />
The following items are listed for historical purposes only. They have since been superseded by the AUR and are no longer available.<br />
<br />
At the beginning, there was <tt><nowiki>ftp://ftp.archlinux.org/incoming</nowiki></tt>, and people contributed by simply uploading the [[PKGBUILD]], the needed supplementary files, and the built package itself to the server. The package and associated files remained there until a [[Package Maintainer]] saw the program and adopted it.<br />
<br />
Then the Trusted User Repositories were born. Certain individuals in the community were allowed to host their own repositories for anyone to use. The AUR expanded on this basis, with the aim of making it both more flexible and more usable. In fact, the AUR maintainers are still referred to as TUs (Trusted Users).<br />
<br />
==Searching==<br />
The AUR web interface can be found [http://aur.archlinux.org/ here], and an interface suitable for accessing the AUR from a script (for example) can be found [http://aur.archlinux.org/rpc.php here]<br />
<br />
Queries search package names and descriptions via a MySQL LIKE comparison. This allows for more flexible search criteria (e.g. try searching for 'tool%like%grep' instead of 'tool like grep'). If you need to search for a description that contains '%', escape it with '\%'.<br />
<br />
==Installing packages==<br />
Installing packages from the AUR (aka the [unsupported] repository) is a relatively simple process. Essentially:<br />
# Acquire the tarball which contains the [[PKGBUILD]] and possibly other required files<br />
# Extract the tarball (preferably in a folder set aside just for builds from the AUR)<br />
# Run [[makepkg]] in the directory where the files are saved ("makepkg -s" will auto-resolve dependencies with [[pacman]])<br />
# Install the resulting package with [[pacman]]<br />
<br />
# pacman -U /path/to/pkg.tar.xz<br />
<br />
[[AUR Helpers]] add seamless access to the AUR. They vary in their features, but can ease in searching, fetching, building, and installing from PKGBUILDs found in the AUR. All of these scripts can be found in UNSUPPORTED. <br />
<br />
{{Note|There is not and will never be an ''official'' mechanism for installing build material from UNSUPPORTED. All users should be familiar with the build process.}}<br />
<br />
What follows is a detailed example of installation of a package called "foo".<br />
<br />
===Prerequisites===<br />
First ensure that the necessary tools are installed. The package group "base-devel" should be sufficient; it includes ''make'' and other tools needed for compiling from source.<br />
<br />
{{Warning|Packages in the AUR assume "base-devel" is installed, and will not list members of this group as dependencies even if the package cannot be built without them. Please ensure this group is installed before complaining about failed builds.}}<br />
<br />
# pacman -S base-devel<br />
<br />
Next choose an appropriate build directory. A build directory is simply a directory where the package will be made or "built" and can be any directory. Examples of commonly used directories are:<br />
<br />
~/builds<br />
<br />
or if using ABS (the [[Arch Build System]]):<br />
<br />
/var/abs/local<br />
<br />
For more information on ABS read the [[Arch Build System]] article. The example will use {{Filename|~/builds}} as the build directory.<br />
<br />
===Acquire build files===<br />
Locate the package in the AUR. This is done using the search feature (text field at the top of the [http://aur.archlinux.org/ AUR home page]). Clicking the application's name in the search list brings up an information page on the package. Read through the description to confirm that this is the desired package, note when the package was last updated, and read any comments.<br />
<br />
Download the necessary build files. From the package's information page download the build files by clicking the "Tarball" link on the left-hand side near the end of the package details. This file should be saved to the build directory or otherwise copied to the directory after downloading. In this example, the file is called "foo.tar.gz" (standard format is <pkgname>.tar.gz, if it has been properly submitted).<br />
<br />
===Build the package===<br />
Extract the tarball. Change directories to the build directory if not already there and extract the build files.<br />
<br />
$ cd ~/builds<br />
$ tar -xvzf foo.tar.gz<br />
<br />
This should create a new directory called "foo" in the build directory.<br />
<br />
{{Warning|'''Carefully check all files.''' Change directories to the newly created directory and carefully check the {{Filename|PKGBUILD}} and any {{Filename|.install}} file for malicious commands. If in doubt, do NOT build the package and seek advice on the forums or mailing list.}}<br />
<br />
$ cd foo<br />
$ nano PKGBUILD<br />
$ nano foo.install<br />
<br />
Make the package. After manually confirming the integrity of the files, run [[makepkg]] as a normal user in the build directory.<br />
<br />
$ makepkg -s<br />
<br />
The {{Codeline|-s}} switch will use [[sudo]] to install any needed dependencies. If the use of sudo is undesirable, manually install required dependencies beforehand and exclude the {{Codeline|-s}} in the above command.<br />
<br />
===Install the package===<br />
Install the package using [[pacman]]. A tarball should have been created named:<br />
<br />
<application name>-<version number>-<architecture>.pkg.tar.xz<br />
<br />
This package can be installed using [[pacman]]'s "upgrade" command:<br />
<br />
# pacman -U foo-0.1-i686.pkg.tar.xz <br />
<br />
{{Note|The above example is only a brief summary of the package building process. A visit to the [[makepkg]] and [[ABS]] pages will provide more detail and is highly recommended (particularly for first-time users).}}<br />
<br />
==Sharing packages==<br />
The user plays an essential role in the AUR, which cannot fulfill its potential without the support, involvement, and contribution of the wider user community. The life-cycle of an AUR package starts and ends with the user and requires the user to contribute in several ways.<br />
<br />
Users can '''share''' [[PKGBUILD]]s using the UNSUPPORTED area in the AUR. UNSUPPORTED does not contain any binary packages but allows users to upload PKGBUILDs that can be downloaded by others. These PKGBUILDs are completely unofficial and have not been thoroughly vetted, so they should be used at your own risk.<br />
<br />
===Feedback===<br />
A comments facility allows users to provide suggestions and feedback on improvements to the PKGBUILD contributor. Avoid pasting patches or PKGBUILDs into the comments section. They quickly become obsolete and just end up needlessly taking up lots of space. Instead email those files to the maintainer, or even use a [[pastebin Clients|pastebin]] like http://aur.pastebin.com.<br />
<br />
One of the easiest activities for '''all''' Arch users is to browse the AUR and '''vote''' for their favorite packages using the online interface. All packages are eligible for adoption by a TU for inclusion in [community], and the vote count is one of the considerations in that process; it is in everyone's interest to vote!<br />
<br />
===Submitting packages===<br />
After logging in to the AUR web interface, a user can [http://aur.archlinux.org/pkgsubmit.php submit] a gzipped tarball ({{Filename|.tar.gz}}) of a directory containing build files for a package. The directory inside the tarball should contain a {{Filename|PKGBUILD}}, any {{Filename|.install}} files, patches, etc. (ABSOLUTELY no binaries). Examples of what such a directory should look like can be seen inside {{Filename|/var/abs}} if [[ABS]] was installed.<br />
<br />
The tarball can be created with the following command:<br />
$ makepkg --source <br />
<br />
Note that this is a gzipped tarball; assuming you are uploading a package called ''libfoo'', when you create the file it should look similar to this:<br />
<br />
# List contents of tarball.<br />
$ tar tf libfoo-0.1-1.src.tar.gz<br />
libfoo/<br />
libfoo/PKGBUILD<br />
libfoo/libfoo.install<br />
<br />
When submitting a package, observe the following rules: <br />
* Check [core], [extra], and [community] for the package. If it is inside any of those repositories in ANY form, DO NOT submit the package (if the current package is broken or is lacking an included feature then please file a bug report in [http://bugs.archlinux.org/ FlySpray]).<br />
* Check AUR for the package. If it is currently maintained, changes can be submitted in a comment for the maintainer's attention. If it is unmaintained, the package can be adopted and updated as required.<br />
* Verify carefully that what you are uploading is correct. All contributors must read and adhere to the [[Arch Packaging Standards]] when writing PKGBUILDs. This is essential to the smooth running and general success of the AUR. Remember you are not going to earn any credit or respect from your peers by wasting their time with a bad PKGBUILD.<br />
* Packages that contain binaries or that are very poorly written may be deleted without warning.<br />
* If you are unsure about the package (or the build/submission process) in any way, submit the PKGBUILD to the AUR Mailing List or the AUR boards on the forum for public review before adding it to the AUR.<br />
* Make sure the package is useful. Will anyone else want to use this package? Is it extremely specialized? If more than a few people would find this package useful, it is appropriate for submission.<br />
* Gain some experience before submitting packages. Build a few packages to learn the process and then submit.<br />
* If you submit a {{Filename|package.tar.gz}} with a file named '{{Filename|package}}' in it you'll get a an error: 'Could not change to directory {{Filename|/home/aur/unsupported/package/package}}'. To resolve this, rename the file named '{{Filename|package}}' to something else, for example, '{{Filename|package.rc}}'. When it is installed in the {{Filename|pkg}} directory you may rename it back to '{{Filename|package}}'.<br />
<br />
===Maintaining packages===<br />
* If you maintain a package and want to update the PKGBUILD for your package just resubmit it.<br />
* Check for feedback and comments from other users and try to incorporate any improvements they suggest; consider it a learning process!<br />
* Please DO NOT just submit and forget about packages! While in UNSUPPORTED, it is the user's job to maintain the package by checking for updates and improving the PKGBUILD.<br />
* If you do not want to continue to maintain the package for some reason, <tt>disown</tt> the package using the AUR web interface and/or post a message to the AUR Mailing List.<br />
<br />
==[community]==<br />
The [community] repository, maintained by [[Trusted Users]], contains the most popular packages from AUR. It is enabled by default in {{Filename|pacman.conf}}. If disabled/removed, it can be enabled by uncommenting/adding these two lines: <br />
<br />
{{File<br />
|name=/etc/pacman.conf<br />
|content=<nowiki><br />
...<br />
[community]<br />
Include = /etc/pacman.d/mirrorlist<br />
...<br />
</nowiki>}}<br />
<br />
[community], unlike AUR, contains binary packages that can be installed directly with [[pacman]] and the build files can also be accessed with [[ABS]]. Some of these packages may eventually make the transition to the [core] or [extra] repositories as the developers consider them crucial to the distribution.<br />
<br />
Users can also access the [community] build files by editing {{Filename|/etc/abs.conf}} and enabling the community repository in the {{Codeline|REPOS}} array.<br />
<br />
==FAQ==<br />
<br />
{{FAQ<br />
|question=What is the AUR?<br />
|answer=The AUR (Arch User Repository) is a place where the Arch Linux community can upload [[PKGBUILD]]s of applications, libraries, etc., and share them with the entire community. Fellow users can then vote for their favorites to be moved into the [community] repository to be shared with Arch Linux users in binary form.}}<br />
<br />
{{FAQ<br />
|question=What is a TU?<br />
|answer=A [[AUR Trusted User Guidelines|TU (Trusted User)]] is a person who is chosen to oversee AUR and the [community] repository. They're the ones who maintain popular PKGBUILDs in [community], and overall keep the AUR running.}}<br />
<br />
{{FAQ<br />
|question=What's the difference between [unsupported] and [community]?<br />
|answer=[unsupported] is where all PKGBUILDs that users submit are stored, and must be built manually with [makepkg]. When PKGBUILDs receive enough votes, they are moved into the [community] repository, where the TUs maintain binary packages that can be installed with [[pacman]].}}<br />
<br />
{{FAQ<br />
|question=How many votes does it take to get a PKGBUILD into [community]?<br />
|answer=Usually, at least 10 votes are required for something to move into [community]. However, if a TU wants to support an package, it will often be found in the repository.}}<br />
<br />
{{FAQ<br />
|question=How do I make a PKGBUILD?<br />
|answer=The best resource is [[Creating Packages]]. Remember to look in AUR before creating the PKGBUILD as to not duplicate efforts.}}<br />
<br />
{{FAQ<br />
|question=I'm trying to do {{Codeline|pacman -S foo}}; it isn't working but I know it's in [community]<br />
|answer=You probably haven't enabled [community] in your {{Filename|/etc/pacman.conf}}. Just uncomment the relevant lines.<br />
If [community] is enabled in your {{Filename|/etc/pacman.conf}} try running {{Codeline|pacman -S -y}} first to synchronize the pkgcache before trying your package again.}}<br />
<br />
{{FAQ<br />
|question=Foo in AUR is outdated; what do I do?<br />
|answer=For starters, you can flag packages out-of-date. If it stays out-of-date for an extended amount of time, the best thing to do is email the maintainer. If there is no response from the maintainer, you could mail to the aur-general mailing list to have a TU orphan the PKGBUILD if you're willing to maintain it yourself.}}<br />
<br />
{{FAQ<br />
|question=I have a PKGBUILD I would like to submit; can someone check it to see if there are any errors?<br />
|answer=If you would like to have your PKGBUILD critiqued, post it on the aur-general mailing list to get feedback from the TUs and fellow AUR members. You could also get help from the [[ArchChannel|IRC channel]], #archlinux on irc.freenode.net. You can also<br />
use [[namcap]] to check your PKGBUILD and the resulting package for errors.}}<br />
<br />
{{FAQ<br />
|question=Foo in AUR doesn't compile when I do {{Codeline|makepkg}}; what should I do?<br />
|answer=You are probably missing something trivial.<br />
<br />
# Run {{Codeline|pacman -Syyu}} before compiling anything with {{Codeline|makepkg}} as the problem may be that your system is not up-to-date.<br />
# Ensure you have both "base" and "base-devel" groups installed.<br />
# Try using the "{{Codeline|-s}}" option with {{Codeline|makepkg}} to check and install all the dependencies needed before starting the build process.<br />
<br />
The reason might not be trivial after all. Custom CFLAGS, LDFLAGS and MAKEFLAGS can cause failures. It's also possible that the PKGBUILD is broken for everyone. If you can't figure it out on your own, just report it to the maintainer.}}<br />
<br />
{{FAQ<br />
|question=How can I speed up repeated build processes?<br />
|answer=If you frequently compile code that uses gcc - say, a git or SVN package - you may find [[ccache]], short for "compiler cache", useful.}}<br />
<br />
{{FAQ<br />
|question=How do I access unsupported packages?<br />
|answer=See [[#Installing packages]]}}<br />
<br />
{{FAQ<br />
|question=How can I upload to AUR without using the web interface?<br />
|answer=You can use [http://aur.archlinux.org/packages.php?ID=23393 aurploader] or [http://aur.archlinux.org/packages.php?ID=37216 burp] -- both with command-line interfaces.}}</div>Spatz