https://wiki.archlinux.org/api.php?action=feedcontributions&user=Ball&feedformat=atomArchWiki - User contributions [en]2024-03-28T12:54:52ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Sxiv&diff=257374Sxiv2013-05-17T15:53:56Z<p>Ball: added script to browse through images in directory after opening a single file; altered installation note</p>
<hr />
<div>[[Category:Graphics and desktop publishing]]<br />
{{Lowercase title}}<br />
{{Article summary start}}<br />
{{Article summary text|This article discusses the installation and basic configuration of {{Pkg|sxiv}}.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|feh}}<br />
{{Article summary heading|External Links}}<br />
{{Article summary text| [http://github.com/muennich/sxiv sxiv on github]}}<br />
{{Article summary end}}<br />
<br />
'''sxiv''', Simple [[X]] Image Viewer is a lightweight image viewer written in C. It is a lightweight image viewer that is scriptable. <br />
<br />
== Installation ==<br />
<br />
[[pacman|Install]] {{pkg|sxiv}}, which is available in the [[Official Repositories|official repositories]].<br />
<br />
== Assigning keyboard shortcuts to sxiv ==<br />
<br />
sxiv is scriptable, but to do this, you have to edit config.h and compile sxiv as follows:<br />
<br />
As an example we will assign the following command to {{Keypress|^d}}: {{ic|mv file ~/.trash}}, and {{ic|echo file | xclip}} to put the full path and filename of the current image into the clipboard with {{Keypress|^c}}.<br />
<br />
So when sxiv is started in thumbnail mode on a folder, one can see all files in that folder, select random thumbnails, and hit ^d to move them to a custom "trash" folder.<br />
<br />
=== Tutorial ===<br />
<br />
Get latest PKGBUILD from abs<br />
# abs community/sxiv<br />
{{Note|The prompt above is a root prompt, denoted by a pound-sign (#), so you may have to use {{ic|sudo}}, for example.}}<br />
<br />
copy source to your own workspace:<br />
$ cp -r /var/abs/community/sxiv ~/sources<br />
<br />
move to source directory to start the work:<br />
$ cd ~/sources/sxiv<br />
<br />
edit config.h, to add the line for the "d" and "c" shortcut:<br />
{{Hc|head=config.h|output=<nowiki><br />
/* run shell command line on current file ("$SXIV_IMG"): */<br />
{ true, XK_less, it_shell_cmd, (arg_t) \<br />
"mogrify -rotate -90 \"$SXIV_IMG\"" },<br />
{ true, XK_greater, it_shell_cmd, (arg_t) \<br />
"mogrify -rotate +90 \"$SXIV_IMG\"" },<br />
{ true, XK_comma, it_shell_cmd, (arg_t) \<br />
"jpegtran -rotate 270 -copy all -outfile \"$SXIV_IMG\" \"$SXIV_IMG\"" },<br />
{ true, XK_period, it_shell_cmd, (arg_t) \<br />
"jpegtran -rotate 90 -copy all -outfile \"$SXIV_IMG\" \"$SXIV_IMG\"" },<br />
//insert the lines below<br />
{ true, XK_d, it_shell_cmd, (arg_t) \<br />
"mv \"$SXIV_IMG\" ~/.trash" },<br />
{ true, XK_c, it_shell_cmd, (arg_t) \<br />
"echo \"$SXIV_IMG\" | xclip" },<br />
};</nowiki>}}<br />
<br />
After saving config.h, create new checksums for modified files (config.h in this case):<br />
$ makepkg -g >> PKGBUILD<br />
<br />
Extract the source files; you can just run makepkg to do it for you:<br />
$ makepkg<br />
<br />
Compile sxiv and install it:<br />
$ makepkg -efi<br />
<br />
Create .trash folder if it doesn't exist:<br />
$ mkdir ~/.trash<br />
<br />
Now when you start sxiv in thumbnail mode on a folder of pictures, i.e.:<br />
$ sxiv -tsr ~/pictures<br />
<br />
Congratulations, you can now delete selected pictures by hitting {{Keypress|CTRL+D}}. This will move your selected pic to ~/.trash. Pressing {{Keypress|CTRL+C}} copies the full path and file name of the current picture to the clipboard.<br />
<br />
==Tips and Tricks==<br />
===Browse through images in directory after opening a single file===<br />
Place [http://git.savannah.gnu.org/cgit/ranger.git/tree/doc/examples/rifle_sxiv.sh this script] in $PATH and call it like this:<br />
$ <scriptname> a_single_image.jpg<br />
As indicated in the comments of the script, it may be used to have this behavior when opening images from within [[ranger]].<br />
<br />
==See also==<br />
* Arch Linux [https://bbs.archlinux.org/viewtopic.php?id=112643 forum thread].</div>Ballhttps://wiki.archlinux.org/index.php?title=Feh&diff=257373Feh2013-05-17T15:32:22Z<p>Ball: Added sxiv as related program</p>
<hr />
<div>[[Category:Graphics and desktop publishing]]<br />
[[es:Feh]]<br />
[[it:Feh]]<br />
[[lt:Feh]]<br />
[[ru:Feh]]<br />
[[zh-CN:Feh]]<br />
{{Article summary start}}<br />
{{Article summary text|feh is a lightweight and powerful image viewer that can also be used to manage the desktop wallpaper for standalone window managers lacking such features.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Nitrogen}}<br />
{{Article summary wiki|sxiv}}<br />
{{Article summary end}}<br />
[https://derf.homelinux.org/~derf/projects/feh/ feh] is a lightweight and powerful image viewer that can also be used to manage the desktop wallpaper for standalone window managers lacking such features.<br />
<br />
==Installation==<br />
[[pacman|Install]] {{pkg|feh}}, which is available in the [[Official Repositories|official repositories]].<br />
<br />
==Usage==<br />
feh is highly configurable. For a full list of options, run {{Ic|feh --help}}.<br />
<br />
===As an image viewer===<br />
To quickly browse images in a specific directory, you can launch feh with the following arguments:<br />
<br />
$ feh -g 640x480 -d -S filename /path/to/directory<br />
<br />
* The {{Ic|-g}} flag forces the images to appear no larger than 640x480<br />
* The {{Ic|-d}} flag draws the file name<br />
* The {{Ic|-S filename}} flag sorts the images by file name<br />
<br />
This is just one example; there are many more options available should you desire more flexibility.<br />
<br />
====File Browser Image Launcher====<br />
The following script is useful for file browsers. It will display your selected image in feh, but it will enable you to browse all other images in the directory as well, in their default order, i.e. as if you had run "feh *" and cycled through to the selected image.<br />
<br />
The script assumes the first argument is the filename.<br />
{{hc|feh_browser.sh|<nowiki><br />
#!/bin/bash<br />
<br />
shopt -s nullglob<br />
<br />
if [[ ! -f $1 ]]; then<br />
echo "$0: first argument is not a file" >&2<br />
exit 1<br />
fi<br />
<br />
file=$(basename -- "$1")<br />
dir=$(dirname -- "$1")<br />
arr=()<br />
shift<br />
<br />
cd -- "$dir"<br />
<br />
for i in *; do<br />
[[ -f $i ]] || continue<br />
arr+=("$i")<br />
[[ $i == $file ]] && c=$((${#arr[@]} - 1))<br />
done<br />
<br />
exec feh "$@" -- "${arr[@]:c}" "${arr[@]:0:c}"<br />
</nowiki>}}<br />
<br />
Invoke the script with the selected image's path, followed by any additional arguments to feh. Here is an example of a launcher that you can use in a file browser:<br />
<br />
{{bc|$ /path/to/script/feh_browser.sh %f -F -Z}}<br />
<br />
{{Ic|-F}} and {{Ic|-Z}} are feh arguments. {{Ic|-F}} opens the image in fullscreen mode, and {{Ic|-Z}} automatically zooms the image. Adding the {{Ic|-q}} flag (quiet) suppresses error messages to the terminal when feh tries loading non-image files from the current folder.<br />
<br />
A simple but less versatile alternative is<br />
{{hc|feh_browser.sh|<nowiki><br />
#! /bin/sh<br />
feh -. "$(dirname "$1")" --start-at "$1"<br />
</nowiki>}}<br />
This one does not seem to accept options.<br />
<br />
===As a desktop wallpaper manager===<br />
feh can be used to manage the desktop wallpaper for window managers that lack desktop features, such as [[Openbox]], [[Fluxbox]], and [[xmonad]].<br />
<br />
When using [[GNOME]], you must disable Nautilus from controlling the desktop. The easiest way is to run this command:<br />
<br />
{{bc|$ gconftool-2 --set /apps/nautilus/preferences/show_desktop --type boolean false}}<br />
<br />
The following command is an example of how to set the initial background:<br />
<br />
{{bc|$ feh --bg-scale /path/to/image.file}}<br />
<br />
Other scaling options include:<br />
{{bc|<br />
--bg-tile FILE<br />
--bg-center FILE<br />
--bg-max FILE<br />
--bg-fill FILE<br />
}}<br />
<br />
To restore the background on the next session, add the following to your startup file (e.g. {{ic|~/.xinitrc}}, {{ic|~/.config/openbox/autostart}}, etc.):<br />
{{bc|$ sh ~/.fehbg &}}<br />
<br />
To change the background image, edit the file {{ic|~/.fehbg}} which gets created after running the command {{Ic|feh --bg-scale /path/to/image.file}} mentioned above.<br />
== Tips and tricks ==<br />
===Random background image===<br />
==== Using a script ====<br />
To rotate the wallpaper randomly, create a script with the code below (e.g. {{ic|wallpaper.sh}}). Make the script executable:<br />
<br />
{{bc|$ chmod +x wallpaper.sh}}<br />
<br />
and call it from {{ic|~/.xinitrc}}. You can also put the source directly in {{ic|~/.xinitrc}} instead of in a separate file.<br />
<br />
Change the {{ic|~/.wallpaper}} directory to fit your setup and the {{Ic|15m}} delay as you please (see {{Ic|man sleep}} for options).<br />
{{hc|wallpaper.sh|<nowiki><br />
#!/bin/sh<br />
<br />
while true; do<br />
find ~/.wallpaper -type f \( -name '*.jpg' -o -name '*.png' \) -print0 |<br />
shuf -n1 -z | xargs -0 feh --bg-max<br />
sleep 15m<br />
done<br />
</nowiki>}}<br />
<br />
You may have to change {{ic|find ~/.wallpaper}} to {{ic|find ~/.wallpaper/}} to make the above work.<br />
<br />
This version does not fork as much, but this version does not recurse through directories:<br />
{{hc|wallpaper.sh|<nowiki><br />
#!/bin/bash<br />
<br />
shopt -s nullglob<br />
cd ~/.wallpaper<br />
<br />
while true; do<br />
files=()<br />
for i in *.jpg *.png; do<br />
[[ -f $i ]] && files+=("$i")<br />
done<br />
range=${#files[@]}<br />
<br />
((range)) && feh --bg-scale "${files[RANDOM % range]}"<br />
<br />
sleep 15m<br />
done<br />
</nowiki>}}<br />
<br />
=====For dual screen no-xinerama =====<br />
This script replace the call to '''feh''' for add a wallpaper on systems with dual screen nvidia twinview (for example).<br />
{{hc|wallpaper.sh|<nowiki><br />
#!/bin/sh<br />
exec feh --bg-max --no-xinerama "$@"<br />
</nowiki>}}<br />
<br />
==== Using a cron job ====<br />
Using a [[cron]] job, you can get a similar result, and it does not require having a script constantly sleeping.<br />
<br />
Just do {{ic|$ crontab -e}} and add:<br />
<br />
{{bc|<nowiki><br />
* * * * * DISPLAY=:0.0 feh --bg-max "$(find ~/.wallpaper/|shuf -n1)"<br />
</nowiki>}}<br />
<br />
==== Using systemd user session ====<br />
{{Note|This is useful '''only''' if you are using ''systemd user session''. Read [[Systemd/User]] for more details.}}<br />
<br />
Create the unit service file:<br />
{{hc|$HOME/.config/systemd/user/feh-wallpaper.service|<nowiki><br />
[Unit]<br />
Description=Random wallpaper with feh<br />
<br />
[Service]<br />
Type=oneshot<br />
EnvironmentFile=%h/.wallpaper<br />
ExecStart=/bin/bash -c '/usr/bin/feh --bg-max "$(find ${WALLPATH}|shuf|head -n 1)"'<br />
<br />
[Install]<br />
WantedBy=default.target<br />
</nowiki>}}<br />
Now create the timer file. Change the time as necessary. In this example is {{ic|15 seconds}}.<br />
{{hc|$HOME/.config/systemd/user/feh-wallpaper.timer|<nowiki><br />
[Unit]<br />
Description=Random wallpaper with feh<br />
<br />
[Timer]<br />
OnUnitActiveSec=</nowiki>''15s''<nowiki><br />
Unit=feh-wallpaper.service<br />
<br />
[Install]<br />
WantedBy=default.target<br />
</nowiki>}}<br />
In this example the configuration is one hidden file on the home directory with the path of the directory where the images are stored<br />
{{hc|$HOME/.wallpaper|<nowiki><br />
WALLPATH=</nowiki>''/home/user/.wallpaper/''<br />
}}<br />
<br />
Activate the {{ic|feh-wallpaper.timer}} and {{ic|feh-wallpaper.service}} daemons. Read [[Daemons]] for more details.<br />
<br />
{{Note|Remember that under ''systemd user session'', you should use the {{ic|--user}} flag on {{ic|systemctl}}.}}<br />
<br />
== See also ==<br />
* [https://bbs.archlinux.org/viewtopic.php?pid=884635#p884635 Forum post with original script for feh_browser]</div>Ballhttps://wiki.archlinux.org/index.php?title=Sxiv&diff=257372Sxiv2013-05-17T15:30:15Z<p>Ball: Added feh as related program</p>
<hr />
<div>[[Category:Graphics and desktop publishing]]<br />
{{Lowercase title}}<br />
{{Article summary start}}<br />
{{Article summary text|This article discusses the installation and basic configuration of {{Pkg|sxiv}}.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|feh}}<br />
{{Article summary heading|External Links}}<br />
{{Article summary text| [http://github.com/muennich/sxiv sxiv on github]}}<br />
{{Article summary end}}<br />
<br />
'''sxiv''', Simple [[X]] Image Viewer is a lightweight image viewer written in C. It is a lightweight image viewer that is scriptable. <br />
<br />
== Installation ==<br />
<br />
{{Pkg|sxiv}} can be found in the Community repositories.<br />
<br />
== Assigning keyboard shortcuts to sxiv ==<br />
<br />
sxiv is scriptable, but to do this, you have to edit config.h and compile sxiv as follows:<br />
<br />
As an example we will assign the following command to {{Keypress|^d}}: {{ic|mv file ~/.trash}}, and {{ic|echo file | xclip}} to put the full path and filename of the current image into the clipboard with {{Keypress|^c}}.<br />
<br />
So when sxiv is started in thumbnail mode on a folder, one can see all files in that folder, select random thumbnails, and hit ^d to move them to a custom "trash" folder.<br />
<br />
=== Tutorial ===<br />
<br />
Get latest PKGBUILD from abs<br />
# abs community/sxiv<br />
{{Note|The prompt above is a root prompt, denoted by a pound-sign (#), so you may have to use {{ic|sudo}}, for example.}}<br />
<br />
copy source to your own workspace:<br />
$ cp -r /var/abs/community/sxiv ~/sources<br />
<br />
move to source directory to start the work:<br />
$ cd ~/sources/sxiv<br />
<br />
edit config.h, to add the line for the "d" and "c" shortcut:<br />
{{Hc|head=config.h|output=<nowiki><br />
/* run shell command line on current file ("$SXIV_IMG"): */<br />
{ true, XK_less, it_shell_cmd, (arg_t) \<br />
"mogrify -rotate -90 \"$SXIV_IMG\"" },<br />
{ true, XK_greater, it_shell_cmd, (arg_t) \<br />
"mogrify -rotate +90 \"$SXIV_IMG\"" },<br />
{ true, XK_comma, it_shell_cmd, (arg_t) \<br />
"jpegtran -rotate 270 -copy all -outfile \"$SXIV_IMG\" \"$SXIV_IMG\"" },<br />
{ true, XK_period, it_shell_cmd, (arg_t) \<br />
"jpegtran -rotate 90 -copy all -outfile \"$SXIV_IMG\" \"$SXIV_IMG\"" },<br />
//insert the lines below<br />
{ true, XK_d, it_shell_cmd, (arg_t) \<br />
"mv \"$SXIV_IMG\" ~/.trash" },<br />
{ true, XK_c, it_shell_cmd, (arg_t) \<br />
"echo \"$SXIV_IMG\" | xclip" },<br />
};</nowiki>}}<br />
<br />
After saving config.h, create new checksums for modified files (config.h in this case):<br />
$ makepkg -g >> PKGBUILD<br />
<br />
Extract the source files; you can just run makepkg to do it for you:<br />
$ makepkg<br />
<br />
Compile sxiv and install it:<br />
$ makepkg -efi<br />
<br />
Create .trash folder if it doesn't exist:<br />
$ mkdir ~/.trash<br />
<br />
Now when you start sxiv in thumbnail mode on a folder of pictures, i.e.:<br />
$ sxiv -tsr ~/pictures<br />
<br />
Congratulations, you can now delete selected pictures by hitting {{Keypress|CTRL+D}}. This will move your selected pic to ~/.trash. Pressing {{Keypress|CTRL+C}} copies the full path and file name of the current picture to the clipboard.<br />
<br />
==Web Resources==<br />
* Arch Linux [https://bbs.archlinux.org/viewtopic.php?id=112643 forum thread].</div>Ballhttps://wiki.archlinux.org/index.php?title=Sxiv&diff=257323Sxiv2013-05-16T17:52:27Z<p>Ball: </p>
<hr />
<div>[[Category:Graphics and desktop publishing]]<br />
{{Lowercase title}}<br />
{{Article summary start}}<br />
{{Article summary text|This article discusses the installation and basic configuration of {{Pkg|sxiv}}.}}<br />
{{Article summary heading|External Links}}<br />
{{Article summary text| [http://github.com/muennich/sxiv sxiv on github]}}<br />
{{Article summary end}}<br />
<br />
'''sxiv''', Simple [[X]] Image Viewer is a lightweight image viewer written in C. It is a lightweight image viewer that is scriptable. <br />
<br />
== Installation ==<br />
<br />
{{Pkg|sxiv}} can be found in the Community repositories.<br />
<br />
== Assigning keyboard shortcuts to sxiv ==<br />
<br />
sxiv is scriptable, but to do this, you have to edit config.h and compile sxiv as follows:<br />
<br />
As an example we will assign the following command to {{Keypress|^d}}: {{ic|mv file ~/.trash}}, and {{ic|echo file | xclip}} to put the full path and filename of the current image into the clipboard with {{Keypress|^c}}.<br />
<br />
So when sxiv is started in thumbnail mode on a folder, one can see all files in that folder, select random thumbnails, and hit ^d to move them to a custom "trash" folder.<br />
<br />
=== Tutorial ===<br />
<br />
Get latest PKGBUILD from abs<br />
# abs community/sxiv<br />
{{Note|The prompt above is a root prompt, denoted by a pound-sign (#), so you may have to use {{ic|sudo}}, for example.}}<br />
<br />
copy source to your own workspace:<br />
$ cp -r /var/abs/community/sxiv ~/sources<br />
<br />
move to source directory to start the work:<br />
$ cd ~/sources/sxiv<br />
<br />
edit config.h, to add the line for the "d" and "c" shortcut:<br />
{{Hc|head=config.h|output=<nowiki><br />
/* run shell command line on current file ("$SXIV_IMG"): */<br />
{ true, XK_less, it_shell_cmd, (arg_t) \<br />
"mogrify -rotate -90 \"$SXIV_IMG\"" },<br />
{ true, XK_greater, it_shell_cmd, (arg_t) \<br />
"mogrify -rotate +90 \"$SXIV_IMG\"" },<br />
{ true, XK_comma, it_shell_cmd, (arg_t) \<br />
"jpegtran -rotate 270 -copy all -outfile \"$SXIV_IMG\" \"$SXIV_IMG\"" },<br />
{ true, XK_period, it_shell_cmd, (arg_t) \<br />
"jpegtran -rotate 90 -copy all -outfile \"$SXIV_IMG\" \"$SXIV_IMG\"" },<br />
//insert the lines below<br />
{ true, XK_d, it_shell_cmd, (arg_t) \<br />
"mv \"$SXIV_IMG\" ~/.trash" },<br />
{ true, XK_c, it_shell_cmd, (arg_t) \<br />
"echo \"$SXIV_IMG\" | xclip" },<br />
};</nowiki>}}<br />
<br />
After saving config.h, create new checksums for modified files (config.h in this case):<br />
$ makepkg -g >> PKGBUILD<br />
<br />
Extract the source files; you can just run makepkg to do it for you:<br />
$ makepkg<br />
<br />
Compile sxiv and install it:<br />
$ makepkg -efi<br />
<br />
Create .trash folder if it doesn't exist:<br />
$ mkdir ~/.trash<br />
<br />
Now when you start sxiv in thumbnail mode on a folder of pictures, i.e.:<br />
$ sxiv -tsr ~/pictures<br />
<br />
Congratulations, you can now delete selected pictures by hitting {{Keypress|CTRL+D}}. This will move your selected pic to ~/.trash. Pressing {{Keypress|CTRL+C}} copies the full path and file name of the current picture to the clipboard.<br />
<br />
==Web Resources==<br />
* Arch Linux [https://bbs.archlinux.org/viewtopic.php?id=112643 forum thread].</div>Ballhttps://wiki.archlinux.org/index.php?title=Ranger&diff=257320Ranger2013-05-16T17:30:51Z<p>Ball: /* Opening files with a given application */ enable sxiv to browse through images</p>
<hr />
<div>[[Category:File managers]]<br />
[[Category:File systems]]<br />
[[fr:ranger]]<br />
{{Article summary start|Summary}}<br />
{{Article summary text|A guide to installing and configuring ranger}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|atool}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:ranger}}<br />
'''ranger''' is a text-based file manager written in Python with vi-style key bindings. It has an extensive set of features , and you can accomplish file management tasks with a few keystrokes with no need for the mouse.<br />
<br />
==Installing==<br />
{{Pkg|ranger}} can be installed from the [[Official Repositories|official repositories]] with [[pacman]]:<br />
# pacman -S ranger<br />
There is also [https://aur.archlinux.org/packages.php?ID=35421 ranger-git] in [[AUR]].<br />
<br />
Optional, for file previews with "scope.sh":<br />
* {{Pkg|libcaca}} (img2txt) for previewing images<br />
* {{Pkg|highlight}} for syntax highlighting of code<br />
* {{Pkg|atool}} for previews of archives<br />
* {{Pkg|lynx}}, {{Pkg|w3m}} or {{Pkg|elinks}} for previews of html pages<br />
* {{Pkg|poppler}} (pdftotext) for pdf previews<br />
* {{Pkg|transmission-show}} for viewing bit-torrent information<br />
* {{Pkg|mediainfo}} or {{Pkg|perl-image-exiftool}} for viewing information about media files<br />
<br />
==Running==<br />
To start ranger, launch a terminal such as xterm, and type the command {{ic|ranger}}. Or, you can use the command <br />
xterm -e ranger<br />
<br />
==Comparison with other File Managers==<br />
Compared to graphical mouse-based file managers, ranger is much more efficient, but still visually appealing. ranger has one pane with multiple columns for different directories in the path, and file previews on the right. Compared to double-pane file managers, ranger shows more directory and file information. You can quickly move between directories using keystrokes, bookmarks or the command history. Previews of files and directory contents automatically show up for the current selection. ranger's features include: vi-style key bindings, bookmarks, selections, tagging, tabs, command history, the ability to make symbolic links, several console modes, and a task view. ranger has customizable commands and key bindings, including bindings to external scripts. The closest competitor is [[Vifm]], which has two panes and vi-style key bindings, but has fewer features overall.<br />
<br />
==Documentation==<br />
ranger's man page can be opened by typing {{ic|?}}. You can also press {{ic|1?}} for a list of key bindings, {{ic|2?}} for a list of commands and {{ic|3?}} for a list of settings.<br />
<br />
==Customization==<br />
After startup, ranger creates a directory {{ic|~/.config/ranger/}}. You can copy the default configuration files to this directory with the following command:<br />
<pre>ranger --copy-config=all</pre> <br />
They can then be customized. Some basic knowledge of python is useful.<br />
<br />
*{{ic|rc.conf}} controls startup commands and key bindings<br />
*{{ic|commands.py}} controls the commands which are launched with the ":" key<br />
*{{ic|rifle.conf}} controls the applications used when a given type of file is launched.<br />
<br />
You can launch files with "l" (ell) or "<Enter>". For {{ic|rc.conf}}, you need only include changes from the default file, since both are loaded. For {{ic|commands.py}}, if you do not include the whole file, put this line at the top:<br />
<pre><br />
from ranger.api.commands import *<br />
</pre><br />
<br />
===Binding keys===<br />
Use the file {{ic|~/.config/ranger/rc.conf}} to modify key bindings. There are many keybindings already defined, and you can learn the syntax by reading the file.<br />
<br />
The following example shows how to use "DD" to move selected files to a directory {{ic|~/.Trash/}}. Put this code in {{ic|~/.config/ranger/rc.conf}}<br />
<pre><br />
# move to trash<br />
map DD shell mv -t /home/myname/.config/ranger/Trash %s<br />
</pre><br />
<br />
===Defining commands===<br />
Continuing the above example, adding the following entry to {{ic|~/.config/ranger/commands.py}} would define a command to empty the trash directory {{ic|~/.Trash}}.<br />
<pre><br />
class empty(Command):<br />
""":empty<br />
<br />
Empties the trash directory ~/.Trash<br />
"""<br />
<br />
def execute(self):<br />
self.fm.run("rm -rf /home/myname/.Trash/{*,.[^.]*}")<br />
</pre><br />
To use it, you would type ":empty<Enter>", using tab completion if desired.<br />
<br />
{{Warning|Note that [^.] is an essential part of the above command. Otherwise, it will remove all files and directories of the form ..*, thereby wiping out everything in your home directory.}}<br />
<br />
===Opening files with a given application===<br />
<br />
Modify {{ic|~/.config/ranger/rifle.conf}}. Since the beginning lines are executed first, you should put your modifications at the beginning of the file. For example, the following entry will open a tex file with kile.<br />
<pre><br />
ext tex = kile "$@"<br />
</pre><br />
<br />
====Using sxiv to browse through images====<br />
<br />
In order to browse through images in [[sxiv]] after launching the viewer from ranger by opening an image file, use the [http://git.savannah.gnu.org/cgit/ranger.git/tree/doc/examples/rifle_sxiv.sh rifle_sxiv.sh script] and follow the instructions in its comments.<br />
<br />
==Useful commands==<br />
===External Drives===<br />
External drives can be automatically mounted with an [[Udev]] rule or with the help of an automounting Udev wrapper. Drives mounted under {{ic|/media}} can be easily accessed by pressing {{keypress|gm}} (go, media).<br />
<br />
===Network Drives===<br />
<br />
===Archive Related===<br />
These commands use {{Pkg|atool}} to perform archive operations.<br />
<br />
====Extraction====<br />
The following command implements archive extraction by copying (yy) one or more archive files and then executing ":extracthere" on the desired directory.<br />
<br />
<pre><br />
import os<br />
from ranger.core.loader import CommandLoader<br />
<br />
class extracthere(Command):<br />
def execute(self):<br />
""" Extract copied files to current directory """<br />
copied_files = tuple(self.fm.env.copy)<br />
<br />
if not copied_files:<br />
return<br />
<br />
def refresh(_):<br />
cwd = self.fm.env.get_directory(original_path)<br />
cwd.load_content()<br />
<br />
one_file = copied_files[0]<br />
cwd = self.fm.env.cwd<br />
original_path = cwd.path<br />
au_flags = ['-X', cwd.path]<br />
au_flags += self.line.split()[1:]<br />
au_flags += ['-e']<br />
<br />
self.fm.env.copy.clear()<br />
self.fm.env.cut = False<br />
if len(copied_files) == 1:<br />
descr = "extracting: " + os.path.basename(one_file.path)<br />
else:<br />
descr = "extracting files from: " + os.path.basename(one_file.dirname)<br />
obj = CommandLoader(args=['aunpack'] + au_flags \<br />
+ [f.path for f in copied_files], descr=descr)<br />
<br />
obj.signal_bind('after', refresh)<br />
self.fm.loader.add(obj)<br />
</pre><br />
<br />
====Compression====<br />
The following command allows the user to compress several files on the current directory by marking them and then calling ":compress <package name>". It supports name suggestions by getting the basename of the current directory and appending several possibilities for the extension.<br />
<br />
<pre><br />
import os<br />
from ranger.core.loader import CommandLoader<br />
<br />
class compress(Command):<br />
def execute(self):<br />
""" Compress marked files to current directory """<br />
cwd = self.fm.env.cwd<br />
marked_files = cwd.get_selection()<br />
<br />
if not marked_files:<br />
return<br />
<br />
def refresh(_):<br />
cwd = self.fm.env.get_directory(original_path)<br />
cwd.load_content()<br />
<br />
original_path = cwd.path<br />
parts = self.line.split()<br />
au_flags = parts[1:]<br />
<br />
descr = "compressing files in: " + os.path.basename(parts[1])<br />
obj = CommandLoader(args=['apack'] + au_flags + \<br />
[os.path.relpath(f.path, cwd.path) for f in marked_files], descr=descr)<br />
<br />
obj.signal_bind('after', refresh)<br />
self.fm.loader.add(obj)<br />
<br />
def tab(self):<br />
""" Complete with current folder name """<br />
<br />
extension = ['.zip', '.tar.gz', '.rar', '.7z']<br />
return ['compress ' + os.path.basename(self.fm.env.cwd.path) + ext for ext in extension]<br />
</pre><br />
<br />
===Image Mounting===<br />
The following command assumes you are using [[cdemu]] as your image mounter and some kind of system like [[autofs]] which mounts the virtual drive to a specified location ('/media/virtualrom' in this case). '''Don't forget to change mountpath to reflect your system settings'''.<br />
<br />
To mount an image (or images) to a cdemud virtual drive from ranger you select the image files and then type ':mount' on the console. The mounting may actually take some time depending on your setup (in mine it may take as long as one minute) so the command uses a custom loader that waits until the mount directory is mounted and then opens it on the background in tab 9.<br />
<br />
<pre><br />
import os, time<br />
from ranger.core.loader import Loadable<br />
from ranger.ext.signals import SignalDispatcher<br />
from ranger.ext.shell_escape import *<br />
<br />
class MountLoader(Loadable, SignalDispatcher):<br />
"""<br />
Wait until a directory is mounted<br />
"""<br />
def __init__(self, path):<br />
SignalDispatcher.__init__(self)<br />
descr = "Waiting for dir '" + path + "' to be mounted"<br />
Loadable.__init__(self, self.generate(), descr)<br />
self.path = path<br />
<br />
def generate(self):<br />
available = False<br />
while not available:<br />
try:<br />
if os.path.ismount(self.path):<br />
available = True<br />
except:<br />
pass<br />
yield<br />
time.sleep(0.03)<br />
self.signal_emit('after')<br />
<br />
class mount(Command):<br />
def execute(self):<br />
selected_files = self.fm.env.cwd.get_selection()<br />
<br />
if not selected_files:<br />
return<br />
<br />
space = ' '<br />
self.fm.execute_command("cdemu -b system unload 0")<br />
self.fm.execute_command("cdemu -b system load 0 " + \<br />
space.join([shell_escape(f.path) for f in selected_files]))<br />
<br />
mountpath = "/media/virtualrom/"<br />
<br />
def mount_finished(path):<br />
currenttab = self.fm.current_tab<br />
self.fm.tab_open(9, mountpath)<br />
self.fm.tab_open(currenttab)<br />
<br />
obj = MountLoader(mountpath)<br />
obj.signal_bind('after', mount_finished)<br />
self.fm.loader.add(obj)<br />
</pre><br />
<br />
==Web Resources==<br />
* [http://nongnu.org/ranger ranger] web page.<br />
* [https://lists.nongnu.org/mailman/listinfo/ranger-users ranger mailing list]<br />
* Arch Linux [https://bbs.archlinux.org/viewtopic.php?id=93025 forum thread].<br />
* [http://github.com/hut/ranger GitHub-page]<br />
* [http://dotshare.it/category/fms/ranger/ DotShare.it] configurations.</div>Ballhttps://wiki.archlinux.org/index.php?title=Advanced_Linux_Sound_Architecture&diff=242233Advanced Linux Sound Architecture2012-12-30T10:43:30Z<p>Ball: /* Using a USB Headset and External USB Sound Cards */</p>
<hr />
<div>[[Category:Sound]]<br />
[[Category:Audio/Video]]<br />
[[cs:Advanced Linux Sound Architecture]]<br />
[[de:Alsa]]<br />
[[es:Advanced Linux Sound Architecture]]<br />
[[fa:ALSA]]<br />
[[fr:Alsa]]<br />
[[he:Advanced Linux Sound Architecture]]<br />
[[it:Advanced Linux Sound Architecture]]<br />
[[nl:Advanced Linux Sound Architecture]]<br />
[[pt:Advanced Linux Sound Architecture]]<br />
[[ru:Advanced Linux Sound Architecture]]<br />
[[sk:Advanced Linux Sound Architecture]]<br />
[[th:Advanced Linux Sound Architecture]]<br />
[[tr:Gelişmiş_ses_mimarisi_(ALSA)]]<br />
[[zh-CN:Advanced Linux Sound Architecture]]<br />
The [[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') is a Linux kernel component which replaced 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 with a local login (at a virtual terminal or a display manager) have permission to play audio and change mixer levels. To allow this for a remote login, the user has to be [[Users and Groups#Group management|added]] to the {{ic|audio}} group. Membership in the {{ic|audio}} group also allows direct access to devices, which can lead to applications grabbing exclusive output (breaking software mixing) and breaks fast-user-switching, and multiseat.<br />
<br />
===User-space utilities===<br />
From [[Official Repositories|official repositories]]:<br />
* [[pacman|Install]] the {{Pkg|alsa-utils}} package which contains the {{ic|alsamixer}} user-space tool, which allows for configuration of the sound device from the console or terminal.<br />
* Install the {{Pkg|alsa-oss}} package if you want OSS applications to work with dmix (software mixing).<br />
{{Note|1=Since [[udev]] >= 171, the OSS emulation modules ({{ic|snd_seq_oss}}, {{ic|snd_pcm_oss}}, {{ic|snd_mixer_oss}}) are not automatically loaded by default.}}<br />
*Install the {{Pkg|alsa-plugins}} package if you want [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] and other advanced features.<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 {{ic|alsamixer}} ncurses UI to accomplish this:<br />
<br />
$ alsamixer<br />
<br />
Alternatively, use {{ic|amixer}} from the command-line:<br />
<br />
$ amixer sset Master unmute<br />
<br />
The label {{ic|MM}} below a channel indicates that the channel is muted, and {{ic|00}} indicates that it is open.<br />
<br />
Scroll to the {{ic|Master}} and {{ic|PCM}} channels with the {{keypress|←}} and {{keypress|→}} keys and unmute them by pressing the {{keypress|m}} key. Use the {{keypress|↑}} key to increase the volume and obtain a value of {{ic|0}} dB gain. The gain can be found in the upper left next to the {{ic|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|<br />
* 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 />
* Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.<br />
* Some machines, (like Dell E6400) may also require the {{ic|Front}} and {{ic|Headphone}} channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
$ speaker-test -c 2<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
$ speaker-test -c 8<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
The {{pkg|alsa-utils}} package includes {{ic|alsa-restore.service}} and {{ic|alsa-store.service}}, which are preconfigured to run at boot and shutdown respectively.<br />
<br />
==Configuration==<br />
===No sound in virtualbox===<br />
If you experience problems with virtualbox, the following command might be helpful:<br />
<br />
{{hc|$ alsactl init|2=<nowiki><br />
<br />
Found hardware: "ICH" "SigmaTel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"<br />
Hardware is initialized using a generic method<br />
</nowiki><br />
}}<br />
<br />
You might need to activate the ALSA output in your audio software as well.<br />
<br />
===Set the default sound card===<br />
<br />
If your sound card order changes on boot, you can specify their order in any file ending with {{ic|.conf}} in {{ic|/etc/modprobe.d}} ({{ic|/etc/modprobe.d/alsa-base.conf}} is suggested).<br />
For example, if you want your mia sound card to be #0:<br />
<br />
{{hc|/etc/modprobe.d/alsa-base.conf|2=<nowiki><br />
options snd slots=snd_mia,snd_hda_intel<br />
options snd_mia index=0<br />
options snd_hda_intel index=1<br />
</nowiki>}}<br />
<br />
snd_mia and snd_hda_intel are the modules used by the respective cards. This configuration assumes you have one mia sound card and one card using snd_hda_intel (e.g. onboard).<br />
<br />
You can also provide an index of -2 to instruct ALSA to never use a card as the primary one. Distributions such as Linux Mint and Ubuntu use the following settings to avoid USB and other "abnormal" drivers from getting index 0:<br />
<br />
{{hc|/etc/modprobe.d/alsa-base.conf|2=<nowiki><br />
options bt87x index=-2<br />
options cx88_alsa index=-2<br />
options saa7134-alsa index=-2<br />
options snd-atiixp-modem index=-2<br />
options snd-intel8x0m index=-2<br />
options snd-via82xx-modem index=-2<br />
options snd-usb-audio index=-2<br />
options snd-usb-caiaq index=-2<br />
options snd-usb-ua101 index=-2<br />
options snd-usb-us122l index=-2<br />
options snd-usb-usx2y index=-2<br />
# Keep snd-pcsp from being loaded as first soundcard<br />
options snd-pcsp index=-2<br />
# Keep snd-usb-audio from beeing loaded as first soundcard<br />
options snd-usb-audio index=-2<br />
</nowiki>}}<br />
<br />
These changes require a system reboot.<br />
<br />
{{Out of date|{{ic|/etc/asound.conf}} does not exist on a default setup, and these instructions may not work.}}<br />
<br />
First you will have to find out the card and device id that you want to set as the default by running {{ic|aplay -l}}:<br />
<br />
{{hc|$ aplay -l|2=<nowiki><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 />
</nowiki>}}<br />
<br />
For example, the last entry in this list has the card ID 2 and the device ID 0. To set this card as the default, you can either use the system-wide file {{ic|/etc/asound.conf}} or the user-specific file {{ic|~/.asoundrc}}. You may have to create the file if it does not exist. Then insert the following options with the corresponding card and device id.<br />
{{hc|~/.asoundrc|2=<nowiki><br />
defaults.pcm.card 2<br />
defaults.pcm.device 0<br />
defaults.ctl.card 2<br />
</nowiki>}}<br />
The 'pcm' options affect which card and device will be used for audio playback while the 'ctl' option affects which card is used by control utilities like alsamixer .<br />
<br />
The changes should take effect as soon as you (re-)start an application (mplayer etc.).<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 />
{{hc|<nowiki>$ lsmod | grep '^snd' | column -t</nowiki>|<nowiki><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 />
</nowiki>}}<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{ic|udev>&#61;171}}, the OSS emulation modules ({{ic|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: [[kernel modules#Loading|Load them manually]] if they are needed.}}<br />
<br />
You might also want to check the directory {{ic|/dev/snd/}} for the right device files:<br />
<br />
{{hc|$ ls -l /dev/snd|2=<nowiki><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 />
</nowiki>}}<br />
<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 sound card: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: {{ic|snd-via82xx}}).<br />
* [[Kernel modules#Loading|Load the module]].<br />
* Check for the device files in {{ic|/dev/snd}} (see above) and/or try if {{ic|alsamixer}} or {{ic|amixer}} have reasonable output.<br />
* Configure {{ic|snd-NAME-OF-MODULE}} and {{ic|snd-pcm-oss}} to [[Kernel modules#Loading|load at boot]].<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 {{ic|/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 {{ic|value:false}}. Change it to {{ic|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 {{ic|/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 />
Install {{AUR|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 ({{ic|~/.asoundrc}} or {{ic|/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 />
# If you don't want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line. (You can<br />
# choose it as the output device by addressing<br />
# it with specific apps,eg mpg123 -a equal 06.Back_In_Black.mp3)<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<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 {{ic|~/.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 for example, you can make a symlink to your {{ic|.alsaequal.bin}} in his home...<br />
<br />
=====Managing AlsaEqual States=====<br />
Install [http://xyne.archlinux.ca/projects/alsaequal-mgr/ alsaequal-mgr] from [http://xyne.archlinux.ca/repos/ Xyne's repos] or the [https://aur.archlinux.org/packages.php?ID=62420 AUR].<br />
<br />
Configure the equalizer as usual with <br />
$alsamixer -D equal<br />
<br />
When you are satisfied with the state, you may give it a name ("foo" in this example) and save it:<br />
$alsaequal-mgr save foo<br />
<br />
The state "foo" can then be restored at a later time with<br />
$alsaequal-mgr load foo<br />
<br />
You can thus create different equalizer states for games, movies, music genres, VoIP apps, etc. and reload them as necessary.<br />
<br />
See the [http://xyne.archlinux.ca/projects/alsaequal-mgr/ project page] and the help message for more options.<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 />
Install the {{Pkg|alsa-plugins}}, {{Pkg|ladspa}} and {{Pkg|swh-plugins}} packages if you do not already have them.<br />
<br />
* If you have not already created either an {{ic|~/.asoundrc}} or a {{ic|/etc/asound.conf}} file, then create either one and insert the following:<br />
<br />
{{hc|/etc/asound.conf|2=<nowiki>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 />
</nowiki>}}<br />
<br />
* You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<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 {{pkg|alsa-plugins}} and {{pkg|libsamplerate}}.<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{hc|/etc/asound.conf|defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{hc|~/.asoundrc|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 {{Pkg|alsa-plugins}}.<br />
<br />
Then add the following to your ALSA configuration file of choice (either {{ic|/etc/asound.conf}} or {{ic|~/.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 />
If this is not working, you have to setup your own dmixer for the upmixing PCM like this: <br />
pcm.dmix6 {<br />
type asym<br />
playback.pcm {<br />
type dmix<br />
ipc_key 567829<br />
slave {<br />
pcm "hw:0,0"<br />
channels 6<br />
}<br />
}<br />
}<br />
<br />
and use "dmix6" instead of "surround71". <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 on analog sound outputs 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 />
For a digital sound output such as S/PDIF, the ALSA package still does not enable dmix by default. Thus, the dmix configuration above can be used to enable dmix for S/PDIF devices.<br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
====Support====<br />
If you have an audio chipset that supports mixing in hardware, then no configuration is necessary. Almost every onboard audio chipset does not support hardware mixing, and requires mixing to be done in software (see above). Many sound cards do support hardware mixing, and the ones best supported on Linux are listed below:<br />
<br />
* Creative SoundBlaster Live! (5.1 model)<br />
* Creative SoundBlaster Audigy (some models)<br />
* Creative SoundBlaster Audidy 2 (ZS models)<br />
* Creative SoundBlaster Audigy 4 (Pro models)<br />
<br />
{{Note|The low end variants of above cards, (Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1) '''do not''' support hardware mixing as they use other chips.}}<br />
<br />
{{Note|The onboard VIA8237 chip 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 />
====Fixes====<br />
If you are using 64-bit Arch and the Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), you can get sound working for Enemy Territory with the following:<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 />
===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 {{ic|ondemand}} or {{ic|conservative}}. Currently, the solution is to switch back to the {{ic|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 it's quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{ic|ipc_key_add_uid 0}} to the {{ic|pcm.dmixer}} block disables this locking. The following is a snippet of the {{ic|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 />
<br />
===Simultaneous Playback Issues===<br />
<br />
<br />
If you are having simultaneous playback issues, and if [[PulseAudio]] is installed (i.e. by [[GNOME]]), its default configuration is set to "hijack" the soundcard. Some users of ALSA may not want to use [[PulseAudio]] and are quite content with their current ALSA settings. One fix is to edit {{ic|/etc/asound.conf}} and comment out the following lines:<br />
# Use PulseAudio by default<br />
#pcm.!default {<br />
# type pulse<br />
# fallback "sysdefault"<br />
# hint {<br />
# show on<br />
# description "Default ALSA Output (currently PulseAudio Sound Server)"<br />
# }<br />
#}<br />
<br />
Commenting the following out also may help:<br />
#ctl.!default {<br />
# type pulse<br />
# fallback "sysdefault"<br />
#}<br />
<br />
This may be a much simpler solution than completely uninstalling [[PulseAudio]].<br />
<br />
Effectively, here is an example of a working {{ic|/etc/asound.conf}}:<br />
{{bc|<nowiki>pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
}<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}</nowiki><br />
}}<br />
<br />
{{note|This {{ic|/etc/asound.conf}} file was intended for and used successfully with a global [[MPD]] configuration. See [[Alsa#Problems_with_Availability_to_Only_One_User_at_a_Time|this section]] on multiple users}}<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, try [[#Set the default sound card|setting the default sound card]].<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 {{ic|~/.mplayer/config}} (or {{ic|/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 {{ic|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 />
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 {{ic|alsamixer}} (e.g. ALC662) and the model can be set in {{ic|/etc/modprobe.d/modprobe.conf}} or {{ic|/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 {{ic|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
{{bc|# 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}}<br />
<br />
===Conflicting PC Speaker===<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 {{ic|/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 {{ic|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{ic|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
In alsamixer, make sure that all the volume levels are up under recording, and that CAPTURE is toggled active on the microphone (e.g. Mic, Internal Mic) and/or on Capture (in alsamixer, select these items and press space). Try making positive Mic Boost and raising Capture and Digital levels higher; this make make static or distortion, but then you can adjust them back down once you're hearing ''something'' when you record<br />
<br />
As the pulseaudio wrapper is shown as "default" in alsamixer, you 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 by testing the microphone with a different device.<br />
<br />
For at least some computers, muting a microphone (MM) simply means its input doesn't go immediately to the speakers. It still receives input.<br />
<br />
Many Dell laptops need "-dmic" to be appended to the model name in {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-hda-intel model=dell-m6-dmic<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{ic|/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 />
See also:<br />
* http://www.alsa-project.org/main/index.php/SoundcardTesting<br />
* http://alsa.opensrc.org/Record_from_mic<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 (e.g. 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 {{ic|~/.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 />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use {{ic|arecord -L}} to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<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 />
{{bc|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
There may be an issue with two conflicting modules loaded, namely {{ic|snd_intel8x0}} and {{ic|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{hc|/etc/modprobe.d/modprobe.conf|blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{ic|alsamixer}} or {{ic|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 />
* dell-m6<br />
* laptop-hpsense<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 />
A list of available models is also available [http://www.mjmwired.net/kernel/Documentation/sound/alsa/HD-Audio-Models.txt here]. To know your chip name type the following command (with * being corrected to match your files). Note that some chips could have been renamed and don't directly match the available ones in the file.<br />
<br />
cat /proc/asound/card*/codec* | grep Codec<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 />
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 {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
If both devices use the same module, it might be possible to disable one of them in the BIOS.<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 />
If snd-usb-audio driver has been loaded, you could try to enable {{ic|softvol}} in '''/etc/asound.conf''' file. Example configuration for the first audio device:<br />
pcm.!default {<br />
type plug<br />
slave.pcm "softvol"<br />
}<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
slave {<br />
pcm "hw:0"<br />
period_time 0<br />
period_size 4096<br />
buffer_size 131072<br />
rate 50000<br />
}<br />
bindings {<br />
0 0<br />
1 1<br />
}<br />
}<br />
pcm.dsnooper {<br />
type dsnoop<br />
ipc_key 1024<br />
slave {<br />
pcm "hw:0"<br />
channels 2<br />
period_time 0<br />
period_size 4096<br />
buffer_size 131072<br />
rate 50000<br />
}<br />
bindings {<br />
0 0<br />
1 1<br />
}<br />
}<br />
pcm.softvol {<br />
type softvol<br />
slave { pcm "dmixer" }<br />
control {<br />
name "Master"<br />
card 0<br />
}<br />
}<br />
ctl.!default {<br />
type hw<br />
card 0<br />
}<br />
ctl.softvol {<br />
type hw<br />
card 0<br />
}<br />
ctl.dmixer {<br />
type hw<br />
card 0<br />
}<br />
<br />
===Pops When Starting and Stopping Playback===<br />
Some modules (e.g. snd_ac97_codec and snd_hda_intel) can power off your sound card when not in use. This can make an audible noise (like a crack/pop/scratch) when turning on/off your sound card. Sometimes even when move the slider volume, or open and close windows (KDE4). If you find this annoying try {{ic|modinfo snd_MY_MODULE}}, and look for a module option that adjusts or disables this feature.<br />
<br />
Example: to disable the power saving mode and solve cracking sound trough speakers issue, using snd_hda_intel add in {{ic|/etc/modprobe.d/modprobe.conf}}<br />
options snd_hda_intel power_save=0<br />
or<br />
options snd_hda_intel power_save=0 power_save_controller=N<br />
<br />
You can also try it with {{ic|1=modprobe snd_hda_intel power_save=0}} before.<br />
<br />
You may also have to unmute the 'Line' ALSA channel for this to work. Any value will do (other than '0' or something too high).<br />
<br />
''Example:'' on an onboard VIA VT1708S (using the snd_hda_intel module) these cracks occured even though 'power_save' was set to 0. Unmuting the 'Line' channel and setting a value of '1' solved the issue.<br />
<br />
Source: https://www.kernel.org/doc/Documentation/sound/alsa/powersave.txt<br />
<br />
If you use a laptop, pm-utils will change {{ic|power_save}} back to 1 when you go onto battery power even if you disable power saving in {{ic|/etc/modprobe.d}}. Disable this for pm-utils by disabling the script that makes the change:<br />
# chmod -x /usr/lib/pm-utils/power.d/intel-audio-powersave<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 {{Ic|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 />
{{Note|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'''<nowiki>=</nowiki>'''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 />
{{hc|~/.asoundrc|<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
}}<br />
<br />
Or you above config does not work try:<br />
{{hc|~/.asoundrc|<br />
defaults.pcm.card 0<br />
defaults.pcm.device 3<br />
defaults.ctl.card 0<br />
}}<br />
<br />
<br />
<br />
====Using udev to automatically turn HDMI audio on or off====<br />
<br />
{{Out of date| /var/run/ConsoleKit/database doesn't exist anymore and the hdmi-switch script doesn't seem to work }}<br />
<br />
{{Note|This will only work if the driver supports udev; NVIDIA's proprietary one, for instance, does not.}}<br />
<br />
The previous steps in this section are good for testing, or if you don't need to hotplug your HDMI cable often. We now consider the situation where you have a laptop and want HDMI audio only when you have the HDMI cable plugged in.<br />
<br />
The code in this section comes from [https://bbs.archlinux.org/viewtopic.php?id=132641 The Arch Linux Forums].<br />
<br />
We create a udev rule (for processing the cable connect/disconnect events), two different ALSA configuration files, and a script that switches between these configurations.<br />
<br />
First create {{ic|/etc/alsa/}} if it doesn't exist yet; it will house the configuration files and the switcher script:<br />
<br />
{{bc|<nowiki>[[ -d /etc/alsa/ ]] || sudo mkdir -v /etc/alsa</nowiki>}}<br />
<br />
Place inside this directory the following files (which you may wish to tweak as you see fit):<br />
<br />
{{hc|/etc/alsa/hdmi-switch|2=<br />
<nowiki><br />
#! /bin/bash<br />
set -x<br />
export DISPLAY=:0<br />
hdmi_status="$(cat /sys/class/drm/card0-HDMI-A-1/status)"<br />
USERID="$(cat /var/run/ConsoleKit/database | grep -B 6 is_active=true | grep uid= | cut -f 2 -d '=')"<br />
USER="$(grep $USERID /etc/passwd | cut -f 1 -d ':')"<br />
<br />
if [[ $hdmi_status == "disconnected" ]]; then<br />
[[ $(pgrep X) > 0 ]] && su $USER -c "xrandr --output HDMI-1 --off"<br />
else<br />
[[ $(pgrep X) > 0 ]] && su $USER -c "xrandr --output LVDS-1 --mode 1920x1080 --auto --output HDMI-1 --auto --right-of LVDS-1"<br />
fi<br />
<br />
ln -sf "/etc/alsa/asound.hdmi-$hdmi_status" /etc/asound.conf<br />
systemctl restart alsa-restore<br />
<br />
exit 0<br />
</nowiki><br />
}}<br />
<br />
{{hc|/etc/alsa/asound.hdmi-connected|2=<br />
pcm.!default {<br />
type plug<br />
slave.pcm "dmixer"<br />
}<br />
<br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "dmixer"<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 <br />
ipc_key_add_uid 0<br />
ipc_perm 0666 <br />
slave {<br />
pcm "hw:0,3" # HDMI CARD AND DEVICE<br />
period_time 0<br />
period_size 1024<br />
buffer_size 8192<br />
rate 48000 #or 44100<br />
} <br />
}<br />
<br />
ctl.dmixer {<br />
type hw<br />
card 0<br />
}<br />
}}<br />
<br />
{{hc|/etc/alsa/asound.hdmi-disconnected|2=<br />
pcm.!default {<br />
type plug<br />
slave.pcm "dmixer"<br />
}<br />
<br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "dmixer"<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 <br />
ipc_key_add_uid 0<br />
ipc_perm 0666 <br />
slave {<br />
pcm "hw:0,0" # LOCAL CARD AND DEVICE<br />
period_time 0<br />
period_size 1024<br />
buffer_size 8192<br />
rate 48000 #or 44100<br />
}<br />
}<br />
<br />
ctl.dmixer {<br />
type hw<br />
card 0<br />
}<br />
<br />
}}<br />
<br />
The two asound.conf versions include dmix settings and allow merging of user permissions so that, for example, the mpd user and your regular user can access it at the same time.<br />
<br />
You may now test that the switcher script works by running,<br />
<br />
# chmod +x /etc/alsa/hdmi-switch<br />
# /etc/alsa/hdmi-switch<br />
<br />
You should find that you can successfully obtain HDMI audio output when you run the script while the cable is plugged in. You should be able to restore your default audio output by unplugging the cable and manually running the script again.<br />
<br />
Once you have that working, we automate the process by adding the udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/hdmi.rules|2=<br />
SUBSYSTEM=="drm", ACTION=="change", RUN+="/bin/bash /etc/alsa/hdmi-switch"<br />
}}<br />
<br />
To make udev incorporate the new rule immediately, reload all rules:<br />
<br />
# udevadm control --reload-rules<br />
<br />
===HDMI Multi-channel PCM output does not work (Intel) ===<br />
As of Linux 3.1 multi-channel PCM output through HDMI with a Intel card (Intel Eaglelake, IbexPeak/Ironlake,SandyBridge/CougarPoint and IvyBridge/PantherPoint) is not yet supported. Support for it has been recently added and expected to be available in Linux 3.2. To make it work in Linux 3.1 you need to apply the following patches:<br />
<br />
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=patch;h=76adaa34db407f174dd06370cb60f6029c33b465 drm: support routines for HDMI/DP ELD]<br />
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=patch;h=e0dac65ed45e72fe34cc7ccc76de0ba220bd38bb drm/i915: pass ELD to HDMI/DP audio driver]<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{ic|/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 {{AUR|asoundconf}} (currently only available from the [[AUR]]) to set the headset as the primary sound output. Before running make sure you have usb audio module enabled ({{ic|modprobe snd-usb-audio}}).<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
==== Crackling sound with USB devices ====<br />
If you experience crackling sound on USB devices, you can try tuning the snd-usb-audio for minimal latency.<br />
<br />
Add this to your {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-usb-audio nrpacks=1<br />
<br />
source: http://alsa.opensrc.org/Usb-audio#Tuning_USB_devices_for_minimal_latencies<br />
<br />
==== Hot-plugging a USB Sound Card ====<br />
In order to automatically make a USB Sound Card the primary output device, when the card is plugged in, you can use the following udev rules (e.g. add the following two lines to {{ic|/etc/udev/rules.d/00-local.rules}} and reboot).<br />
<br />
{{bc|1=KERNEL=="pcmC[D0-9cp]*", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#pcmC}; K=$${K%%D*}; echo defaults.ctl.card $$K > /etc/asound.conf; echo defaults.pcm.card $$K >>/etc/asound.conf'"<br />
KERNEL=="pcmC[D0-9cp]*", ACTION=="remove", PROGRAM="/bin/sh -c 'echo defaults.ctl.card 0 > /etc/asound.conf; echo defaults.pcm.card 0 >>/etc/asound.conf'"}}<br />
<br />
===Error 'Unknown 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 />
or<br />
Found hardware: "HDA-Intel" "VIA VT1705" "HDA:11064397,18490397,00100000" "0x1849" "0x0397"<br />
Hardware is initialized using a generic method<br />
/usr/sbin/alsactl: set_control:1328: failed to obtain info for control #1 (No such file or directory)<br />
/usr/sbin/alsactl: set_control:1328: failed to obtain info for control #2 (No such file or directory)<br />
/usr/sbin/alsactl: set_control:1328: failed to obtain info for control #25 (No such file or directory)<br />
/usr/sbin/alsactl: set_control:1328: failed to obtain info for control #26 (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 />
It may be necessary configure ALSA again with alsamixer<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 {{ic|kdesu}} or {{ic|gksu}}.<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 />
===Low Sound Workaround===<br />
<br />
If you are facing low sound even after maxing out your speakers/headphones, you can give the softvol plugin a try. Add the following to {{ic|/etc/asound.conf}}.<br />
{{bc|<nowiki><br />
pcm.!default {<br />
type plug<br />
slave.pcm "softvol"<br />
}<br />
<br />
pcm.softvol {<br />
type softvol<br />
slave {<br />
pcm "dmix"<br />
}<br />
control {<br />
name "Pre-Amp"<br />
card 0<br />
}<br />
min_dB -5.0<br />
max_dB 20.0<br />
resolution 6<br />
}<br />
</nowiki>}}<br />
{{note| You'll probably have to restart the computer, as restarting the alsa daemon didn't load the new configuration for me. Also, if the configuration doesn't work even after restarting, try changing {{ic|plug}} with {{ic|hw}} in the above configuration.}}<br />
<br />
After the changes are loaded successfully, you will see a {{ic|Pre-Amp}} section in alsamixer. You can adjust the levels there.<br />
{{note|Setting a high value for {{ic|Pre-Amp}} can cause sound distortion, so adjust it according to the level that suits you.}}<br />
<br />
===Popping sound after resuming from suspension===<br />
You might hear a popping sound after resuming the computer from suspension. This can be fixed by editing {{ic|/etc/pm/sleep.d/90alsa}} and removing the line that says {{ic|aplay -d 1 /dev/zero}}<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==See also==<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 />
* [https://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Ballhttps://wiki.archlinux.org/index.php?title=Talk:TeX_Live&diff=190756Talk:TeX Live2012-03-22T16:47:56Z<p>Ball: /* TeX Live Documentation lost? */ new section</p>
<hr />
<div>== What is Tex Live? ==<br />
Could someone please add a section, "What is TeXLive", along with a brief explanation, if possible? Thanks. [[User:Misfit138|Misfit138]] 14:19, 12 September 2008 (EDT)<br />
<br />
== Old teTeX note ==<br />
I have removed the following note from the article because it is two years old.<br />
:''Since September 12, 2008, TeX Live packages have been available in [extra] for both architectures, hence replacing the obsolete [http://www.tug.org/tetex/ teTeX]. Packages for the 2009 release of TeX Live have been available since early September 2009 (thus before the official upstream release). By installing the packages {{Pkg|texlive-core}} and its dependency {{Pkg|texlive-bin}}, you will have a very solid and bleeding-edge typesetting system at your disposal!''<br />
~ [[User:Filam|Filam]] 20:46, 3 December 2011 (EST)<br />
<br />
== TeX Live Documentation lost? ==<br />
<br />
The packages texlive-most-doc and texlive-lang-doc don't seem to exist, at least they are not in the official repositories. Therefore, I think, the corresponding references should be removed. Also one should remark, that there is currently no documentation available for Tex Live in Arch, ''if this is the case''... --[[User:Ball|Ball]] 12:47, 22 March 2012 (EDT)</div>Ball