Tuesday, February 17, 2015

Hardware Icecast source - Gigcaster


I've been working on a portable audio device used by radio stations to do remote broadcasts instead of using a laptop. I call it a Gigcaster. It can also be paired with a custom phone app for bands to broadcast directly to their listeners or they can embed an audio player on their own website.

I'm going to show you how to use a USB microphone or audio interface with a Raspberry Pi to broadcast to an Icecast server by simply turning on the device. The only configuration is for your Icecast server  (host/password etc.).

In future articles, I'll show you how to turn your Raspberry Pi into a voice controlled audio recorder, how to set the WiFi by turning it into a hotspot and using your cell phone and web interface on the device to set the password.

To provision the Raspberry Pi, we'll use resin.io, an Internet of Things company. Resin.io makes it easy to build, deploy and monitor devices such as the Raspberry Pi and Beagle Bone. You use git to push code to your device using Docker containers.

First, sign up for a free account on resin.io, create an app and download the zip file. Unzip the file onto a fat32 formatted SD card. Plug the card into your Raspberry Pi connected to the internet and it will install the base OS with Docker.

While it's doing that, create a directory with a file called Dockerfile with these contents:

FROM resin/rpi-raspbian

MAINTAINER Rob Cakebread "cakebread@gmail.com"

RUN HOST=icecast.com && \
        PORT=8000 && \
        PASSWD=abc && \
        MOUNT=stream && \
                  apt-get update && \
        apt-get -y install vorbis-tools sox alsa-tools alsa-utils oggfwd && \
        echo "sox -t alsa hw:CARD=1,0 -t aif - | oggenc -o - --bitrate 128 - | oggfwd ${HOST} ${PORT} ${PASSWD} ${MOUNT}" > /usr/local/bin/stream.sh && \
        chmod +x /usr/local/bin/stream.sh && \
        cat /usr/local/bin/stream.sh

CMD ["stream.sh"]
Edit the variables for HOST, PORT, PASSWD and MOUNT for your Icecast server.

Now add your Dockerfile:
git init .
         git remote add  git@git.resin.io:USER/APPNAME.git
git add Dockerfile
git commit -m "Initial commit."
git push resin master

In your resin.io dashboard, you'll see the actual git URL you'll use for the 'git remote add' part.

This is going to push your code to resin.io, where it will cross-compile our code, install the application on your Raspberry Pi and run it. It will take about 10 minutes or so. You can watch the progress on the resin.io dashboard.

When it's done, simply plug a mic or audio interface to your Raspberry Pi, turn it on and it will start streaming audio automatically.

My new company, Gigcaster, sells Gigcaster devices using aircraft aluminum cases with several additional features including a phone number for each device so it can be controlled via text message, recording and uploading audio to Dropbox, sending notifications to Android phones just before going live with a link to the Icecast URL etc.

We also sell inexpensive Icecast server subscriptions used with liquidsoap servers to mix and fade in and out audio when connecting to a live stream.




2 comments:

  1. hello, the git instruction are make on docker container?
    git add docerfile no oper in my docker

    ReplyDelete
  2. There are also a large number of window and shutter fittings from Croft architectural hardware which includes casement and sash window fittings. ;this site

    ReplyDelete