Griffin radio SHARK + icecast2 on Debian GNU/Linux

Griffin radioSHARK I have been meaning to get a Griffin radioSHARK with the intention of getting it running on Linux. Since it has a nice discount over at amazon I ran out of excuses for not buying one, so I finally ordered it.
Once the sweet sweet parcel arrived the radio SHARK sat for a couple of weeks gathering dust while I got a moment to play with it. Trying to get it to run in Windows XP was totally fruitless. The only way I got it to spit any sound at all was while in audio “test” mode. Not really an option, but at least it meant that that the hardware was working fine.
So now it was time to move it over to Linux. The definitive guide for the radioSHARK under linux is at LinuxQuestions.org. They recommend ecasound to transcode the audio input to the sound card in a single computer, but I rather use icecast2 to stream the signal to different computers around the house — even to the office or while I’m on the road. I don’t care much for the time-shifting feature of the Windows/Mac client, and the record function can be replicated with VLC save to disk function or using command-line tools.
The program that controls the radioSHARK lights and change the current station is shark.c, but if you get it from LinuxQuestions.org you’ll have to copy+paste and clean it up a bit, so you might want to use this ready-to-go shark.c instead.
This is the list of packages for Debian GNU/Linux:

linux-image-2.6.15-1-k7 2.6.15-4
linux-source-2.6.15 2.6.15-4
libhid-dev 20060325-2
libhid0 20060325-2
icecast2 2.3.1-3
darkice 0.17-1

So how do you get a full-functioning, live-streaming, all-singing radioSHARK working under Debian?

  1. Plug the radioSHARK in the USB port you’ll get this in dmesg:
    usb 1-2: new full speed USB device using uhci_hcd and address 3
    usbcore: registered new driver hiddev
    input: Griffin Technology, Inc. RadioSHARK as /class/input/input2
    input: USB HID v1.00 Device [Griffin Technology, Inc. RadioSHARK] on usb-0000:00:10.0-2
    usbcore: registered new driver usbhid
    drivers/usb/input/hid-core.c: v2.6:USB HID core driver
  2. Compile shark.c using
    gcc -g -o shark -lhid shark.c

  3. Copy shark to /usr/local/bin
    # cp shark /usr/local/bin

  4. Check that your brand-new shark is working:
    # /usr/local/bin/shark -blue 60

  5. Edit /etc/icecast2/icecast.xml and fill out at least the authentication and hostname sections.
  6. Copy /usr/share/doc/darkice/examples/darkice.cfg to /etc/darkice.cfg and edit to taste. My own configuration goes something like this:
    [general]
    duration = 0
    bufferSecs = 5
    reconnect = yes

    [input]
    device = /dev/dsp
    sampleRate = 22050
    bitsPerSample = 16
    channel = 2

    [icecast2-0]
    bitrateMode = vbr
    format = vorbis
    bitrate = 32
    quality = 0.8
    server = localhost
    port = 8000
    password = icecastPassword
    mountPoint = radio.ogg
    name = Radio MexicoDF
    description = Radio from Mexico, D.F.
    url = http://your.url
    genre = misc
    public = yes

  7. Start up icecast2 running /etc/init.d/icecast2 start and check out that it’s running by opening http://localhost:8000/ . You should get a status screen without any streams.
  8. Start up darkice with /usr/bin/darkice -c /etc/darkice.cfg . When you reload http://localhost:8000/ in your web browser you should get a stream mount point with your newly defined stream. Tune in to the stream URL using XMMS, VLC, WinAmp or your favorite audio player, and you sould hear something, at least some white noise.
  9. To change stations use
    # /usr/local/bin/shark -fm 102.5
    After a few seconds -depending on your audio player buffer size- you should hear the new station.

My next weekend project will be to create a web front-end to shark — perhaps even implement a record-to-disk option.

10 thoughts on “Griffin radio SHARK + icecast2 on Debian GNU/Linux”

  1. Hi there!

    Did You already set up a web interface for the radio shark as Your “next weekend project”? I just start playing around with Linux and I want to get my radio shark singing to do some studies with it. If You have something, it would be great if You let meknow.

    Thanx a lot,
    Felix

  2. Has there been any update to this post? I’d love to get a web interface working. Actually, what I would really love is to have a command line tool like this for windows, however since my programming experience only really extends to PHP, that really isn’t something I know how to do. Is it possible to create a windows version of this?

    You guys rock,
    Drew

  3. Very cool. I got mine working. I even wrote a simple php interface to tune with. One question is there a way to find out what frequency its set to?

  4. Any change we get a look at the code for your web interface?

Comments are closed.