Recording and Uploading Audio Using the E61

Let me set the stage for you. It begins with an IM conversation, much like any other IM conversation, but this goes subtly wrong:

  • *Russ file transfers me an image*
  • Miker - What the hell is that?
  • Russ - it’s one of those gif images I was talking about yesterday
  • *I search furiously through my Adium logs*
  • Miker - the last time I have you mentioning gif images was on April 1st. If this is some elaborate April fools joke I think you’ve taken it too far.
  • Russ - no, we were talking about at lunch yesterday, talking in the real world

Gah!!! The real world, my oldest and most hated enemy. For decades humanity has yearned to destroy it, yet still it persists. Surprising really, the whole thing is just horribly designed. The APIs are all complicated and baroque, the documentation that’s available has all been reverse engineered, backups are impossible in most cases, there’s almost never an undo feature available, and most of all - the search sucks. If you ask me we should just scrap the whole thing and start over. Alas, I lack the necessary admin rights to modify reality, so I make do with what I have on hand.

So I have this memory problem, almost anyone who has to deal with me knows about it. I remember things for 5 minutes, maybe 10 tops. Seriously, just about everything. I normally can’t tell you how old I am without doing the mental math based on my date of birth (one of the few free variables that I’ve managed to bind permanently somehow). So I write stuff down and keep it around. I used to just keep the stuff sitting on my server, but recently have started to use subversion for, well, everything. It’s brilliant, life is good.

However there’s still the real world, where recently I’ve had to spend more and more time. And this whole memory problem is starting to become more of an issue. So I was considering getting one of the dweebish voice recorder things, one of the flash based ones, to record important stuff and keep it around. But hey! My E61 has a record function already, and that has like 2gig of memory in it, it should be able to do just fine, right?

Unfortunately, no. The limit for voice memos seems to be 1 minute. 1 minute. 60 seconds. I have 2 gig of memory in the thing and the record limit is 60 seconds! Ummm, yea, that’s not gonna cut it. So I started searching around and found the Ultimate Voice Recorder for S60 devices. Seriously, that’s what it’s called. Now normally I have a total aversion to paying for software. Maybe I’m an open source biggot, maybe I’m a communist, I have no idea, I just don’t like to do it. But in this case I really needed something to help otherwise the real world was going to win. And I just couldn’t let that happen.

So I was playing with it and it has all sorts of neat stuff. Unlimited record time, it’ll record in the 3gpp audio standard called AMR to save on space and use the hardware acceleration that some of the phones have, it has hotkeys. And what’s this? It has email support!! Like every time I take a memo I can have it emailed off for me automagically? Well, now this certainly is interesting. Theoretically I could have the app send off all my voice memos and recordings, snatch them on the server, transcode them out of AMR and into a format that most other systems will play natively, and check the stuff into subversion so that I can sync it all over and access it on the web. All one might need then is a cheap and effective way to farm out transcription and you could make at least some of that nasty real world stuff replayable and searchable. W00t!

So that was just too much for me to resist. Here’s how to do it and my scripts if you want to mess with it:

  • One of the first things you’ll need is a transcoder for AMR. Difficult, cause as I’ve mentioned before, the 3GPP website is worse than useless. They do have a reference implementation on their site, it’s just impossible to locate. So go here and download the zip file linked to version 6.1.0
  • Now that you’ve dodged the whole 3GPP misdirection issue you should be set, right? HA! No, now you have to deal with the reference implementation actually being designed for use with MMS. If you just take the makefile.gcc and try to compile the tools, they’ll crash with a seg fault if you feed them one of the ultimate voice recorder AMR files. Nice, huh? What you need to do is remove the -DETSI from the CFLAGS_NORM line in the makefile and compile like that. Now you should be able to use the decode program from that package to transform the amr file from the recorder without issues.
  • So what comes out the other end? A raw sample file actually, which is not quite the same as a wav file. Recommended practice is to pass it through sox to get it from raw into wav format.
  • Then you can use whatever mp3 encoder program you want to make it playable.

For me, the ultimate goal was getting it transformed into mp3 and then shoved into the local subversion repository from which I could sync it down to laptop, desktop, home, replay it from other devices, etc. So I wrote up a simple Ruby script that I could hook up to a mailfilter rule to:

  • Pull the attachment out of the incoming message
  • Parse the date and time, conveniently deposited in the filename of the attachment (ROCK ON!!)
  • Transcode the audio from AMR into mp3
  • Create a day subdirectory in the audio repository if necessary
  • Check the stuff into subversion

It’s just driving a bunch of external programs to do most of the stuff, but once I have it hooked up to a mailfilter rule as soon as I take a memo on the phone it’s zipping off to appear in the online repository. And available the next time I ’svn up’ on any of my systems. Take that real world! Now if only I could remember why I started doing this in the first place……

Leave a Reply