Blog Post

Phone Home: Near Real-Time Voice Recording and Streaming using Google Voice and Soundcloud

Phone Home: Near Real-Time Voice Recording and Streaming using Google Voice and Soundcloud

Happy New Year, HASTAC!

Perhaps unsurprisingly, one of my resolutions is to make more posts to this community about the digital projects in my life, academic or otherwise. To start, I thought I would share an experiment in phone hacking and audio recording that was both a success and a failure. It's a little long-winded (sorry!), but hopefully some of you might find it interesting.

By way of backstory, a few months ago I started tinkering with an idea where a group of people could upload short environmental field recordings to a centralized place, and have a website update and stream those sounds in as close to real-time as possible. I wanted to do it using the audio device that most of us have with us at all times—our phones—but I didn’t want to do it in a way that would require a specific phone, app, or operating system. I didn’t want a lot of editing or post-processing. I didn’t care about “fidelity.” And I wanted it to work even if the phone wasn’t “smart” at all. I realized what I wanted to use was good old-fashioned voice mail.

I’ll be the first to admit that these (totally self-imposed) restrictions cut out a lot of seemingly logical solutions. Still, an idea took shape: set up a phone number, have people leave a “message” (which could be a field recording), and have that message automatically populate a website or service. I thought that this would be relatively easy, or at least possible, with already-existing services, but none of them were a perfect fit. Both Audioboo and Soundcloud allow you to upload sounds via a phone call, but both are limited to a single phone number, preventing multiple callers and collaboration.

So, after some trial and error, I created a workflow that allows anyone to leave a message to a Google Voice number and then have that message populate a specific Soundcloud account (I would strongly recommend setting up a new Google Voice and Soundcloud accounts for this purpose). Success, right? Well, not exactly. While the hack totally “works” on a technical level, the algorithms that Google Voice uses to highly compress its audio files makes recording anything besides loud voices spoken directly into the phone essentially impossible. Delicate birdsong or even urban street noise don’t stand a chance.

Still, the idea itself really intrigues me, and I plan on tweaking it more and seeing how it might work for other projects or settings. I would love to hear how you might incorporate something like this into your digital life or academic classroom. Below you’ll find the steps to do it yourself, and a functioning example. Feel free to add thoughts, suggestions, and questions in the comments, of course!

Automatic Upload to Soundcloud via Voicemail

Tools needed: a Google Voice account and phone number, a Dropbox account, an IFTTT account, and a Soundcloud account (all free); a Mac computer that you are willing to generally keep running while your project is active; a dedicated website (optional, costs vary).

Software needed: Apple Mail, Automator, AppleScript Editor (all free)

Preliminary Step A: Make sure your Google Voice settings are such so that you’ll receive an email when you have a new voicemail—and only when you have a new voicemail.

Preliminary Step B: Set up Apple Mail to recieve mail from this Google account.

Preliminary Step C: Install the “Rename Finder Items by Pattern” Automator action.

Preliminary Step D: Install the Google Voice Python bindings.

Step 1: Using a text editor, create a Python script that calls Google Voice and downloads your voicemails. Here is the code you need:

#!/usr/bin/python

from googlevoice import Voice

download_dir = ‘/Users/Name/Path’ //change this to a file path on your computer

voice = Voice() voice.login(‘name@gmail.com’, ‘pass’) //change ‘name@gmail.com’ to your Gmail address; change ‘pass’ to your password

for message in voice.voicemail().messages: message.download(download_dir)

Save this text document with the file extension “.py” to a handy place on your hard drive. I called mine “GVoiceMail.py”

Step 2: Create an AppleScript that runs this code. You only need 3 lines, like so:

As you can see I called mine “Fetch Voice Mail.” You should save this in your default scripts folder.

Step 3: Have Apple Mail run your new script every time you get a new voice mail. You can do this using the “Rules” section of Mail’s preference pane. Create a new rule so that when you receive an email from Google Voice, it runs your script. Here is what mine looks like:

Step 4: At this point, your script will have downloaded files with ridiculously long and odd filenames to the folder that you specified in Step 1. We need to automatically move those files into a subfolder of the “Public” folder in your Dropbox and rename them to something that makes sense. To do that, open Automator and create a new “folder action” that acts on the file where your voicemails are. These actions run automatically every time a new file pops into the folder. Use this series of commands:

  • Get Folder Contents
  • Filter Finder Items where “Kind is Music”
  • Copy Finder Items to “(folder of your choice, which should be inside the ‘Public’ folder of your Dropbox)”
  • Rename Finder Items by Pattern. Search for “*”, replace with “(your project’s name.mp3)” 
  • Add Date or Time (see screen shot):

By adding date and time twice you end up with a VERY specific timestamp, to avoid possible naming conflicts.

Step 5: Now that we have these voicemails renamed and sitting in our Dropbox folder, we can tell the nifty IFTTT service to upload them to our Soundcloud account. The recipe should simply use Dropbox as the input and Soundcloud as the output: If a new file is added to your public folder, upload that as a public track on Soundcloud. Adjust the particulars to your folder names and Soundcloud settings.

Step 6 (optional): Now that you are all set up, all you have to do is distribute your Google Voice phone number to whomever you want to be involved in your project. If you want, you can do all this without even giving anyone the actual number by creating a call widget on your website. The positive thing is anonymity, the downside is that the people involved will need web access.

You can check out an example of this workflow on this page (which is a part of website in progress…but more on that in another post!): http://commons.fieldnoise.com/fieldnoise-fieldphone/

76

2 comments

I think this is cool. It might be easier though, if someone is using a small group to just download/upload the voicemails themselves from the google voice interface.  I've done this for project before where I've had a set of questions and then provided the number for people to call and respond.  I've also used it to record phone interviews and collect oral histories for various projects and personal purposes.  I love that it has an embed code built in now. The perfect compliment to the call recording capability.

I would love to see a mock project you are imaginging this use case for!

62

Hi Jade—thanks for the feedback! I actually hadn't even noticed the "embed" code, since I actually do most of my day-to-day Google Voice stuff either through GrowlVoice or my phone. That addition, along with the ability to download, makes the web interface probably sufficient for most people.

I'll post an update here in the comments when I think of some cool way to use this...

53