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.

Posted in General, Hack!
8 comments on “Griffin radio SHARK + icecast2 on Debian GNU/Linux
  1. Felix says:

    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. Drew says:

    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. Chad says:

    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. his says:

    I modified shark.c for Radio Shark2.

    I put shark2.c on http://hoop.euqset.org/archives/058605.html

    Have fun.

  5. arni says:

    good work man

  6. Apcptsxu says:

    great work dude thx

  7. Chad says:

    I setup a flash interface along with my php scripts. Check out http://www.radioyakima.com (My radio tuner site) THANKS!!

  8. Jason says:

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

2 Pings/Trackbacks for "Griffin radio SHARK + icecast2 on Debian GNU/Linux"
  1. [...] Griffin radio SHARK + icecast2 on Debian GNU/Linux » javier arturo rodríguez » Blog Archive 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 (tags: audio linux radio music) [...]

  2. [...] new device under Linux to change stations and change its lighting besides other neat tricks like live Internet streaming with icecast2 and darkice as I’ve written before. I haven’t been able to lay my hands on a radioSHARK 2 but I [...]

About me

I am a certified Software Architect, System Administrator, Entrepreneur and Open Data advocate, with 19 years experience building Internet-enabled software, from electronic banking to B2B marketplaces.
If you want to use the Internet as a competitive advantage, look at my resume for more information or hire me.

Twitter: codehead