= Overview = This WikiPage will describe the process to take in order to stream mp3 audio to a [[http://www.shoutcast.com/|Shoutcast]] server, using [[http://djplay.sourceforge.net|DJPlay]]. It's worth noting at this point, that DJPlay will '''not''' (at this time) compile on amd64 architecture. I've raised this issue with the developer. = Getting DJPlay Working = == Satisfying Dependencies == Having enabled ''universe'' and (possibly) ''multiverse'', you should be able to satisfy all the DJPlay dependencies with: {{{ myshell:~ $ sudo apt-get install jackd qjackctl libqt3-headers libqt3-mt-dev libsamplerate0-dev libmad0-dev libaudiofile-dev libmpeg3-dev libid3-3.8.3-dev ladspa-sdk swh-plugins tap-plugins libxml2-dev lame libjack-dev libogg-dev libvorbis-dev }}} == Building DJPlay from CVS == === Satisfying Build Dependencies === To satisfy the dependencies to build from DJPlay CVS tree, you will require the following packages: {{{ myshell:~ $ sudo apt-get install build-essential cvs libtool automake1.9 }}} === Downloading from CVS === DJPlay is the type of project that rarely creates package bundles. It's best to get the current source from CVS: {{{ myshell:~ $ cvs -d:pserver:anonymous@djplay.cvs.sourceforge.net:/cvsroot/djplay login }}} Then hit ''enter'' when prompted for a password. {{{ myshell:~ $ cvs -z3 -d:pserver:anonymous@djplay.cvs.sourceforge.net:/cvsroot/djplay co -P djplay }}} You should now receive output, showing the files being checked to your a directory called ''djplay'' within your current directory. {{{ myshell:~ $ cd djplay myshell:~ $ ./autogen.sh myshell:~ $ export QTDIR=/usr/share/qt3/ myshell:~ $ ./configure }}} Now for the odd bits, DJPlay requires some minor code hacking to get running. Open up djplay.cpp in your favourite editor, and comment out lines {{{113}}} and {{{114}}} so that they should look like: {{{ //QWindowsStyle *style=new QWindowsStyle; //a.setStyle(style); }}} Then save the file. Next, due to the way DJPlay compiling is scripted, we'll need to copy a couple of the header files in with out QT Lib header files. Execute the following commands: {{{ myshell:~ $ sudo cp plugins/bitmapbutton/bitmapbutton.h $QTDIR/include/ myshell:~ $ sudo cp plugins/bitmapslider/bitmapslider.h $QTDIR/include/ }}} And now, with the actuall compilation and installation: {{{ myshell:~ $ make myshell:~ $ sudo make install }}} = Ices0 = Ices0 is the client that we'll use to stream our audio to the Shoutcast server. Ices2 will not function, as it only streams ogg/vorbis, and Ices0 only streams mp3. Change to the parent directory where you downloading DJPlay, and download Ices0 from http://icecast.org/ices.php. == Satisfying Ices0 Dependencies == To satisfy the dependencies to build Ices0, you will require the following packages: {{{ myshell:~ $ sudo apt-get install libshout3 libshout3-dev liblame0 liblame-dev }}} == Building Ices0 == Extract the files, compile and install with: {{{ myshell:~ $ tar zxvf ices-0.4.tar.gz myshell:~ $ cd ices-0.4 myshell:~ $ ./configure myshell:~ $ make myshell:~ $ sudo cp src/ices /usr/local/bin/ices-mp3 }}} = Configuring Jack = Jack connections require quite some cross wiring to get DJPlay operating correctly. I've saved you some time, by attaching an .xml files which can be used in Jack's Patchbay to automatically configure the port connections. [[attachment:jack_patchbay.xml]] You should use the GUI (qjackctl) to access and configure jack. This is accessible from ''Applications > Sound & Video > QJackCtl'' = Configuring Ices0 = First, Ices0 needs to know we're using it as a pipeline: {{{ myshell:~ $ sudo echo - >/etc/ices-mp3.txt }}} Ice0 will also need aquire its configuration from an .xml file. Again, for ease, I've attached a template. Save and edit in a recognisable place, as we'll be referring to this file in DJPlay. [[attachment:ices0_configuration.xml]] = Song Titles = To push song titles to the stream, we require a custom script. This is just something I put together from various sources, it could do with improving. Open you favourite editor, and create {{{/usr/local/bin/pushmetadata-djplay}}}, copy and paste the code below: {{{ #!/bin/sh sed -e 's/ARTIST=/ARTIST=\"/g' -e 's/TITLE=/TITLE=\"/g' -e 's/$'"/\"/"< /tmp/ices-metadata.txt > /tmp/ices-new.txt . /tmp/ices-new.txt # URL-encode any non-alphanumeric characters for http transmission song_title=$(echo $TITLE |sed \ -e "s/%/\%25/g" \ -e "s/;/\%3B/g" \ -e "s/\//\%2F/g" \ -e "s/?/\%3F/g" \ -e "s/:/\%3A/g" \ -e "s/@/\%40/g" \ -e "s/&/\%26/g" \ -e "s/=/\%3D/g" \ -e "s/+/\%2B/g" \ -e "s/ /\%20/g" \ -e "s/\"/\%22/g" \ -e "s/#/\%23/g" \ -e "s//\%3E/g" \ -e "s/!/\%21/g" \ -e "s/*/\%2A/g" \ -e "s/'/\%27/g" \ -e "s/,/\%2C/g" \ -e "s/)/\%29/g" \ -e "s/(/\%28/g") song_artist=$(echo $ARTIST |sed \ -e "s/%/\%25/g" \ -e "s/;/\%3B/g" \ -e "s/\//\%2F/g" \ -e "s/?/\%3F/g" \ -e "s/:/\%3A/g" \ -e "s/@/\%40/g" \ -e "s/&/\%26/g" \ -e "s/=/\%3D/g" \ -e "s/+/\%2B/g" \ -e "s/ /\%20/g" \ -e "s/\"/\%22/g" \ -e "s/#/\%23/g" \ -e "s//\%3E/g" \ -e "s/!/\%21/g" \ -e "s/*/\%2A/g" \ -e "s/'/\%27/g" \ -e "s/,/\%2C/g" \ -e "s/)/\%29/g" \ -e "s/(/\%28/g") if [ "" != "$song_title" ]; then song_string=$song_title if [ "" != "$song_artist" ]; then song_string=$song_artist"%20-%20"$song_title fi echo "Updated Metadata: "$song_string # Send title to SHOUTCAST server ($(nohup lynx -source \ http://admin:password@foo.bar.org:8000/admin.cgi\ ?mode=updinfo\&pass=password\&song=$song_string > /dev/null &))& fi }}} You'll need to edit the server details, and stream password. Save the file, and make it executable: {{{ myshell:~ $ sudo chmod ug+x /usr/local/bin/pushmetadata-djplay }}} The script also uses ''Lynx'' it could be adjusted for ''Curl'', but in the meantime, satisy the ''Lynx'' dependancy with: {{{ myshell:~ $ sudo apt-get install lynx }}} = Configuring DJPlay = Start up jack, using QjackCtl, and click 'Start'. Then execute {{{djplay}}} from the command line. /!\ '''DJPlay may segfault on it's first start, a second attempt normally works.''' /!\ == Streaming and Recording Configuration == Once DJPlay has started, click the ''Setup'' button. Go to the ''Streaming & Recording'' tab, and input the following data: === Broadcast Pipeline Command (tick Re-Launch if Aborted) === {{{ lame --resample 44100 -r -x -v -q 9 --cbr -b 128 -m s - - | ices-mp3 -R -c /home/jbloggs/ices0_configuration.xml }}} === Metadata File === {{{ /tmp/ices-metadata.txt }}} === Command to Activate Metadata === /!\ If you're practising, and not broadcasting, remove this command! Otherwise you will be publishing metadata to the configured Shoutcast server, even when you're not actually broadcasting the stream! /!\ {{{ /usr/local/bin/pushmetadata-djplay }}} === Record Destination (tick Destination is a Pipeline) === {{{ lame --resample 44100 -r -x -v -q 9 -b 128 -m s - /home/jbloggs/radio`date --iso=s`.mp3 }}} == Microphone Configuration == Click the ''Mic'' tab, and set the ''Mic'' Input to Line 1, and disable attenuation for Line 1. You may also wish to drop the ''Talkover Level'' down, as that when your microphone is on, we can hear you above the music, and your microphone is also exempt from attenuation. Click ''Ok'' to save these changes. If you've not recorded on your microphone before, you'll need to adjust your mixer settings. Up the ''Microphone'' level, tag the microphone speaker icon (to prevent any feedback), up the ''Capture'' level (add fi not present), and check that both microphone and speaker icons (below capture) are enabled. Close your audio settings... Hit the Big Red Button on DJPlay, and start streaming. = Additional = To improve performance and latency when using jackd, it's possible to configure and install the realtime-lsm kernel module, and then ''setup'' jackd to use the realtime functionality, see [[RealtimeLSMHowto]]. CategoryCleanup