**Updated March 23, 2009 for iPhone/iPod player info...see below
First, check out the previous 2 posts, here and here, to get the background needed to get RS functional in Ubuntu (at least enough to play). If you just want a quick tutorial on streaming via icecast and darkice in Ubuntu, you could use this as a quick guide, but there's a ton better on the web (i.e. search for "how to use icecast").
Step 1: Open Synaptic Manager in Ubuntu and do a search for "icecast"
Select icecast2, and darkice packages and accept all supporting files when Synaptic auto-adds the required files, and then install them.
Step 2: Setup icecast.xml (/etc/icecast.xml), by opening in your favorite editor. It's important to configure all the authentication sections, especially the default passwords that are all set to "hackme". You also need to set your actual <hostname> value to your computer name. See some examples below:
<authentication>
<!-- Sources log in with username 'source' -->
<source-password>SomePassword</source-password>
<!-- Relays log in username 'relay' -->
<relay-password>SomePassword</relay-password>
<!-- Admin logs in with the username given below -->
<admin-user>Barney</admin-user>
<admin-password>SomePassword</admin-password>
</authentication>
Step 3: Setup darkice. Touch a file into the /etc directory called darkice.cfg, and edit the values for your configuration. I provided an example of mine below:
[general]
duration = 0
bufferSecs = 5
reconnect = yes
[input]
device = /dev/dsp1
sampleRate = 22050
bitsPerSample = 16
channel = 2
[icecast2-0]
bitrateMode = vbr
format = vorbis
bitrate = 32
quality = 0.8
server = localhost
port = 8000
password = Somepassword
mountPoint = example-complex.ogg
name = The Eagle
description = Classic Rock
url = http://home-laptop
genre = misc
public = yes
Step 4: Tune the radio shark, start icecast2 and darkice. In the terminal console enter the following commands (or add a bash script that does this):
$ sudo shark -fm 106.9
$ sudo /etc/init.d/icecast2 start
$ sudo /usr/bin/darkice -c /etc/darkice.cfg
In my case, I tweaked the earlier posted FMstart script and launcher shortcut to include the streaming commands instead. You could also simply initialize the icecast service on startup, run your script, or use cron to execute your scripts at preset times to play, stream or record when you like.
Step 5: Check that icecast/darkice is presenting your stream by navigating to your server's address using Firefox: http://localhost:8000. You can also monitor your streams/listeners here...
Step 6: Allow Clients to access your streaming server
NOTE: In this example, I provide a simple way to stream music on your home network. It could work similarly on a front-facing internet server, but I do not include the specific steps to do this. Properly configuring firewalls in Linux is well beyond the scope of this writeup, especially to protect resources on the internet. If you run the built-in Ubuntu firewall (iptables), you can use "firestarter" GUI to tweak it to allow it to allow local traffic easily, otherwise your clients will likely not see the stream.
I simply set it to allow clients on my home network (192.168.1.0 private network address), but a more involved configuration is required if you use, for instance, NAT (network address translation) to protect your internal addresses and wish the streams to be allowed across the internet. You could allow incoming connections to port 8000, for example, but you should consult security documentation thoroughly to understand the risks of exposing any home computers to outside users in this manner.
Step 7: Play back your streams. In my case, I used the excellent, free TCPMP (The Core Pocket Media Player...Windows versions of this great A/V player are also available) running on my Windows Mobile device, as I find it plays almost any type of media. In this case, the stream is formatted as ogg-vorbis--and presented as a SHOUTcast stream--not every player can natively play this kind of stream. Tuning in should be as easy as connecting to your home network via Wifi and inputting the full URL into your player...i.e. http://yourserver:8000/example-complex.ogg
Supprted players include (from the icecast homepage) below. To learn more about icecast and darkice go here and here...
foobar2000 (mp3 + ogg vorbis) | Windows 98/NT/2000/XP | http://www.foobar2000.org |
winamp 2.x, 5.x (Not 3.x)(mp3 + ogg vorbis) | Windows 98/NT/2000/XP | http://www.winamp.com |
XMMS(mp3 + ogg vorbis) | Unix | http://www.xmms.org |
Zinf(mp3 + ogg vorbis) | Unix/Windows | http://zinf.sourceforge.net |
MPlayer | Windows 98/NT/2000/XP Unix Mac OSX | http://www.mplayerhq.hu |
Xine | Unix | http://www.xinehq.de |
VLC | Windows 98/NT/2000/XP Unix Mac OSX | http://www.videolan.org |
In an earlier post, I admitted that I didn't yet have an elegant method to time-shift the RS using Ubuntu, but using icecast/darkice to stream does allow you to control this in a similar fashion. In TCPMP, for example, you can pause the live stream for several minutes, like say during commercials, so that you lag the live radio trasmission. You could then fast forward through that section until you have again caught up to live input again. It's not as nifty as the Windows software capability that comes with the RS, but it serves. Well, that's pretty much it for Radio Shark and Ubuntu for now. Next time, I hope to have worked out an effective scripting method for doing real time-shifting, so be sure to check back again.
Actually I discovered a player for iPhone/iPod Touch that will play SHOUTcast streams, and works quite nicely with this setup called FStream. You can download and use it for free by searching for the name in iTunes or the device App store. Once installed, simply add your URL stream as a favorite, and select that stream in the main screen to play. You can tweak a setting that will allow you to time-shift when pausing just as with TCPMP mentioned above (look in the More menu). You can also record streams with this tool.
Credits:
Sources (Bibliography/credits):
How-to stream cast with RS by Javier Rodriguez: http://javier.rodriguez.org.mx/index.php/2006/06/10/griffin-radio-shark-icecast2-on-debian-gnulinux
How-to Play RS on Deb Linux by Javier Rodriguez: http://javier.rodriguez.org.mx/index.php/2007/05/20/use-the-radioshark-2-under-linux-shark2c
New RS 2 code by Hisaaki Shibata (on Javier’s site): http://javier.rodriguez.org.mx/code/shark2.c
Original RS Linux how-to and shark.c: http://wiki.linuxquestions.org/wiki/Audio …code by Michael Rolig
Good example of using Linux to record, play and time-shift using RS: http://whats.all.this.brouhaha.com/2006/01/18/radioshark-in-linux/
Web-site that allows you to control a real live RS tuner over the net: http://www.radioyakima.com/index.php
1 comment:
Hi,
I've a radioSHARK version 1 myself and I'm currently developing a Linux kernel driver for it, so that it will show up as a /dev/radio device talking the standardized v4l2 radio interface which should make most linux radio programs work with it.
The problem is that judging from the shark.c and shark2.c files I've found on the internet, these 2 devices although not compatible have the same USB id. So now I'm looking for someone with a shark2 to help me figure out a way to make my driver not bind to the shark2 (or, preferably make my driver work with the shark2).
If you're willing to help, can you for starters do:
lsusb -v > log
With the shark plugged in and mail me the generated log file? My email address is: hdegoede@redhat.com
Thanks & Regards,
Hans
Post a Comment