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.




Monday, January 26, 2015

Burger Radio Show

An excerpt of my new show on Burger Radio, Hope I Live Before I Get Old.

The first song (Backbiter w/ Curt Anderson) was recorded on a prototype Gigcaster a couple of years ago.


Thursday, December 11, 2014

Gigcaster hiring in L.A. - Python / SysAdmin / Music


A few months ago I created a start-up called Gigcaster. We produce a handheld device for broadcasting audio live on the internet. I've been testing and demonstrating the device around Los Angeles with bands, dj's, record labels, studios and radio stations. We're about to launch our site and do a private beta test soon.

I don't expect to hire until the first quarter of 2015, but I'm looking for local skilled Python coders and Linux systems administrators, particularly if you're interested in live music.

Our data center and office are located in downtown Los Angeles. Please send resumes or inquiries to my last name at gmail.com.




Monday, December 31, 2012

When Spammers Attack, Make Musubi

Musubi is a little tool I wrote to check your mail servers' reputation on DNSBLs. There are quite a few of these scripts out there, but this one does more than simply check a list of DNSBLs.


Unlike other scripts I found, when musubi finds an IP listed on a DNSBL, it also queries for a DNS TXT record to find the reason you were blacklisted.

Finding all your mail servers' IPs can be a little confusing. Musubi will take a domain name, find the MX records, give you all the IPS for the servers and make sure the reverse DNS (PTR) is correct. It also fetches SPF TXT records.

Normally, you'd use a tool like 'dig' to figure this all out. I wanted something the average person can use without needing to use multiple 'dig' commands.

If you work for an ISP or web hosting company, you can throw a whole range of IPs at Musubi for your shared hosting using CIDR notation.

Most ISPs and web hosting companies have their own internal tools for this, but you may want to take a look at Musubi if you used threads. Musubi uses gevent and is very fast (hundreds of DNSBL lookups in seconds) thanks to some borrowed code from Vince Carney's dnsbl.py.

Musubi uses cliff for the command-line framework and is easily extensible. Web front-end with scheduled checks, Twilio SMS notification etc. are coming next.

I wrote most of this while helping a friend in a panic fix his company's PTR records and add an SPF record for his mail servers that were getting blacklisted, so it's a bit messy and un-tested. 0.1 is available on Github and PyPi

    https://github.com/cakebread/musubi
    http://pypi.python.org/pypi/musubi

Wednesday, April 4, 2012

Twerp 0.0.5 Released

I'm excited to announce Twerp 0.0.5 is available. Twerp is the telephone hackers toolkit. It's a command-line app for Twilio written in Python.

New features in 0.0.5:

from the command-line:
  • Voice conferences: create, join, list conferences and participants
  • Buy new phone numbers with basic searching by area code or phrase  
  • Account management: list, rename and create new Twilio sub-accounts
  • Application management: list your Twilio Apps

Twerp exposes a lot of the Twilio API, so you have to be careful if you're using a live account. You can cancel all calls in progress for example, re-route calls etc.

Use a Twilio Sub-Account

Creating a Twilio sub-account with just one or two phone numbers for testing will save you a lot of headaches.

First, create a new Twilio sub-account:

$ twerp --create-sub-account Testing

$ twerp --list-accounts

cakebread
ACnnnnnnnnnnnnnnnnnnnnnnnn

Testing
ACnnnnnnnnnnnnnnnnnnnnnnnn


Now if you login to twilio.com, you'll see a drop-down box where your Master account name was (usually your email address):




Replace the master Twilio ACCOUNT_SID and AUTH_TOKEN in ~/.twerprc with your new sub-account information and you're all set.

 Now you can buy a number for that sub-account:

$ twerp  --area-code 310

 +1 310-555-1212
  ...
  ...

$ twerp --buy +13105551212

And annoy your co-workers with your new phone number:

   $ twerp -d 213-555-9999 --say 'Hi, this is twerp. Good bye.'

Monday, February 6, 2012

Yolk development

I released 0.4.3 last night because 0.4.2 was missing some documentation and license files. I may release a 0.4.4 this week. This release will contain some user-submitted patches.

Today in yolk development:
  • Tox for testing yolk with Python 2.6, 2.7 and 3.2.
  • py.test for unit tests
  • Jenkins for continuous integration (using Tox and py.test)
  • git-flow for managing it all
I'm still configuring Jenkins to do everything I want, but it's been working great with Tox + py.test, so far. [Edit: Jenkins is up at http://cakebread.info/jenkins]

The current code base will become 1.0 soon. This branch will support Python <=2.5 and may or may not get new features from the upcoming 2.0 branch.

The 2.0 branch (origin/develop on github) will work with both Python 2 and Python 3.

Sunday, February 5, 2012

I've released yolk 0.4.2!



yolk 0.4.2 is a bug fix release in preparation for supporting both Python 2 and 3.  Yes, it's time to get yolk off of the Python3 Wall of Shame.


I'm using gitflow to manage yolk's release and it is working great, so far.

Two bug fixes:
  •  --entry-map patch from Jesus Rivero (Neurogeek)
  • Fix for -C if you don't supply an integer
I've also switched to the BSD license from the GPL-2.

I'm working my way through some old bug reports and should have 0.4.3 out shortly.

The 'develop' branch on github is going to be used for the Python2/3 version.