Monday, December 7, 2009

Audio based interfaces for Twitter Part 1

Back in July I decided to join Twitter. My main motivation for joining is that I hate sms messaging and most of my friends prefer to communicate that way. I figured it would be a happy medium for communication. Since then I have found that Twitter is useful for all kinds of things.

For those that don't know, Twitter's API is well documented and can be interfaced with extremly easily. Most feeds on Twitter can be pulled in RSS format, and that gave me an idea. I decided to make an audio interface for my feed. To accomplish this I made a Bash script that does the following: Curl requests my #).rss and saves it to a file. Next I use sed to strip any unnecessary data from the file such as HTML or XML code etc. Once the file is edited, I use a text to speech program called espeak to convert the text to a wav file. Lastly the wav file is played by mplayer and ouput to a bluetooth headset via the alsa bluetooth option.

The script was set up to sleep for fifteen minutes, convert the data, and then run again. It worked as I had planned. After about a week I had another idea. I realized that RSS feed could be converted in the same fashion. So I did. This time I had to modify some things.

I copied the origianl script and modified it. The first modification I made was to have this script run for fifteen minutes then sleep. This basically filled the silent gap the Home script left. The second was something that I made shortly after listening to the audio. Things like " as pure text show up as decimal notated Unicode, so anything that is not readable text gets filtered. Eventually I made the same edit to my original Home audio generating script. The only other edit to this new script was the credentials asking for the data (made a test account) and the url to the RSS data which is: , and lastly changed the filenames that espeak, sed, and curl output.

Now pleased with my bizarre creation I began telling people about it. With this I ran into a problem. It was really hard to explain it to someone face to face, but it was even harder explaining it in 140 characters. After a couple months I got another idea. I was going to broadcast the audio via an online radio station.

In "Audio based interfaces for Twitter Part 2", I will talk about the the things needed to make the radio station work, and some of the on going difficulties I still have. If you want to go ahead and preview the audio then click here If the station is down for some reason, try again latter as I am still working out some issues.


  1. The script is available on request. Contact me via twitter