= Streaming to Icecast with roard and RoarAudio PlayList Daemon (rpld) = This tutorial is to tell you how to setup roard and RoarAudio PlayList Daemon to stream to a Icecast server. This does not cover installint Icecast itself nor using a diffrent RoarAudio server than roard. == Introduction and Concept == As you may already have noticed the name of RoarAudio PlayList Daemon (later rpld) contains the word PlayList. This name is chosen for a simple reason: In fact rpld is not audio player or something like that. It's a playlist manager build on top of the RoarAudio sound system. It does: * Handle playlists * Push data from files or streams in playlist to the sound server * It controls playback by passing control information between clients and sound server It does not: * Play back anything itself * Decode or encode audio However because clients never be in contact with the sound server this may sometimes look a bit like rpld be a full audio player. As rpld does not handle audio itself setup for streaming is done on roard's end. It is configured to have a so called 'output' to icecast and encoding as Ogg Vorbis. == Installation == Before we can start you need to install the following software: * roard from RoarAudio Package * rpld * rpld-tools (if not in rpld package) * vclt-tools You should also consider to install a nice client for rpld with GUI or something. If your operating system ships them we suggest you to use those versions and not compile your own binary. === Installing on Debian === Just type as root: {{{ # apt-get install roaraudio roarplaylistd vclt-tools }}} === Installing from source === Note: This is a very brief description and may or may not be extended later. First go to http://roaraudio.keep-cool.org/downloads.html and download the packages listed above. Before you continue you should install the following stuff, too: * Essential packages for compiling (compiler, linker, make, system headers,...) * libvorbis * libshout * libuuid (from e2fsprogs) * vorbis-tools Don't forget to install the -dev or -devel packages. Some more libraries are listed in the READMEs for the packages. For all the packages the building is done like: {{{ $ tar -xvzf package.tar.gz $ cd package $ ./configure $ make # make install }}} == Setting up roard == After installing roard is basically already ready. All we need to tell it is to stream to to our Icecast server. To do this we need to set the output driver to ''shout'' and device name to URL of the server including mount point and login. Such a URL may look like this: {{{ http://source:hackme@streaming-server.example.org:8000/mountpoint.ogg }}} ''source is username (this is the default username, do not change if unsure) and ''hackme'' is the password. === on Debian === There is a configuration file at /etc/default/roaraudio you need to edit. scroll down to section `Audio and Devices`. Now set the following parameters: {{{ ROARD_DRIVER='shout' ROARD_DEVICE='http://source:hackme@streaming-server.example.org:8000/mountpoint.ogg' ROARD_DRIVER_OPTIONS='sync,codec=ogg_vorbis' }}} Note that you need to remove the leading `#`s. === Starting manually === If you start roard manually you must simply pass the parameters using `-o`, `-O` and `-oO`. Example: {{{ $ roard -o shout -O http://source:hackme@streaming-server.example.org:8000/mountpoint.ogg -oO sync,codec=ogg_vorbis }}} == Setting up rpld == After you installed rpld the following steps must be done: * Set up the ''store''. This is where rpld saves playlists and such. * Import some music. * Set default pointer * Hit play button. * Have fun. === Setting up store on Debian === You choose the right system. Store is already set up on Debian. === Setting up store manually and how to start rpld === To set up the store we need to create a directory accessible by the user running rpld. Normally this directory is `/var/lib/roarplaylistd/` but you can use a directory within your home directory as well. First create it. If using `/var/lib/roarplaylistd/` we may need to do this as root, if it's located under your home directory just create it with mkdir(1) or how you prefer to create your directorys. If needing to do under root we may also need to set owner back to the user running rpld like this: {{{ # mkdir /var/lib/roarplaylistd # chown YOUR_USER:YOUR_GROUP /var/lib/roarplaylistd }}} You can get the values for ''YOUR_USER'' and ''YOUR_GROUP'' using id: {{{ id }}} It will list the username under ''uid'' and the group name under ''gid''. Next you need to initialize it. Do this with the following command: {{{ $ rpld --no-listen --store-path /var/lib/roarplaylistd --no-restore --store }}} To start rpld run it like this: {{{ $ rpld --store-path /var/lib/roarplaylistd }}} You can add a `--play` to start it in playing state. === Importing some music === To import some music you need a playlist of those music. If you already have some playlist skip next section and continue with ''Importing a existing playlist''. ==== Generating a new playlist with dir2vclt ==== To generate a new playlist from a directory you can use the tool ''dir2vclt''. It will generate [[VCLT]] playlist from a directory or single file. Just run it like this: {{{ $ dir2vclt /some/data/path/with/music/ new-playlist.vclt }}} Note that dir2vclt currently requires absolute path name. ==== Importing a existing playlist ==== To import a existing or just generated playlist you can use the tools ''rpld-addplaylist'' and ''rpld-import'' or using a GUI you have installed. This document will tell you how to use the former tools. To create a new playlist use: {{{ $ rpld-addplaylist 'playlistname' }}} To import a existing playlist: {{{ $ rpld-import 'playlistname' 'playlisttype' 'playlistfile' }}} While `playlisttype` is the type of the playlist: VCLT:: The playlist format used by dir2vclt. (recommended) M3U:: A common playlist format. PLAIN:: Single filename per line format Others may also be supported. === Set default pointer === Before we can hit the play button we need to tell rpld what to play. In our case we most likely have only one Playlist (created and imported above) and want to stream exactly this playlist. If we hit end of playlist we want it to repeat. On a normal player you would just select the first entry in your list and press 'repeat' button. rpld does not have something like that but something better!: Pointers. The full discussion on pointers, what they are and how they work is out of scope for this document. So I will try to make it as simple as possible: rpld normally plays back it's so called ''Main Queue''. If the queue (which must be manually filled) runs out of songs it stops. To avoid this pointers got invented. Those pointers are rules how to fill the ''Main Queue'' automatically if it runs out of songs to play. Basically they point to playlist entries (songs). This is where they got there name from. There are two pointers of interest for us: the so called ''current'' and the so called ''default'' pointer. The first one points to a song in a playlist which is played when the ''Main Queue'' runs out of songs. The song is queued and the pointer is moved to the next song in list. This allows us to play a playlist from top to bottom. If it reaches the end of the list it is unset and playback stops. So, now we only need to find out how to repeat the list, right? To repeat the playlist the ''default pointer'' was invented. It's simply, as the name says, the default value for the ''current pointer''. So if the playback would normally stop the ''current pointer'' just gets set to where the ''default pointer'' points to and playback continues. So all we need to do to repeat a playlist is to set the ''default pointer'' to the first entry. If we press play the ''current pointer'' is set to the first song, the song is played back. If it reaches the end of the list it restarts as the ''current pointer'' is reset to the first song in list. Setting the pointer to the first song in list is very easy, just run: {{{ $ rpld-setpointer default num:0 'playlistname' }}} Here ''default'' is the name of the pointer and ''num:0'' means the first entry in the list. === Pressing play === To start playback just hit the playback button in the GUI or client you use or use the following command: {{{ $ rpld-play }}} === Have fun === Now listen to your music and have a lot fun.