https://wiki.archlinux.org/api.php?action=feedcontributions&user=Kenshis&feedformat=atomArchWiki - User contributions [en]2024-03-29T11:14:09ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=RTorrent&diff=172748RTorrent2011-12-09T00:40:01Z<p>Kenshis: </p>
<hr />
<div>{{i18n|rTorrent}}<br />
{{DISPLAYTITLE:rTorrent}}<br />
[[Category:Internet Applications (English)]]<br />
<br />
[http://libtorrent.rakshasa.no/ rTorrent] is a quick and efficient BitTorrent client that uses the libtorrent library. It is written in C++ and uses the [[Wikipedia:ncurses|ncurses]] programming library, which means it uses a text user interface. When combined with [[GNU Screen]] and [[Secure Shell]], it becomes a convenient remote [[Wikipedia:BitTorrent (protocol)#Operation|BitTorrent client]].<br />
<br />
== Installation ==<br />
[[pacman|Install]] the {{Pkg|rtorrent}} package that is available in the [[Official Repositories|official repositories]].<br />
<br />
Alternatively, install {{AUR|rtorrent-svn}} or {{AUR|rtorrent-extended}} from the [[Arch User Repository|AUR]].<br />
<br />
== Configuration ==<br />
{{note|See the rTorrent wiki article on this subject for more information: [http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks Common Tasks in rTorrent for Dummies]}}<br />
<br />
Before running rTorrent, download the default configuration file from the rTorrent project page and copy it to {{ic|~/.rtorrent.rc}} (see: [http://libtorrent.rakshasa.no/browser/trunk/rtorrent/doc/rtorrent.rc?format=raw Direct download]).<br />
<br />
=== Performance ===<br />
{{note|See the rTorrent wiki article on this subject for more information: [http://libtorrent.rakshasa.no/wiki/RTorrentPerformanceTuning Performance Tuning]}}<br />
<br />
The values for the following options are dependent on the system's hardware and Internet connection speed. To find the optimal values read: [http://torrentfreak.com/optimize-your-BitTorrent-download-speed Optimize Your BitTorrent Download Speed]<br />
{{bc|<nowiki><br />
min_peers = 40<br />
max_peers = 52<br />
<br />
min_peers_seed = 10<br />
max_peers_seed = 52<br />
<br />
max_uploads = 8<br />
<br />
download_rate = 200<br />
upload_rate = 28<br />
</nowiki>}}<br />
<br />
The {{ic|check_hash}} option executes a hash check when a torrent download is complete or rTorrent is started. When starting, it checks for errors in your completed files. <br />
check_hash = yes<br />
<br />
=== Create and manage files ===<br />
The {{ic|directory}} option will determine where your torrent data will be saved. Be sure to enter the absolute path, as rTorrent may not follow relative paths:<br />
directory = /home/[user]/torrents/<br />
<br />
The {{ic|session}} option allows rTorrent to save the progess of your torrents. It is recommended to create a directory called {{ic|.session}} (e.g. {{ic|$ mkdir ~/.session}}).<br />
session = /home/[user]/.session/<br />
<br />
The {{ic|schedule}} option has rTorrent watch a particular directory for new torrent files. Saving a torrent file to this directory will automatically start the download. Remember to create the directory that will be watched (e.g. {{ic|$ mkdir ~/watch}}). Also, be careful when using this option as rTorrent will move the torrent file to your session folder and rename it to its hash value.<br />
schedule = watch_directory,5,5,load_start=/home/[user]/watch/*.torrent<br />
schedule = untied_directory,5,5,stop_untied=<br />
schedule = tied_directory,5,5,start_tied=<br />
<br />
The following {{ic|schedule}} option is intended to stop rTorrent from downloading data when disk space is low.<br />
schedule = low_diskspace,5,60,close_low_diskspace=100M<br />
<br />
=== Port configuration ===<br />
The {{ic|port_range}} option sets which port(s) to use for listening. It is recommended to use a port that is higher than 49152 (see: [[Wikipedia:List of TCP and UDP port numbers|List of port numbers]]). Although, rTorrent allows a range of ports, a single port is recommended.<br />
port_range = 49164-49164<br />
<br />
Additionally, make sure port forwarding is enabled for the proper port(s) (see: [http://portforward.com/english/routers/port_forwarding/routerindex.htm Port Forward Guides]).<br />
<br />
=== Additional settings ===<br />
The {{ic|encryption}} option enables or disables encryption. It is very important to enable this option, not only for yourself, but also for your peers in the torrent swarm. Some users need to obscure their bandwidth usage from their ISP. And it does not hurt to enable it even if you do not need the added security.<br />
encryption = allow_incoming,try_outgoing,enable_retry<br />
{{Wikipedia|BitTorrent Protocol Encryption}}<br />
<br />
This final {{ic|dht}} option enables [[Wikipedia:Distributed hash table|DHT]] support. DHT is common among public trackers and will allow the client to acquire more peers.<br />
{{bc|<nowiki><br />
dht = auto<br />
dht_port = 6881<br />
peer_exchange = yes<br />
</nowiki>}}<br />
<br />
{{note|See the rTorrent wiki article on this subject for more information: [http://libtorrent.rakshasa.no/wiki/RTorrentUsingDHT Using DHT]}}<br />
<br />
== Key bindings ==<br />
{| class="toccolours" border="1" cellpadding="4" cellspacing="0" align="right" style="margin:5px;"<br />
|-<br />
!width="75" |Cmd<br />
!Action<br />
|-<br />
|Ctrl-q<br />
|Quit application<br />
|-<br />
|Left<br />
|Returns to the previous screen<br />
|-<br />
|Right<br />
|Goes to the next screen<br />
|-<br />
|Backspace<br />
|Adds the specified *.torrent<br />
|}<br />
rTorrent relies exclusively on keyboard shortcuts for user input. A quick reference is available in the table on the right. A complete guide is available on the rTorrent wiki (see: [http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide rTorrent User Guide]).<br />
<br />
{{note|Striking {{keypress|Ctrl-q}} twice in quick succession will make rTorrent shutdown without waiting to send a stop announce to the connected trackers.}}<br />
<br />
=== Redundant mapping ===<br />
{{Keypress|Ctrl-s}} is often used for terminal control to stop screen output while {{Keypress|Ctrl-q}} is used to start it. These mappings may interfere with rTorrent. Check to see if these terminal options are bound to a mapping:<br />
{{hc|$ stty -a|<nowiki>...<br />
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;<br />
...<br />
</nowiki>}}<br />
<br />
To remove the mappings, change the terminal characteristics to undefine the aforementioned special characters (i.e. {{ic|stop}} and {{ic|start}}):<br />
# stty stop undef<br />
# stty start undef<br />
<br />
To remove these mappings automatically at startup you may add the two preceding commands to your {{ic|~/.bashrc}} file.<br />
<br />
== Additional Tips ==<br />
<br />
=== Seperate session with Screen ===<br />
[[GNU Screen]] is a wrapper that allows separation between the text program and the shell from which it was launched.<br />
<br />
Screen flow-control interferes with the {{Keypress|Ctrl-q}} mapping (see: [[#Redundant mapping|Redundant mapping]]). To disable it add the following to {{ic|~/.screenrc}}:<br />
defflow off<br />
<br />
To automatically start rTorrent within Screen, add the following to the {{ic|~/.screenrc}} configuration file:<br />
screen -t rtorrent rtorrent <br />
<br />
==== Run as a daemon ====<br />
{{note|See the rTorrent wiki article on this subject for more information: [http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#StartingrTorrentonSystemStartup Starting rTorrent on System Startup]}}<br />
<br />
Alternatively, Screen and rTorrent can be run together as a [[daemon]] (see also: [https://bbs.archlinux.org/viewtopic.php?id=53395 Arch Linux Forums thread], [http://forums.gentoo.org/viewtopic-t-600362-postdays-0-postorder-asc-start-0.html Gentoo Discussion Forums thread]). <br />
<br />
To use this script with [[Tmux]] replace line 9 with {{ic|su rtorrent -c 'tmux -d -s rtorrent rtorrent' &> /dev/null}} (see: [https://bbs.archlinux.org/viewtopic.php?id=126718 rTorrent daemon with tmux]).<br />
<br />
With root permissions create the following file:<br />
<br />
{{File|name=/etc/rc.d/rtorrent|content=<nowiki><br />
#!/bin/bash<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
case "$1" in<br />
start)<br />
stat_busy "Starting rtorrent"<br />
su - USER -c 'screen -d -m -S rtorrent rtorrent' &> /dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
add_daemon rtorrent<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping rtorrent"<br />
killall -w -s 2 /usr/bin/rtorrent &> /dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon rtorrent<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
sleep 1<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}"<br />
esac<br />
exit 0<br />
</nowiki>}}<br />
<br />
Make the file executable:<br />
sudo chmod +x /etc/rc.d/rtorrent<br />
<br />
Creating a {{ic|.rtorrent.rc}} file with relative paths in a user's home directory will break the rc.d script. To run multiple instances of rTorrent with relative paths under different users replace line 9 in {{ic|/etc/rc.d/rtorrent}} with the following:<br />
su username -c 'cd /home/username && screen -d -m -S rtorrent rtorrent' &> /dev/null<br />
<br />
Alternatively, you can set absolute paths in the configuration file.<br />
<br />
To run the daemon user multiple users create one rc.d script for each user. Then replace line 9 in {{ic|/etc/rc.d/rtorrent}} with the following: <br />
su username -c 'killall -w -s 2 /usr/bin/rtorrent' &> /dev/null<br />
<br />
To connect to the daemon process on a remote machine use [[Secure Shell|SSH]]:<br />
ssh -t rtorrent@192.168.1.10 'screen -r'<br />
<br />
For more information about daemon scripts see: [[Writing rc.d scripts]]<br />
<br />
Alternate scripts can be found on the [http://www.gentoo-wiki.info/Rtorrent#rtorrent Gentoo Wiki Archives], [http://codesnippets.joyent.com/posts/show/1947 Joyent CodeSnippets] and [http://www.bytetouch.com/blog/linux/how-to-rtorrent-with-screen-on-debian/ ByteTouch].<br />
<br />
=== Pre-allocation ===<br />
The rTorrent package in the community repository lacks pre-allocation. Compiling rTorrent with pre-allocation allows files to be allocated before downloading the torrent. The major benefit is that it limits and avoids fragmentation of the filesystem. However, this introduces a delay during the pre-allocation if the filesystem does not support the fallocate syscall natively.<br />
<br />
Therefore this switch is recommended for xfs, ext4 and btrfs filesystems, which have native fallocate syscall support. They will see no delay during preallocation and no fragmented filesystem. Pre-allocation on others filesystems will cause a delay but will not fragment the files.<br />
<br />
To make pre-allocation available, recompile libtorrent from the [[ABS]] tree with the following new switch:<br />
./configure --prefix=/usr --disable-debug --with-posix-fallocate<br />
<br />
To enable it, add the following to your {{ic|~/rtorrent.rc}}:<br />
# Preallocate files; reduces defragmentation on filesystems.<br />
system.file_allocate.set = yes<br />
<br />
=== Manage completed files ===<br />
{{note|Currently, this part requires either the svn version of rtorrent/libtorrent or having applied the patch to 0.8.6 that adds 'equal'.}}<br />
<br />
{{note|If you're having trouble with this tip, it's probably easier to follow [http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#Movecompletedtorrentstodifferentdirectorydependingonwatchdirectory this]}}<br />
<br />
It is possible to have rtorrent sort completed torrent data to specific folders based on which 'watch' folder you drop the *.torrent into while continuing to seed. Many examples show how to do this with torrents downloaded by rtorrent. The problem is when you try to drop in 100% done torrent data and then have rtorrent check the data and resume. It will not be sorted.<br />
<br />
As a solution, use the following example in your ~/.rtorrent.rc.<br />
Make sure to change the paths.<br />
<br />
{{bc|<br />
# location where new torrent data is placed, and where you should place your<br />
# 'complete' data before you place your *.torrent file into the watch folder<br />
directory = /home/user/torrents/incomplete<br />
<br />
# schedule a timer event named 'watch_directory_1':<br />
# 1) triggers 10 seconds after rtorrent starts<br />
# 2) triggers at 10 second intervals thereafter<br />
# 3) Upon trigger, attempt to load (and start) new *.torrent files found in /home/user/torrents/watch/<br />
# 4) set a variable named 'custom1' with the value "/home/user/torrents/complete"<br />
# NOTE: if you do not want it to automatically start the torrent, change 'load_start' to 'load'<br />
schedule = watch_directory_1,10,10,"load_start=/home/user/torrents/watch/*.torrent,d.set_custom1=/home/user/torrents/complete"<br />
<br />
# insert a method with the alias 'checkdirs1'<br />
# 1) returns true if the current path of the torrent data is not equal to the value of custom1<br />
# 2) otherwise, returns false<br />
system.method.insert=checkdirs1,simple,"not=\"$equal={d.get_custom1=,d.get_base_path=}\""<br />
<br />
# insert a method with the alias 'movecheck1'<br />
# 1) returns true if all 3 commands return true ('result of checkdirs1' && 'torrent is 100% done', 'custom1 variable is set')<br />
# 2) otherwise, returns false<br />
system.method.insert=movecheck1,simple,"and={checkdirs1=,d.get_complete=,d.get_custom1=}"<br />
<br />
# insert a method with the alias 'movedir1'<br />
# (a series of commands, separated by ';') <br />
# 1) "set path of torrent to equal the value of custom1";<br />
# 2) "mv -u <current data path> <custom1 path>";<br />
# 3) "clear custom1", "stop the torrent","resume the torrent"<br />
# 4) stop the torrent<br />
# 5) start the torrent (to get the torrent to update the 'base path')<br />
system.method.insert=movedir1,simple,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1=;d.set_custom1=;d.stop=;d.start="<br />
<br />
# set a key with the name 'move_hashed1' that is triggered by the hash_done event.<br />
# 1) When hashing of a torrent completes, this custom key will be triggered.<br />
# 2) when triggered, execute the 'movecheck1' method and check the return value.<br />
# 3) if the 'movecheck' method returns 'true', execute the 'movedir1' method we inserted above.<br />
# NOTE: 'branch' is an 'if' conditional statement: if(movecheck1){movedir1}<br />
system.method.set_key=event.download.hash_done,move_hashed1,"branch={$movecheck1=,movedir1=}"<br />
}}<br />
<br />
You can add additional watch folders and rules should you like to sort your torrents into special folders.<br />
<br />
For example, if you would like the torrents to download in:<br />
/home/user/torrents/incomplete<br />
and then sort the torrent data based on which folder you dropped the *.torrent into:<br />
/home/user/torrents/watch => /home/user/torrents/complete<br />
/home/user/torrents/watch/iso => /home/user/torrents/complete/iso<br />
/home/user/torrents/watch/music => /home/user/torrents/complete/music<br />
<br />
You can have the following in your .rtorrent.rc:<br />
{{bc|<br />
directory = /home/user/torrents/incomplete<br />
schedule = watch_directory_1,10,10,"load_start=/home/user/torrents/watch/*.torrent,d.set_custom1=/home/user/torrents/complete"<br />
<br />
schedule = watch_directory_2,10,10,"load_start=/home/user/torrents/watch/iso/*.torrent,d.set_custom1=/home/user/torrents/complete/iso"<br />
<br />
schedule = watch_directory_3,10,10,"load_start=/home/user/torrents/watch/music/*.torrent,d.set_custom1=/home/user/torrents/complete/music"<br />
<br />
system.method.insert=checkdirs1,simple,"not=\"$equal={d.get_custom1=,d.get_base_path=}\""<br />
system.method.insert=movecheck1,simple,"and={checkdirs1=,d.get_complete=,d.get_custom1=}"<br />
system.method.insert=movedir1,simple,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1=;d.set_custom1=;d.stop=;d.start="<br />
system.method.set_key=event.download.hash_done,move_hashed1,"branch={$movecheck1=,movedir1=}"<br />
}}<br />
<br />
Also see [http://code.google.com/p/pyroscope/ pyroscope] especially the rtcontrol examples. There is an AUR package.<br />
<br />
==== Notificaion with Google Mail ====<br />
<br />
Cell phone providers allow you to "email" your phone:<br />
{{bc|<nowiki><br />
Verizon: 10digitphonenumber@vtext.com<br />
AT&T: 10digitphonenumber@txt.att.net<br />
Former AT&T customers: 10digitphonenumber@mmode.com<br />
Sprint: 10digitphonenumber@messaging.sprintpcs.com<br />
T-Mobile: 10digitphonenumber@tmomail.net<br />
Nextel: 10digitphonenumber@messaging.nextel.com<br />
Cingular: 10digitphonenumber@cingularme.com<br />
Virgin Mobile: 10digitphonenumber@vmobl.com<br />
Alltel: 10digitphonenumber@alltelmessage.com OR<br />
10digitphonenumber@message.alltel.com<br />
CellularOne: 10digitphonenumber@mobile.celloneusa.com<br />
Omnipoint: 10digitphonenumber@omnipointpcs.com<br />
Qwest: 10digitphonenumber@qwestmp.com<br />
Telus: 10digitphonenumber@msg.telus.com<br />
Rogers Wireless: 10digitphonenumber@pcs.rogers.com<br />
Fido: 10digitphonenumber@fido.ca<br />
Bell Mobility: 10digitphonenumber@txt.bell.ca<br />
Koodo Mobile: 10digitphonenumber@msg.koodomobile.com<br />
MTS: 10digitphonenumber@text.mtsmobility.com<br />
President's Choice: 10digitphonenumber@txt.bell.ca<br />
Sasktel: 10digitphonenumber@sms.sasktel.com<br />
Solo: 10digitphonenumber@txt.bell.ca<br />
</nowiki>}}<br />
<br />
*Install Heirloom's mailx program which is provided by the {{Pkg|mailx-heirloom}} package that is found in the [[Official Repositories|official repositories]].<br />
<br />
*Clear the {{ic|/etc/mail.rc}} file and enter:<br />
<br />
{{Note|Older versions of Heirloom's mailx use {{ic|/etc/nail.rc}}.}}<br />
<br />
{{bc|<nowiki><br />
set sendmail="/usr/bin/mailx"<br />
set smtp=smtp.gmail.com:587<br />
set smtp-use-starttls<br />
set ssl-verify=ignore<br />
set ssl-auth=login<br />
set smtp-auth-user=USERNAME@gmail.com<br />
set smtp-auth-password=PASSWORD<br />
</nowiki>}}<br />
<br />
Now to send the text, we must pipe a message to the mailx program.<br />
*Make a Bash script:<br />
{{hc|/path/to/mail.sh|<nowiki><br />
echo "$@: Done" | mailx 5551234567@vtext.com<br />
</nowiki>}}<br />
Where the $@ is a variable holding all the arguments passed to our script.<br />
<br />
*And finally, add the important {{ic|~/.rtorrent.rc}} line:<br />
system.method.set_key = event.download.finished,notify_me,"execute=/path/to/mail.sh,$d.get_name="<br />
<br />
Breaking it down:<br />
<br />
{{ic|notify_me}} is the command id, which may be used by other commands, it can be just about anything you like, so long as it is unique.<br />
<br />
{{ic|1=execute=}} is the rtorrent command, in this case to execute a shell command.<br />
<br />
{{ic|/path/to/mail.sh}} is the name of our script (or whatever command you want to execute) followed by a comma separated list of all the switches/arguments to be passed.<br />
<br />
{{ic|1=$d.get_name=}} 'd' is an alias to whatever download triggered the command, get_name is a function which returns the name of our download, and the '$' tells rTorrent to replace the command with its output before it calls execute.<br />
<br />
The end result? When that torrent, 'All Live Nudibranches', that we started before leaving for work finishes, we will be texted:<br />
All Live Nudibranches: Done<br />
<br />
=== Displaying active torrents ===<br />
The rtorrent doesn't list the active tab properly by default, add this line to your {{ic|.rtorrent.rc}} to show only active torrents<br />
schedule = filter_active,30,30,"view_filter = active,\"or={d.get_up_rate=,d.get_down_rate=}\""<br />
<br />
Then press {{keypress|9}} in your rTorrent client to see the changes in action.<br />
<br />
== Troubleshooting ==<br />
<br />
=== CA certificates ===<br />
To use rTorrent with a tracker that uses HTTPS, do the following as root:<br />
<br />
{{bc|cd /etc/ssl/certs<br />
wget --no-check-certificate https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Global_eBusiness_CA-1.cer<br />
mv Equifax_Secure_Global_eBusiness_CA-1.cer Equifax_Secure_Global_eBusiness_CA-1.pem<br />
c_rehash<br />
}}<br />
<br />
And from now on run rTorrent with:<br />
rtorrent -o http_capath=/etc/ssl/certs<br />
<br />
If you use GNU Screen, update the {{ic|.screenrc}} configuration file to reflect this change:<br />
screen -t rtorrent rtorrent -o http_capath=/etc/ssl/certs<br />
<br />
In rTorrent 0.8.9, set {{ic|<nowiki>network.http.ssl_verify_peer.set=0</nowiki>}} to fix the problem.<sup>[https://bbs.archlinux.org/viewtopic.php?pid=981832#p981832]</sup><br />
<br />
For more information see: [https://bbs.archlinux.org/viewtopic.php?pid=331850 rTorrent Error & CA Certificate] and [https://bbs.archlinux.org/viewtopic.php?id=45800 rTorrent Certificates Problem]<br />
<br />
== Web interface ==<br />
There are numerous web interfaces and front ends for rTorrent including:<br />
* [[WTorrent]] is a web interface to rtorrent programmed in php using Smarty templates and XMLRPC for PHP library.<br />
* [http://code.google.com/p/ntorrent/ nTorrent] is a graphical user interface client to rtorrent (a cli torrent client) written in Java.<br />
* [http://projects.cyla.homeip.net/rtwi/ rTWi] is a simple rTorrent web interface written in PHP.<br />
* [[Rtgui]] is a web based front end for rTorrent written in PHP and uses XML-RPC to communicate with the rTorrent client.<br />
* [http://code.google.com/p/rutorrent/ rutorrent] and [http://forums.rutorrent.org/ Forum] - A web-based front-end with an interface very similar to uTorrent which supports many plugins and advanced features (see also: [https://bbs.archlinux.org/viewtopic.php?pid=897577#p897577 Guide for rTorrent + ruTorrent Installation]).<br />
<br />
{{note|rTorrent is currently built using [http://xmlrpc-c.sourceforge.net/ XML-RPC for C/C++], which is required for some web interfaces (e.g. ruTorrent).}}<br />
<br />
=== XMLRPC interface ===<br />
If you want to use rtorrent with some web interfaces (e.g. rutorrent) you need to add the following line to the configuration file:<br />
scgi_port = localhost:5000<br />
<br />
For more information see: [http://libtorrent.rakshasa.no/wiki/RTorrentXMLRPCGuide Using XMLRPC with rtorrent]<br />
<br />
== See also ==<br />
* [[Screen Tips]]<br />
* [[Wikipedia:Comparison of BitTorrent clients|Comparison of BitTorrent clients]] on Wikipedia<br />
* [http://community.rutorrent.org/ rTorrent Community Wiki] - A public place for information on rTorrent and any project related to rTorrent, regarding setup, configuration, operations, and development.<br />
* [http://code.google.com/p/pyroscope/ PyroScope] - A collection of command line tools for rTorrent. It provides commands for creating and modifying torrent files, moving data on completion without having multiple watch folders, and mass-controlling download items via rTorrent's XML-RPC interface: searching, start/stop, deleting items with or without their data, etc. It also offers a documented [[Python]] API.<br />
* [http://wiki.theaveragegeek.com/howto/installing_rtorrent_and_hellanzb_on_centos5_64-bit_vps How-to Install rTorrent and Hellanzb on CentOS 5 64-bit VPS]<br />
* [http://code.google.com/p/pyroscope/wiki/DebianInstallFromSource Installation Guide for rTorrent and Pryoscope on Debian] - A collection of tools for the BitTorrent protocol and especially the rTorrent client<br />
* [http://mktorrent.sourceforge.net/ mktorrent] - A command line application used to generate torrent files, which is available as {{Pkg|mktorrent}} in the [[Official Repositories|official repositories]].<br />
<br />
<br />
'''Forum threads'''<br />
* 2009-03-11 - Arch Linux - [https://bbs.archlinux.org/viewtopic.php?id=67304 HOWTO: rTorrent stats in Conky]<br />
<br />
== References ==<br />
* [http://jasonwryan.com/post/13494126076/rtorrent Building rtorrent on Debian Squeeze] by Jason Wryan</div>Kenshishttps://wiki.archlinux.org/index.php?title=RTorrent&diff=172747RTorrent2011-12-09T00:39:26Z<p>Kenshis: </p>
<hr />
<div>{{i18n|rTorrent}}<br />
{{DISPLAYTITLE:rTorrent}}<br />
[[Category:Internet Applications (English)]]<br />
<br />
[http://libtorrent.rakshasa.no/ rTorrent] is a quick and efficient BitTorrent client that uses the libtorrent library. It is written in C++ and uses the [[Wikipedia:ncurses|ncurses]] programming library, which means it uses a text user interface. When combined with [[GNU Screen]] and [[Secure Shell]], it becomes a convenient remote [[Wikipedia:BitTorrent (protocol)#Operation|BitTorrent client]].<br />
<br />
== Installation ==<br />
[[pacman|Install]] the {{Pkg|rtorrent}} package that is available in the [[Official Repositories|official repositories]].<br />
<br />
Alternatively, install {{AUR|rtorrent-svn}} or {{AUR|rtorrent-extended}} from the [[Arch User Repository|AUR]].<br />
<br />
== Configuration ==<br />
{{note|See the rTorrent wiki article on this subject for more information: [http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks Common Tasks in rTorrent for Dummies]}}<br />
<br />
Before running rTorrent, download the default configuration file from the rTorrent project page and copy it to {{ic|~/.rtorrent.rc}} (see: [http://libtorrent.rakshasa.no/browser/trunk/rtorrent/doc/rtorrent.rc?format=raw Direct download]).<br />
<br />
=== Performance ===<br />
{{note|See the rTorrent wiki article on this subject for more information: [http://libtorrent.rakshasa.no/wiki/RTorrentPerformanceTuning Performance Tuning]}}<br />
<br />
The values for the following options are dependent on the system's hardware and Internet connection speed. To find the optimal values read: [http://torrentfreak.com/optimize-your-BitTorrent-download-speed Optimize Your BitTorrent Download Speed]<br />
{{bc|<nowiki><br />
min_peers = 40<br />
max_peers = 52<br />
<br />
min_peers_seed = 10<br />
max_peers_seed = 52<br />
<br />
max_uploads = 8<br />
<br />
download_rate = 200<br />
upload_rate = 28<br />
</nowiki>}}<br />
<br />
The {{ic|check_hash}} option executes a hash check when a torrent download is complete or rTorrent is started. When starting, it checks for errors in your completed files. <br />
check_hash = yes<br />
<br />
=== Create and manage files ===<br />
The {{ic|directory}} option will determine where your torrent data will be saved. Be sure to enter the absolute path, as rTorrent may not follow relative paths:<br />
directory = /home/[user]/torrents/<br />
<br />
The {{ic|session}} option allows rTorrent to save the progess of your torrents. It is recommended to create a directory called {{ic|.session}} (e.g. {{ic|$ mkdir ~/.session}}).<br />
session = /home/[user]/.session/<br />
<br />
The {{ic|schedule}} option has rTorrent watch a particular directory for new torrent files. Saving a torrent file to this directory will automatically start the download. Remember to create the directory that will be watched (e.g. {{ic|$ mkdir ~/watch}}). Also, be careful when using this option as rTorrent will move the torrent file to your session folder and rename it to its hash value.<br />
schedule = watch_directory,5,5,load_start=/home/[user]/watch/*.torrent<br />
schedule = untied_directory,5,5,stop_untied=<br />
schedule = tied_directory,5,5,start_tied=<br />
<br />
The following {{ic|schedule}} option is intended to stop rTorrent from downloading data when disk space is low.<br />
schedule = low_diskspace,5,60,close_low_diskspace=100M<br />
<br />
=== Port configuration ===<br />
The {{ic|port_range}} option sets which port(s) to use for listening. It is recommended to use a port that is higher than 49152 (see: [[Wikipedia:List of TCP and UDP port numbers|List of port numbers]]). Although, rTorrent allows a range of ports, a single port is recommended.<br />
port_range = 49164-49164<br />
<br />
Additionally, make sure port forwarding is enabled for the proper port(s) (see: [http://portforward.com/english/routers/port_forwarding/routerindex.htm Port Forward Guides]).<br />
<br />
=== Additional settings ===<br />
The {{ic|encryption}} option enables or disables encryption. It is very important to enable this option, not only for yourself, but also for your peers in the torrent swarm. Some users need to obscure their bandwidth usage from their ISP. And it does not hurt to enable it even if you do not need the added security.<br />
encryption = allow_incoming,try_outgoing,enable_retry<br />
{{Wikipedia|BitTorrent Protocol Encryption}}<br />
<br />
This final {{ic|dht}} option enables [[Wikipedia:Distributed hash table|DHT]] support. DHT is common among public trackers and will allow the client to acquire more peers.<br />
{{bc|<nowiki><br />
dht = auto<br />
dht_port = 6881<br />
peer_exchange = yes<br />
</nowiki>}}<br />
<br />
{{note|See the rTorrent wiki article on this subject for more information: [http://libtorrent.rakshasa.no/wiki/RTorrentUsingDHT Using DHT]}}<br />
<br />
== Key bindings ==<br />
{| class="toccolours" border="1" cellpadding="4" cellspacing="0" align="right" style="margin:5px;"<br />
|-<br />
!width="75" |Cmd<br />
!Action<br />
|-<br />
|Ctrl-q<br />
|Quit application<br />
|-<br />
|Left<br />
|Returns to the previous screen<br />
|-<br />
|Right<br />
|Goes to the next screen<br />
|-<br />
|Backspace<br />
|Adds the specified *.torrent<br />
|}<br />
rTorrent relies exclusively on keyboard shortcuts for user input. A quick reference is available in the table on the right. A complete guide is available on the rTorrent wiki (see: [http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide rTorrent User Guide]).<br />
<br />
{{note|Striking {{keypress|Ctrl-q}} twice in quick succession will make rTorrent shutdown without waiting to send a stop announce to the connected trackers.}}<br />
<br />
=== Redundant mapping ===<br />
{{Keypress|Ctrl-s}} is often used for terminal control to stop screen output while {{Keypress|Ctrl-q}} is used to start it. These mappings may interfere with rTorrent. Check to see if these terminal options are bound to a mapping:<br />
{{hc|$ stty -a|<nowiki>...<br />
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;<br />
...<br />
</nowiki>}}<br />
<br />
To remove the mappings, change the terminal characteristics to undefine the aforementioned special characters (i.e. {{ic|stop}} and {{ic|start}}):<br />
# stty stop undef<br />
# stty start undef<br />
<br />
To remove these mappings automatically at startup you may add the two preceding commands to your {{ic|~/.bashrc}} file.<br />
<br />
== Additional Tips ==<br />
<br />
=== Seperate session with Screen ===<br />
[[GNU Screen]] is a wrapper that allows separation between the text program and the shell from which it was launched.<br />
<br />
Screen flow-control interferes with the {{Keypress|Ctrl-q}} mapping (see: [[#Redundant mapping|Redundant mapping]]). To disable it add the following to {{ic|~/.screenrc}}:<br />
defflow off<br />
<br />
To automatically start rTorrent within Screen, add the following to the {{ic|~/.screenrc}} configuration file:<br />
screen -t rtorrent rtorrent <br />
<br />
==== Run as a daemon ====<br />
{{note|See the rTorrent wiki article on this subject for more information: [http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#StartingrTorrentonSystemStartup Starting rTorrent on System Startup]}}<br />
<br />
Alternatively, Screen and rTorrent can be run together as a [[daemon]] (see also: [https://bbs.archlinux.org/viewtopic.php?id=53395 Arch Linux Forums thread], [http://forums.gentoo.org/viewtopic-t-600362-postdays-0-postorder-asc-start-0.html Gentoo Discussion Forums thread]). <br />
<br />
To use this script with [[Tmux]] replace line 9 with {{ic|su rtorrent -c 'tmux -d -s rtorrent rtorrent' &> /dev/null}} (see: [https://bbs.archlinux.org/viewtopic.php?id=126718 rTorrent daemon with tmux]).<br />
<br />
With root permissions create the following file:<br />
<br />
{{File|name=/etc/rc.d/rtorrent|content=<nowiki><br />
#!/bin/bash<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
case "$1" in<br />
start)<br />
stat_busy "Starting rtorrent"<br />
su - USER -c 'screen -d -m -S rtorrent rtorrent' &> /dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
add_daemon rtorrent<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping rtorrent"<br />
killall -w -s 2 /usr/bin/rtorrent &> /dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon rtorrent<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
sleep 1<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start:|stop|restart}"<br />
esac<br />
exit 0<br />
</nowiki>}}<br />
<br />
Make the file executable:<br />
sudo chmod +x /etc/rc.d/rtorrent<br />
<br />
Creating a {{ic|.rtorrent.rc}} file with relative paths in a user's home directory will break the rc.d script. To run multiple instances of rTorrent with relative paths under different users replace line 9 in {{ic|/etc/rc.d/rtorrent}} with the following:<br />
su username -c 'cd /home/username && screen -d -m -S rtorrent rtorrent' &> /dev/null<br />
<br />
Alternatively, you can set absolute paths in the configuration file.<br />
<br />
To run the daemon user multiple users create one rc.d script for each user. Then replace line 9 in {{ic|/etc/rc.d/rtorrent}} with the following: <br />
su username -c 'killall -w -s 2 /usr/bin/rtorrent' &> /dev/null<br />
<br />
To connect to the daemon process on a remote machine use [[Secure Shell|SSH]]:<br />
ssh -t rtorrent@192.168.1.10 'screen -r'<br />
<br />
For more information about daemon scripts see: [[Writing rc.d scripts]]<br />
<br />
Alternate scripts can be found on the [http://www.gentoo-wiki.info/Rtorrent#rtorrent Gentoo Wiki Archives], [http://codesnippets.joyent.com/posts/show/1947 Joyent CodeSnippets] and [http://www.bytetouch.com/blog/linux/how-to-rtorrent-with-screen-on-debian/ ByteTouch].<br />
<br />
=== Pre-allocation ===<br />
The rTorrent package in the community repository lacks pre-allocation. Compiling rTorrent with pre-allocation allows files to be allocated before downloading the torrent. The major benefit is that it limits and avoids fragmentation of the filesystem. However, this introduces a delay during the pre-allocation if the filesystem does not support the fallocate syscall natively.<br />
<br />
Therefore this switch is recommended for xfs, ext4 and btrfs filesystems, which have native fallocate syscall support. They will see no delay during preallocation and no fragmented filesystem. Pre-allocation on others filesystems will cause a delay but will not fragment the files.<br />
<br />
To make pre-allocation available, recompile libtorrent from the [[ABS]] tree with the following new switch:<br />
./configure --prefix=/usr --disable-debug --with-posix-fallocate<br />
<br />
To enable it, add the following to your {{ic|~/rtorrent.rc}}:<br />
# Preallocate files; reduces defragmentation on filesystems.<br />
system.file_allocate.set = yes<br />
<br />
=== Manage completed files ===<br />
{{note|Currently, this part requires either the svn version of rtorrent/libtorrent or having applied the patch to 0.8.6 that adds 'equal'.}}<br />
<br />
{{note|If you're having trouble with this tip, it's probably easier to follow [http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#Movecompletedtorrentstodifferentdirectorydependingonwatchdirectory this]}}<br />
<br />
It is possible to have rtorrent sort completed torrent data to specific folders based on which 'watch' folder you drop the *.torrent into while continuing to seed. Many examples show how to do this with torrents downloaded by rtorrent. The problem is when you try to drop in 100% done torrent data and then have rtorrent check the data and resume. It will not be sorted.<br />
<br />
As a solution, use the following example in your ~/.rtorrent.rc.<br />
Make sure to change the paths.<br />
<br />
{{bc|<br />
# location where new torrent data is placed, and where you should place your<br />
# 'complete' data before you place your *.torrent file into the watch folder<br />
directory = /home/user/torrents/incomplete<br />
<br />
# schedule a timer event named 'watch_directory_1':<br />
# 1) triggers 10 seconds after rtorrent starts<br />
# 2) triggers at 10 second intervals thereafter<br />
# 3) Upon trigger, attempt to load (and start) new *.torrent files found in /home/user/torrents/watch/<br />
# 4) set a variable named 'custom1' with the value "/home/user/torrents/complete"<br />
# NOTE: if you do not want it to automatically start the torrent, change 'load_start' to 'load'<br />
schedule = watch_directory_1,10,10,"load_start=/home/user/torrents/watch/*.torrent,d.set_custom1=/home/user/torrents/complete"<br />
<br />
# insert a method with the alias 'checkdirs1'<br />
# 1) returns true if the current path of the torrent data is not equal to the value of custom1<br />
# 2) otherwise, returns false<br />
system.method.insert=checkdirs1,simple,"not=\"$equal={d.get_custom1=,d.get_base_path=}\""<br />
<br />
# insert a method with the alias 'movecheck1'<br />
# 1) returns true if all 3 commands return true ('result of checkdirs1' && 'torrent is 100% done', 'custom1 variable is set')<br />
# 2) otherwise, returns false<br />
system.method.insert=movecheck1,simple,"and={checkdirs1=,d.get_complete=,d.get_custom1=}"<br />
<br />
# insert a method with the alias 'movedir1'<br />
# (a series of commands, separated by ';') <br />
# 1) "set path of torrent to equal the value of custom1";<br />
# 2) "mv -u <current data path> <custom1 path>";<br />
# 3) "clear custom1", "stop the torrent","resume the torrent"<br />
# 4) stop the torrent<br />
# 5) start the torrent (to get the torrent to update the 'base path')<br />
system.method.insert=movedir1,simple,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1=;d.set_custom1=;d.stop=;d.start="<br />
<br />
# set a key with the name 'move_hashed1' that is triggered by the hash_done event.<br />
# 1) When hashing of a torrent completes, this custom key will be triggered.<br />
# 2) when triggered, execute the 'movecheck1' method and check the return value.<br />
# 3) if the 'movecheck' method returns 'true', execute the 'movedir1' method we inserted above.<br />
# NOTE: 'branch' is an 'if' conditional statement: if(movecheck1){movedir1}<br />
system.method.set_key=event.download.hash_done,move_hashed1,"branch={$movecheck1=,movedir1=}"<br />
}}<br />
<br />
You can add additional watch folders and rules should you like to sort your torrents into special folders.<br />
<br />
For example, if you would like the torrents to download in:<br />
/home/user/torrents/incomplete<br />
and then sort the torrent data based on which folder you dropped the *.torrent into:<br />
/home/user/torrents/watch => /home/user/torrents/complete<br />
/home/user/torrents/watch/iso => /home/user/torrents/complete/iso<br />
/home/user/torrents/watch/music => /home/user/torrents/complete/music<br />
<br />
You can have the following in your .rtorrent.rc:<br />
{{bc|<br />
directory = /home/user/torrents/incomplete<br />
schedule = watch_directory_1,10,10,"load_start=/home/user/torrents/watch/*.torrent,d.set_custom1=/home/user/torrents/complete"<br />
<br />
schedule = watch_directory_2,10,10,"load_start=/home/user/torrents/watch/iso/*.torrent,d.set_custom1=/home/user/torrents/complete/iso"<br />
<br />
schedule = watch_directory_3,10,10,"load_start=/home/user/torrents/watch/music/*.torrent,d.set_custom1=/home/user/torrents/complete/music"<br />
<br />
system.method.insert=checkdirs1,simple,"not=\"$equal={d.get_custom1=,d.get_base_path=}\""<br />
system.method.insert=movecheck1,simple,"and={checkdirs1=,d.get_complete=,d.get_custom1=}"<br />
system.method.insert=movedir1,simple,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1=;d.set_custom1=;d.stop=;d.start="<br />
system.method.set_key=event.download.hash_done,move_hashed1,"branch={$movecheck1=,movedir1=}"<br />
}}<br />
<br />
Also see [http://code.google.com/p/pyroscope/ pyroscope] especially the rtcontrol examples. There is an AUR package.<br />
<br />
==== Notificaion with Google Mail ====<br />
<br />
Cell phone providers allow you to "email" your phone:<br />
{{bc|<nowiki><br />
Verizon: 10digitphonenumber@vtext.com<br />
AT&T: 10digitphonenumber@txt.att.net<br />
Former AT&T customers: 10digitphonenumber@mmode.com<br />
Sprint: 10digitphonenumber@messaging.sprintpcs.com<br />
T-Mobile: 10digitphonenumber@tmomail.net<br />
Nextel: 10digitphonenumber@messaging.nextel.com<br />
Cingular: 10digitphonenumber@cingularme.com<br />
Virgin Mobile: 10digitphonenumber@vmobl.com<br />
Alltel: 10digitphonenumber@alltelmessage.com OR<br />
10digitphonenumber@message.alltel.com<br />
CellularOne: 10digitphonenumber@mobile.celloneusa.com<br />
Omnipoint: 10digitphonenumber@omnipointpcs.com<br />
Qwest: 10digitphonenumber@qwestmp.com<br />
Telus: 10digitphonenumber@msg.telus.com<br />
Rogers Wireless: 10digitphonenumber@pcs.rogers.com<br />
Fido: 10digitphonenumber@fido.ca<br />
Bell Mobility: 10digitphonenumber@txt.bell.ca<br />
Koodo Mobile: 10digitphonenumber@msg.koodomobile.com<br />
MTS: 10digitphonenumber@text.mtsmobility.com<br />
President's Choice: 10digitphonenumber@txt.bell.ca<br />
Sasktel: 10digitphonenumber@sms.sasktel.com<br />
Solo: 10digitphonenumber@txt.bell.ca<br />
</nowiki>}}<br />
<br />
*Install Heirloom's mailx program which is provided by the {{Pkg|mailx-heirloom}} package that is found in the [[Official Repositories|official repositories]].<br />
<br />
*Clear the {{ic|/etc/mail.rc}} file and enter:<br />
<br />
{{Note|Older versions of Heirloom's mailx use {{ic|/etc/nail.rc}}.}}<br />
<br />
{{bc|<nowiki><br />
set sendmail="/usr/bin/mailx"<br />
set smtp=smtp.gmail.com:587<br />
set smtp-use-starttls<br />
set ssl-verify=ignore<br />
set ssl-auth=login<br />
set smtp-auth-user=USERNAME@gmail.com<br />
set smtp-auth-password=PASSWORD<br />
</nowiki>}}<br />
<br />
Now to send the text, we must pipe a message to the mailx program.<br />
*Make a Bash script:<br />
{{hc|/path/to/mail.sh|<nowiki><br />
echo "$@: Done" | mailx 5551234567@vtext.com<br />
</nowiki>}}<br />
Where the $@ is a variable holding all the arguments passed to our script.<br />
<br />
*And finally, add the important {{ic|~/.rtorrent.rc}} line:<br />
system.method.set_key = event.download.finished,notify_me,"execute=/path/to/mail.sh,$d.get_name="<br />
<br />
Breaking it down:<br />
<br />
{{ic|notify_me}} is the command id, which may be used by other commands, it can be just about anything you like, so long as it is unique.<br />
<br />
{{ic|1=execute=}} is the rtorrent command, in this case to execute a shell command.<br />
<br />
{{ic|/path/to/mail.sh}} is the name of our script (or whatever command you want to execute) followed by a comma separated list of all the switches/arguments to be passed.<br />
<br />
{{ic|1=$d.get_name=}} 'd' is an alias to whatever download triggered the command, get_name is a function which returns the name of our download, and the '$' tells rTorrent to replace the command with its output before it calls execute.<br />
<br />
The end result? When that torrent, 'All Live Nudibranches', that we started before leaving for work finishes, we will be texted:<br />
All Live Nudibranches: Done<br />
<br />
=== Displaying active torrents ===<br />
The rtorrent doesn't list the active tab properly by default, add this line to your {{ic|.rtorrent.rc}} to show only active torrents<br />
schedule = filter_active,30,30,"view_filter = active,\"or={d.get_up_rate=,d.get_down_rate=}\""<br />
<br />
Then press {{keypress|9}} in your rTorrent client to see the changes in action.<br />
<br />
== Troubleshooting ==<br />
<br />
=== CA certificates ===<br />
To use rTorrent with a tracker that uses HTTPS, do the following as root:<br />
<br />
{{bc|cd /etc/ssl/certs<br />
wget --no-check-certificate https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Global_eBusiness_CA-1.cer<br />
mv Equifax_Secure_Global_eBusiness_CA-1.cer Equifax_Secure_Global_eBusiness_CA-1.pem<br />
c_rehash<br />
}}<br />
<br />
And from now on run rTorrent with:<br />
rtorrent -o http_capath=/etc/ssl/certs<br />
<br />
If you use GNU Screen, update the {{ic|.screenrc}} configuration file to reflect this change:<br />
screen -t rtorrent rtorrent -o http_capath=/etc/ssl/certs<br />
<br />
In rTorrent 0.8.9, set {{ic|<nowiki>network.http.ssl_verify_peer.set=0</nowiki>}} to fix the problem.<sup>[https://bbs.archlinux.org/viewtopic.php?pid=981832#p981832]</sup><br />
<br />
For more information see: [https://bbs.archlinux.org/viewtopic.php?pid=331850 rTorrent Error & CA Certificate] and [https://bbs.archlinux.org/viewtopic.php?id=45800 rTorrent Certificates Problem]<br />
<br />
== Web interface ==<br />
There are numerous web interfaces and front ends for rTorrent including:<br />
* [[WTorrent]] is a web interface to rtorrent programmed in php using Smarty templates and XMLRPC for PHP library.<br />
* [http://code.google.com/p/ntorrent/ nTorrent] is a graphical user interface client to rtorrent (a cli torrent client) written in Java.<br />
* [http://projects.cyla.homeip.net/rtwi/ rTWi] is a simple rTorrent web interface written in PHP.<br />
* [[Rtgui]] is a web based front end for rTorrent written in PHP and uses XML-RPC to communicate with the rTorrent client.<br />
* [http://code.google.com/p/rutorrent/ rutorrent] and [http://forums.rutorrent.org/ Forum] - A web-based front-end with an interface very similar to uTorrent which supports many plugins and advanced features (see also: [https://bbs.archlinux.org/viewtopic.php?pid=897577#p897577 Guide for rTorrent + ruTorrent Installation]).<br />
<br />
{{note|rTorrent is currently built using [http://xmlrpc-c.sourceforge.net/ XML-RPC for C/C++], which is required for some web interfaces (e.g. ruTorrent).}}<br />
<br />
=== XMLRPC interface ===<br />
If you want to use rtorrent with some web interfaces (e.g. rutorrent) you need to add the following line to the configuration file:<br />
scgi_port = localhost:5000<br />
<br />
For more information see: [http://libtorrent.rakshasa.no/wiki/RTorrentXMLRPCGuide Using XMLRPC with rtorrent]<br />
<br />
== See also ==<br />
* [[Screen Tips]]<br />
* [[Wikipedia:Comparison of BitTorrent clients|Comparison of BitTorrent clients]] on Wikipedia<br />
* [http://community.rutorrent.org/ rTorrent Community Wiki] - A public place for information on rTorrent and any project related to rTorrent, regarding setup, configuration, operations, and development.<br />
* [http://code.google.com/p/pyroscope/ PyroScope] - A collection of command line tools for rTorrent. It provides commands for creating and modifying torrent files, moving data on completion without having multiple watch folders, and mass-controlling download items via rTorrent's XML-RPC interface: searching, start/stop, deleting items with or without their data, etc. It also offers a documented [[Python]] API.<br />
* [http://wiki.theaveragegeek.com/howto/installing_rtorrent_and_hellanzb_on_centos5_64-bit_vps How-to Install rTorrent and Hellanzb on CentOS 5 64-bit VPS]<br />
* [http://code.google.com/p/pyroscope/wiki/DebianInstallFromSource Installation Guide for rTorrent and Pryoscope on Debian] - A collection of tools for the BitTorrent protocol and especially the rTorrent client<br />
* [http://mktorrent.sourceforge.net/ mktorrent] - A command line application used to generate torrent files, which is available as {{Pkg|mktorrent}} in the [[Official Repositories|official repositories]].<br />
<br />
<br />
'''Forum threads'''<br />
* 2009-03-11 - Arch Linux - [https://bbs.archlinux.org/viewtopic.php?id=67304 HOWTO: rTorrent stats in Conky]<br />
<br />
== References ==<br />
* [http://jasonwryan.com/post/13494126076/rtorrent Building rtorrent on Debian Squeeze] by Jason Wryan</div>Kenshishttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=124622Open Sound System2010-12-09T20:04:12Z<p>Kenshis: /* Tips and tricks */</p>
<hr />
<div>[[Category:Sound (English)]]<br />
[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|OSS}}<br />
<br />
This article will show you how to install and configure the '''O'''pen '''S'''ound '''S'''ystem (OSS) on you computer.<br />
<br />
The [http://en.wikipedia.org/wiki/Open_Sound_System Open Sound System] is an alternative sound architecture for Unix-like and POSIX-compatible systems. OSS version 3 was the original sound system for Linux and is in the kernel but was superceded by ALSA in 2002 when OSS version 4 became proprietary software. OSSv4 became free software again in 2007 when [http://www.opensound.com/ 4Front Technologies] released its source code and provided it under the GPL license.<br />
<br />
== Comparisons with ALSA ==<br />
<br />
Some advantages and disadvantages compared to using the Advanced Linux Sound Architecture.<br />
<br />
=== OSS Advantages (users) ===<br />
<br />
* Includes a transparent software mixer (vmix in kernel space). Having a transparent software mixer means that multiple applications can access the sound device at the same time.<br />
* Control for each application sound volume.<br />
* Some legacy cards are supported better (e.g. Creative X-Fi).<br />
* Initial response time in sound applications is usually better.<br />
* Better support for applications that use the OSS API. Many applications still use this API, and do not require an emulation layer like ALSA uses.<br />
<br />
=== OSS Advantages (developers) ===<br />
<br />
* Cleaner and easier to use API, and better API [http://manuals.opensound.com/developer documentation].<br />
* Support for drivers in userspace.<br />
* Accesibility. OSS runs on BSDs and Solaris.<br />
* Portability. OSS is [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port to other operating systems.<br />
<br />
=== ALSA Advantages ===<br />
<br />
* Better support for USB audio devices. With OSS output is experimental, input is not implemented.<br />
* Support for Bluetooth audio devices.<br />
* Support for AC'97 and HDAudio dial-up soft-modems such as Si3055.<br />
* Better support for MIDI devices. With OSS you'll have to use a software synthesizer such as Timidity or Fluidsynth.<br />
* Support for suspend. OSS and associated programs will need to be closed first.<br />
* Better support for jack detection. On some HD motherboards users will need to turn down the speaker volume when plugging in their earphones.<br />
<br />
== Install ==<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
This will install the OSS files and run the OSS install script that will temporarily disable the ALSA modules, and install the OSS kernel modules. Since ALSA is enabled by default in the boot scripts, you need to disable it for it not to conflict with OSS when booting. You can do this by editing {{Filename|rc.conf}} and adding:<br />
<br />
MODULES=(!soundcore ...<br />
<br />
Then add OSS to the daemon array:<br />
<br />
DAEMONS=(crond hal @oss...<br />
<br />
If your user is not part of the audio group, add your user by:<br />
<br />
# gpasswd -a username audio<br />
<br />
Then start OSS by:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
In the case OSS is not able to detect your card when starting it, run:<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
== Testing ==<br />
<br />
Beware the default volume is very loud, avoid using earphones and physically lower the volume of your speakers (if possible) before running the test.<br />
<br />
'''Test OSS by running:'''<br />
<br />
$ osstest<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the volume or refer to the troubleshooting section.<br />
<br />
If you want to hear sounds from more than one application simultaneously, you need vmix, OSS's software mixer. <br />
<br />
'''Check that vmix is enabled by running:'''<br />
<br />
$ ossmix -a | grep -i vmix<br />
<br />
You should see a line like 'vmix0-enable ON|OFF (currently ON)'. If you don't see any lines beginning with 'vmix', it probably means that vmix hasn't been attached to your sound device. To attach vmix, issue the command<br />
<br />
$ vmixctl attach device<br />
<br />
where ''device'' is your sound device, eg., /dev/oss/oss_envy240/pcm0 .<br />
<br />
To avoid having to issue this command manually in the future, you can add it to /usr/lib/oss/soundon.user, as suggested at http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output .<br />
<br />
If you get "Device or resource busy" error, you need to add "vmix_no_autoattach=1" in /usr/lib/oss/conf/osscore.conf, and then reboot. <br />
<br />
'''See which devices are detected by running:'''<br />
<br />
$ ossinfo<br />
<br />
You should be able to see your devices listed under Device objects or Audio Devices. If the device that you want to use is not at the top on Audio devices or Device objects sections, /usr/lib/oss/etc/installed_drivers needs to be edited. The driver for the device that needs to be used should be at the very top. A soundoff, soundoff is probably required. If this does not work, comment all drivers listed that are not your preferred device.<br />
<br />
== Volume Control ==<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called {{Codeline|ossmix}}. It's very like the BSD audio mixer (mixerctl). The graphical mixer is called {{Codeline|ossxmix}} and will require {{Package Official|gtk2}} to be installed.<br />
<br />
The basic <tt>ossxmix</tt> controls:<br />
<br />
<pre><br />
/ High Definition Audio ALC262 \ --------------------------------> 1<br />
/________________________________\________________________________<br />
| \<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels |--> 2<br />
| [ Stereo [v] ] |<br />
| |<br />
| __codec1______________________________________________________ |<br />
| | _jack______________________________________________________ ||--> 3<br />
| | | _int-speaker_________________ _green_________________ |||<br />
| | | | | | | |||<br />
| | | | _mode_____ | | | | _mode_____ | | | |||<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] | |||<br />
| | | | | | | | | | | |||<br />
| | | |_____________________________| |_______________________| |||<br />
| | |___________________________________________________________|||<br />
| |______________________________________________________________||<br />
| ___vmix0______________________________________________________ |<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | |--> 4<br />
| | | | O O | | x x | | O O | |<br />
| | | | | | x O | | | | x x | | | | O O | |<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O | |<br />
| | | | | | x x | | | | x x | | | | O O | |<br />
| | |_________| x x |_________| x x |_________| O O | |<br />
| |_____________________________________________________________| |<br />
|_________________________________________________________________|<br />
</pre><br />
<br />
# One tab for each sound card<br />
# The vmix (virtual mixer) special configurations appear at the top. These include sampling rate and mixer priority.<br />
# These are your sound card jack configurations (input and output). Every mixer control that is shown here is provided by your sound card.<br />
# Application vmix mixer controls and sound meters. If the application isn't actively playing a sound it will be labeled pcm08, pcm09..., when the application is playing the application name will be shown.<br />
<br />
=== Color Definitions ===<br />
<br />
For high definition (HD) audio, {{Codeline|ossxmix}} will color jack configurations by their pre-defined jack colors:<br />
<br />
{| style="border: 1px solid #CCCCCC; background-color: #dddddf"<br />
! Color<br />
! Type<br />
! Connector<br />
|- style=color:black;background:lightgreen<br />
|green<br />
| front channels (stereo output)<br />
| 3.5mm TRS<br />
|- style=color:white;background:black <br />
|black<br />
| rear channels (stereo output)<br />
| 3.5mm TRS<br />
|- style=color:white;background:gray<br />
|grey<br />
| side channels (stereo output)<br />
|3.5mm TRS<br />
|- style=color:black;background:gold<br />
|gold<br />
| center and subwoofer (dual output)<br />
|3.5mm TRS<br />
|- style=color:black;background:lightblue<br />
|blue<br />
| line level (stereo input)<br />
|3.5mm TRS<br />
|- style=color:black;background:pink <br />
|pink<br />
| microphone (mono input)<br />
|3.5mm TS<br />
|}<br />
<br />
=== Saving Mixer Levels ===<br />
<br />
Mixer levels are saved when you shut off your computer. If you want to save the mixer level immediately, as root:<br />
<br />
# savemixer<br />
<br />
{{Codeline|savemixer}} can be used to write mixer levels to a file with the {{Codeline|-f}} switch and restore by the {{Codeline|-L}} switch.<br />
<br />
=== Other Mixers ===<br />
<br />
Other mixers that have support for OSS:<br />
<br />
* GNOME - Gnome volume control<br />
* KDE - Kmix - OSS support is being developed.<br />
<br />
==Configuring Applications for OSS==<br />
<br />
===Skype===<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
===Wine===<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
===Gajim===<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
===MOC===<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice==/dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel===to OSSMixerChannel===Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
===Applications that use Gstreamer===<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
{{Note|For some applications (e.g. Rhythmbox, Totem) the gstreamer-properties have no effect, as they rely on "musicaudiosink" instead of "audiosink" (which is modified by gstreamer-properties). Workaround: Set audiosink with gstreamer-properties and use gconf-editor to copy the value of "/system/gstreamer/0.10/default/audiosink" to "musicaudiosink" (at the same location) }}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
===Firefox >=3.5===<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
===Mplayer===<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
===Music Player Daemon===<br />
<br />
MPD is configured through /etc/mpd.conf or ~/.mpdconf. Check both of these files, looking for something that looks like:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "Some Device Name"<br />
}<br />
<br />
If you find an uncommented (the lines do not begin with #'s) ALSA configuration like the one above, comment all of it out, or delete it, and add the following:<br />
<br />
audio_output {<br />
type "oss"<br />
name "My OSS Device"<br />
}<br />
<br />
{{Note|I had to put this configuration in my ~/.mpdconf for it to work properly, but it ought to work in /etc/mpd.conf as well.}}<br />
Further configuration might not be necessary for all users. However, if you experience issues (in that MPD doesn't work properly after it's been restarted), or if you like having specific (i.e. more user-configured, less auto-configured) config files, the audio output for OSS can be more specifically configured as follows: First, run:<br />
<br />
ossinfo | grep /dev/dsp<br />
<br />
Look for the line that says something similar to {{Codeline|/dev/dsp -> /dev/oss/<SOME_CARD_IDENTIFIER>/pcm0}}. Take note of what your <SOME_CARD_IDENTIFIER> is, and add bolded lines to your OSS audio output in your mpd config file:<br />
<br />
audio_output {<br />
type "oss"<br />
name "My OSS Device"<br />
'''device "/dev/oss/<SOME_CARD_IDENTIFIER>/pcm0"'''<br />
'''mixer_device "/dev/oss/<SOME_CARD_IDENTIFIER>/mix0"'''<br />
}<br />
<br />
===Other applications===<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
==Troubleshooting==<br />
<br />
===Troubleshooting HDAudio devices===<br />
<br />
====Understanding why problems arise====<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
====How to solve====<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
===MMS sound cracking in totem===<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
===Microphone playing through output channels===<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
===Troubleshooting other issues===<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
==Tips and tricks==<br />
<br />
===Using multimedia keys with OSS===<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
===Changing the Sample Rate===<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
#''' Make changes permanent''' use the soundon.user file to set the rate for every soundon<br />
write <code>"vmixctl rate /dev/dsp 96000" in the file /usr/lib/oss/soundon.user</code> and make it executable.<br />
<br />
===Changing the Default Sound Output===<br />
<br />
When running osstest, the first test passes for the first channel, but not for the stereo or right channel, it sounds distorted/hisses. If this is what your sound is like, then it's set to the wrong output.<br />
<br />
*** Scanning sound adapter #-1 ***<br />
/dev/oss/oss_hdaudio0/pcm0 (audio engine 0): HD Audio play front<br />
- Performing audio playback test... <br />
<left> OK <right> OK <stereo> OK <measured srate 47991.00 Hz (-0.02%)> <br />
<br />
The left sounded good, the right and stereo were the distorted ones.<br />
<br />
Let the test continue until you get a working output:<br />
/dev/oss/oss_hdaudio0/spdout0 (audio engine 5): HD Audio play spdif-out <br />
- Performing audio playback test... <br />
<left> OK <right> OK <stereo> OK <measured srate 47991.00 Hz (-0.02%)> <br />
<br />
If this passed the test on all left, right and stereo, proceed to next step.<br />
<br />
So from here:<br />
[http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output Changing_the_default_sound_output]<br />
you get the command to change the default output; change according to what works for you<br />
sudo ln -sf /dev/oss/oss_hdaudio0/spdout0 /dev/dsp_multich<br />
With 5.1 surround, chose dsp_multichannel; with 2 channel, dsp should work.<br />
<br />
===Creative Sound Blaster X-Fi Surround 5.1 SB1090 USB===<br />
<br />
This information is completely from [http://www.4front-tech.com/forum/viewtopic.php?f=3&t=3423 4front-tech.com] ; courtesy of kristian and Maxa. Thanks!!<br />
<br />
It's surprising to learn that the external card does not work just because of a missing true return value in the function write_control_value(...) in ossusb_audio.c.<br />
<br />
To fix this, a recompile of oss is nessasary, for now.<br />
<br />
1. Grab the latest oss from the Arch Repo<br />
http://repos.archlinux.org/wsvn/community/oss/repos/community-x86_64/<br />
<br />
2. Extract it<br />
<br />
3. cd to the folder, I renamed the folder to oss<br />
<br />
4. run makepkg --nobuild<br />
<br />
5. cd to src/kernel/drv/oss_usb/ ; '''edit the ossusb_audio.c''' ; '''add a Return 1''' ; should look like so and '''SAVE'''<br />
static int<br />
write_control_value (ossusb_devc * devc, udi_endpoint_handle_t * endpoint,<br />
int ctl, int l, unsigned int v)<br />
{<br />
return 1;<br />
<br />
6. cd to src/kernel/setup and edit srcconf_linux.inc, search for -Werror and remove it, otherwise OSS will not compile.<br />
<br />
7. do a makepkg --noextract<br />
<br />
Now you must install the package with pacman -U ; remove oss first if already installed <nowiki>(pacman -Rd oss)</nowiki><br />
<br />
===A simple systray applet===<br />
Want a applet to control volume like in GNOME? From [http://bbs.archlinux.org/viewtopic.php?id=77440 here] I got a usable [http://pastebin.furver.se/0xflchkfz/ one]. <br />
<br />
Download [http://pastebin.furver.se/0xflchkfz/0xflchkfz.txt this] script and rename whatever you want, e.g.: ossvolctl. run the following command:<br />
$chmod +x ossvolctl<br />
#cp ossvolctl /usr/bin/ossvolctl<br />
or<br />
#install -Dm755 ossvolctl /usr/bin/ossvolctl<br />
<br />
===Start ossxmix docked to systray on startup===<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
===Record sound output from a program===<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
===Suspend and Hibernation===<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
OSS does not support suspending but we don't care or better [[Suspend_to_RAM|s2ram]] works fine without stopping OSS.<br />
Just create a nice suspend script to /sbin/suspend and make it executable.<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
if [ [ $EUID -ne 0 ] ]; then<br />
## Checking if you are a root or not<br />
echo "This script must be run as root" 1>&2<br />
exit 1<br />
fi<br />
<br />
s2ram -f<br />
<br />
sleep 2<br />
<br />
/etc/rc.d/oss restart 2>/tmp/oss.txt<br />
<br />
if [ $? -gt 0 ]; then<br />
echo "OSS restart failed check /tmp/oss.txt for advice"<br />
fi<br />
<br />
exit 0<br />
</pre><br />
<br />
That's all your apps are fine and suspend works. \o/<br />
<br />
{{Note | If you are using Opera you must kill operapluginwrapper before suspend. To do this add '''<nowiki>PID=`pidof operapluginwrapper`;kill -9 $PID</nowiki>''' before s2ram -f. }}<br />
<br />
===ALSA emulation===<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
====Instructions====<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
===Settings for specific driver===<br />
If something isn't working, there is a possibility, that there are specific settings for specific driver (this way I have enabled jack-sense on my laptop)<br />
<br />
* Find out which driver is used<br />
<br />
# lspci -vnn|grep -i -A 15 audio<br />
<pre>00:1e.2 Multimedia audio controller [0401]: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller [8086:266e] (rev 03)<br />
Subsystem: Hewlett-Packard Company NX6110/NC6120 [103c:099c]<br />
Flags: bus master, medium devsel, latency 0, IRQ 21<br />
I/O ports at 2100 [size=256]<br />
I/O ports at 2200 [size=64]<br />
Memory at d0581000 (32-bit, non-prefetchable) [size=512]<br />
Memory at d0582000 (32-bit, non-prefetchable) [size=256]<br />
Capabilities: <access denied><br />
Kernel driver in use: *oss_ich*<br />
Kernel modules: snd-intel8x0</pre><br />
<br />
* Locate configuration file for device in:<br />
<br />
# cd /usr/lib/oss/conf/<br />
<br />
* Try changing defaults. There are only few settings, and they are self explanatory <br />
<br />
Setting: <br />
ich_jacksense = 1 <br />
in oss_ich.conf turned on jack-sense on my laptop (now plugged headphones are recognized, and speaker muted).<br />
<br />
*Restart oss for changes take effects.<br />
<br />
# sudo /etc/rc.d/oss restart<br />
<br />
* oss_hdaudio.conf has hdaudio_jacksens too. Maybe it will work for you. Unfortunately not for everyone.<br />
<br />
==Experimental packages==<br />
<br />
===Mercurial repository version===<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound (as well as the sound in Adobe-Air applications) you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Kenshishttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=114313Open Sound System2010-08-17T10:42:45Z<p>Kenshis: /* Testing */</p>
<hr />
<div>[[Category:Sound (English)]]<br />
[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|OSS}}<br />
<br />
This article will show you how to install and configure the '''O'''pen '''S'''ound '''S'''ystem (OSS) on you computer.<br />
<br />
The [http://en.wikipedia.org/wiki/Open_Sound_System Open Sound System] is an alternative sound architecture for Unix-like and POSIX-compatible systems. OSS version 3 was the original sound system for Linux and is in the kernel but was superceded by ALSA in 2002 when OSS version 4 became proprietary software. OSSv4 became free software again in 2007 when [http://www.opensound.com/ 4Front Technologies] released it's source code and provided it under the GPL license.<br />
<br />
== Comparisons with ALSA ==<br />
<br />
Some advantages and disadvantages compared to using the Advanced Linux Sound Architecture.<br />
<br />
=== OSS Advantages (users) ===<br />
<br />
* Includes a transparent software mixer (vmix in kernel space). Having a transparent software mixer means that multiple applications can access the sound device at the same time.<br />
* Control for each application sound volume.<br />
* Some legacy cards are supported better (e.g. Creative X-Fi).<br />
* Initial response time in sound applications is usually better.<br />
* Better support for applications that use the OSS API. Many applications still use this API, and do not require an emulation layer like ALSA uses.<br />
<br />
=== OSS Advantages (developers) ===<br />
<br />
* Cleaner and easier to use API, and better API [http://manuals.opensound.com/developer documentation].<br />
* Support for drivers in userspace.<br />
* Accesibility. OSS runs on BSDs and Solaris.<br />
* Portability. OSS is [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port to other operating systems.<br />
<br />
=== ALSA Advantages ===<br />
<br />
* Better support for USB audio devices. With OSS output is experimental, input is not implemented.<br />
* Support for Bluetooth audio devices.<br />
* Support for AC'97 and HDAudio dial-up soft-modems such as Si3055.<br />
* Better support for MIDI devices. With OSS you'll have to use a software synthesizer such as Timidity or Fluidsynth.<br />
* Support for suspend. OSS and associated programs will need to be closed first.<br />
* Better support for jack detection. On some HD motherboards users will need to turn down the speaker volume when plugging in their earphones.<br />
<br />
== Install ==<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
This will install the OSS files and run the OSS install script that will temporarily disable the ALSA modules, and install the OSS kernel modules. Since ALSA is enabled by default in the boot scripts, you need to disable it for it not to conflict with OSS when booting. You can do this by editing {{Filename|rc.conf}} and adding:<br />
<br />
MODULES=(!soundcore ...<br />
<br />
Then add OSS to the daemon array:<br />
<br />
DAEMONS=(crond hal @oss...<br />
<br />
If your user is not part of the audio group, add your user by:<br />
<br />
# gpasswd -a username audio<br />
<br />
Then start OSS by:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
In the case OSS is not able to detect your card when starting it, run:<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
== Testing ==<br />
<br />
Beware the default volume is very loud, avoid using earphones and physically lower the volume of your speakers (if possible) before running the test.<br />
<br />
'''Test OSS by running:'''<br />
<br />
$ osstest<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the volume or refer to the troubleshooting section.<br />
<br />
If you want to hear sounds from more than one application simultaneously, you need vmix, OSS's software mixer. <br />
<br />
'''Check that vmix is enabled by running:'''<br />
<br />
$ ossmix -a | grep -i vmix<br />
<br />
You should see a line like 'vmix0-enable ON|OFF (currently ON)'. If you don't see any lines beginning with 'vmix', it probably means that vmix hasn't been attached to your sound device. To attach vmix, issue the command<br />
<br />
$ vmixctl attach device<br />
<br />
where ''device'' is your sound device, eg., /dev/oss/oss_envy240/pcm0 .<br />
<br />
To avoid having to issue this command manually in the future, you can add it to /usr/lib/oss/soundon.user, as suggested at http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output .<br />
<br />
If you get "Device or resource busy" error, you need to add "vmix_no_autoattach=1" in /usr/lib/oss/conf/osscore.conf, and then reboot. <br />
<br />
'''See which devices are detected by running:'''<br />
<br />
$ ossinfo<br />
<br />
You should be able to see your devices listed under Device objects or Audio Devices. If the device that you want to use is not at the top on Audio devices or Device objects sections, /usr/lib/oss/etc/installed_drivers needs to be edited. The driver for the device that needs to be used should be at the very top. A soundoff, soundoff is probably required. If this does not work, comment all drivers listed that are not your preferred device.<br />
<br />
== Volume Control ==<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called {{Codeline|ossmix}}. It's very like the BSD audio mixer (mixerctl). The graphical mixer is called {{Codeline|ossxmix}} and will require {{Package Official|gtk2}} to be installed.<br />
<br />
The basic <tt>ossxmix</tt> controls:<br />
<br />
<pre><br />
/ High Definition Audio ALC262 \ --------------------------------> 1<br />
/________________________________\________________________________<br />
| \<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels |--> 2<br />
| [ Stereo [v] ] |<br />
| |<br />
| __codec1______________________________________________________ |<br />
| | _jack______________________________________________________ ||--> 3<br />
| | | _int-speaker_________________ _green_________________ |||<br />
| | | | | | | |||<br />
| | | | _mode_____ | | | | _mode_____ | | | |||<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] | |||<br />
| | | | | | | | | | | |||<br />
| | | |_____________________________| |_______________________| |||<br />
| | |___________________________________________________________|||<br />
| |______________________________________________________________||<br />
| ___vmix0______________________________________________________ |<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | |--> 4<br />
| | | | O O | | x x | | O O | |<br />
| | | | | | x O | | | | x x | | | | O O | |<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O | |<br />
| | | | | | x x | | | | x x | | | | O O | |<br />
| | |_________| x x |_________| x x |_________| O O | |<br />
| |_____________________________________________________________| |<br />
|_________________________________________________________________|<br />
</pre><br />
<br />
# One tab for each sound card<br />
# The vmix (virtual mixer) special configurations appear at the top. These include sampling rate and mixer priority.<br />
# These are your sound card jack configurations (input and output). Every mixer control that is shown here is provided by your sound card.<br />
# Application vmix mixer controls and sound meters. If the application isn't actively playing a sound it will be labeled pcm08, pcm09..., when the application is playing the application name will be shown.<br />
<br />
=== Color Definitions ===<br />
<br />
For high definition (HD) audio, {{Codeline|ossxmix}} will color jack configurations by their pre-defined jack colors:<br />
<br />
{| style="border: 1px solid #CCCCCC; background-color: #dddddf"<br />
! Color<br />
! Type<br />
! Connector<br />
|- style=color:black;background:lightgreen<br />
|green<br />
| front channels (stereo output)<br />
| 3.5mm TRS<br />
|- style=color:white;background:black <br />
|black<br />
| rear channels (stereo output)<br />
| 3.5mm TRS<br />
|- style=color:white;background:gray<br />
|grey<br />
| side channels (stereo output)<br />
|3.5mm TRS<br />
|- style=color:black;background:gold<br />
|gold<br />
| center and subwoofer (dual output)<br />
|3.5mm TRS<br />
|- style=color:black;background:lightblue<br />
|blue<br />
| line level (stereo input)<br />
|3.5mm TRS<br />
|- style=color:black;background:pink <br />
|pink<br />
| microphone (mono input)<br />
|3.5mm TS<br />
|}<br />
<br />
=== Saving Mixer Levels ===<br />
<br />
Mixer levels are saved when you shut off your computer. If you want to save the mixer level immediately, as root:<br />
<br />
# savemixer<br />
<br />
{{Codeline|savemixer}} can be used to write mixer levels to a file with the {{Codeline|-f}} switch and restore by the {{Codeline|-L}} switch.<br />
<br />
=== Other Mixers ===<br />
<br />
Other mixers that have support for OSS:<br />
<br />
* GNOME - Gnome volume control<br />
* KDE - Kmix - OSS support is being developed.<br />
<br />
==Configuring Applications for OSS==<br />
<br />
===Skype===<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
===Wine===<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
===Gajim===<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
===MOC===<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice==/dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel===to OSSMixerChannel===Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
===Applications that use Gstreamer===<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
===Firefox >=3.5===<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
===Mplayer===<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
===Music Player Daemon===<br />
<br />
MPD is configured through /etc/mpd.conf or ~/.mpdconf. Check both of these files, looking for something that looks like:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "Some Device Name"<br />
}<br />
<br />
If you find an uncommented (the lines do not begin with #'s) ALSA configuration like the one above, comment all of it out, or delete it, and add the following:<br />
<br />
audio_output {<br />
type "oss"<br />
name "My OSS Device"<br />
}<br />
<br />
{{Note|I had to put this configuration in my ~/.mpdconf for it to work properly, but it ought to work in /etc/mpd.conf as well.}}<br />
Further configuration might not be necessary for all users. However, if you experience issues (in that MPD doesn't work properly after it's been restarted), or if you like having specific (i.e. more user-configured, less auto-configured) config files, the audio output for OSS can be more specifically configured as follows: First, run:<br />
<br />
ossinfo | grep /dev/dsp<br />
<br />
Look for the line that says something similar to {{Codeline|/dev/dsp -> /dev/oss/<SOME_CARD_IDENTIFIER>/pcm0}}. Take note of what your <SOME_CARD_IDENTIFIER> is, and add bolded lines to your OSS audio output in your mpd config file:<br />
<br />
audio_output {<br />
type "oss"<br />
name "My OSS Device"<br />
'''device "/dev/oss/<SOME_CARD_IDENTIFIER>/pcm0"'''<br />
'''mixer_device "/dev/oss/<SOME_CARD_IDENTIFIER>/mix0"'''<br />
}<br />
<br />
===Other applications===<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
==Troubleshooting==<br />
<br />
===Troubleshooting HDAudio devices===<br />
<br />
====Understanding why problems arise====<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
====How to solve====<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
===MMS sound cracking in totem===<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
===Microphone playing through output channels===<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
===Troubleshooting other issues===<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
==Tips and tricks==<br />
<br />
===Using multimedia keys with OSS===<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
===Changing the Sample Rate===<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
#''' Make changes permanent''' use the soundon.user file to set the rate for every soundon<br />
write <code>"vmixctl rate /dev/dsp 96000" in the file /usr/lib/oss/soundon.user</code> and make it executable.<br />
<br />
===Changing the Default Sound Output===<br />
<br />
When running osstest, the first test passes for the first channel, but not for the stereo or right channel, it sounds distorted/hisses. If this is what your sound is like, then it's set to the wrong output.<br />
<br />
*** Scanning sound adapter #-1 ***<br />
/dev/oss/oss_hdaudio0/pcm0 (audio engine 0): HD Audio play front<br />
- Performing audio playback test... <br />
<left> OK <right> OK <stereo> OK <measured srate 47991.00 Hz (-0.02%)> <br />
<br />
The left sounded good, the right and stereo were the distorted ones.<br />
<br />
Let the test continue until you get a working output:<br />
/dev/oss/oss_hdaudio0/spdout0 (audio engine 5): HD Audio play spdif-out <br />
- Performing audio playback test... <br />
<left> OK <right> OK <stereo> OK <measured srate 47991.00 Hz (-0.02%)> <br />
<br />
If this passed the test on all left, right and stereo, proceed to next step.<br />
<br />
So from here:<br />
[http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output Changing_the_default_sound_output]<br />
you get the command to change the default output; change according to what works for you<br />
sudo ln -sf /dev/oss/oss_hdaudio0/spdout0 /dev/dsp_multich<br />
With 5.1 surround, chose dsp_multichannel; with 2 channel, dsp should work.<br />
<br />
===Creative Sound Blaster X-Fi Surround 5.1 SB1090 USB===<br />
<br />
This information is completely from [http://www.4front-tech.com/forum/viewtopic.php?f=3&t=3423 4front-tech.com] ; courtesy of kristian and Maxa. Thanks!!<br />
<br />
It's surprising to learn that the external card does not work just because of a missing true return value in the function write_control_value(...) in ossusb_audio.c.<br />
<br />
To fix this, a recompile of oss is nessasary, for now.<br />
<br />
1. Grab the latest oss from the Arch Repo<br />
http://repos.archlinux.org/wsvn/community/oss/repos/community-x86_64/<br />
<br />
2. Extract it<br />
<br />
3. cd to the folder, I renamed the folder to oss<br />
<br />
4. run makepkg --nobuild<br />
<br />
5. cd to src/kernel/drv/oss_usb/ ; '''edit the ossusb_audio.c''' ; '''add a Return 1''' ; should look like so and '''SAVE'''<br />
static int<br />
write_control_value (ossusb_devc * devc, udi_endpoint_handle_t * endpoint,<br />
int ctl, int l, unsigned int v)<br />
{<br />
return 1;<br />
<br />
6. cd to src/kernel/setup and edit srcconf_linux.inc, search for -Werror and remove it, otherwise OSS will not compile.<br />
<br />
7. do a makepkg --noextract<br />
<br />
Now you must install the package with pacman -U ; remove oss first if already installed <nowiki>(pacman -Rd oss)</nowiki><br />
<br />
===A simple systray applet===<br />
Want a applet to control volume like in GNOME? From [http://bbs.archlinux.org/viewtopic.php?id=77440 here] I got a usable [http://pastebin.furver.se/0xflchkfz/ one]. <br />
<br />
Download [http://pastebin.furver.se/0xflchkfz/0xflchkfz.txt this] script and rename whatever you want, e.g.: ossvolctl. run the following command:<br />
$chmod +x ossvolctl<br />
#cp ossvolctl /usr/bin/ossvolctl<br />
or<br />
#install -Dm755 ossvolctl /usr/bin/ossvolctl<br />
<br />
===Start ossxmix docked to systray on startup===<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
===Record sound output from a program===<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
===Suspend and Hibernation===<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
OSS does not support suspending but we don't care or better [[Suspend_to_RAM|s2ram]] works fine without stopping OSS.<br />
Just create a nice suspend script to /sbin/suspend and make it executable.<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
if [ [ $EUID -ne 0 ] ]; then<br />
## Checking if you are a root or not<br />
echo "This script must be run as root" 1>&2<br />
exit 1<br />
fi<br />
<br />
s2ram -f<br />
<br />
sleep 2<br />
<br />
/etc/rc.d/oss restart 2>/tmp/oss.txt<br />
<br />
if [ $? -gt 0 ]; then<br />
echo "OSS restart failed check /tmp/oss.txt for advice"<br />
fi<br />
<br />
exit 0<br />
</pre><br />
<br />
That's all your apps are fine and suspend works. \o/<br />
<br />
{{Note | If you are using Opera you must kill operapluginwrapper before suspend. To do this add '''<nowiki>PID=`pidof operapluginwrapper`;kill -9 $PID</nowiki>''' before s2ram -f. }}<br />
<br />
===ALSA emulation===<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
====Instructions====<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
==Experimental packages==<br />
<br />
===Mercurial repository version===<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Kenshis