Dark Light

2015 update! This article is OVER TEN YEARS OLD. There are far better ways to do this now, including Media.io

 

The Nokia 7600 (And – I’m told – some Erikson phones) record in a format called “AMR”. After a little digging, I was able to convert these to a usable format (MP3) on my Linux box. This is how I did it:

You will require:

  • sox (via your package manager)
  • lame (Or some other encoder, see below)
  • The 3GPP reference converter files

The first is easy, sensible people should be able to apt-get install sox or whatever. The second may require some compiling and following instructions, the third is more complicated. The 3GPP FTP site appears to move around a bit, so links go outdated. I got it from here, but you might have more luck just searching google for “26104-520.zip”.

You need to get that file, unzip it, unzip the zip inside it (It all unzips into the current directory, so you’d best put it somewhere on it’s own first) and you’ll get a series of c & header files. If you’re using Linux (and the rest of this assumes you are) cp makefile.gcc Makefile and make it. xa.bi‘s site (Where I found the decoder existed) says you should do some playing with the files, but I’ve no idea what difference it makes. His site, btw, contains a much more advanced AMR converter than this, but I didn’t need that kind of complexity. Put the resulting executables (encode and decode) somewhere useful, and remember where it is.

This is the shell script I used to make it go, you could edit it, or write your own.

#!/bin/bash

# By Aquarion - Aquarion@Aquarionics.com
# Do what you want with it, it's not rocket science.

##Change these:
#Wherever you put encode and decode when you compiled them:
CODEC=/home/aquarion/opt/mms

#Temporary directory. Chances are you've already got this set
#TEMP=/tmp/

#Where do the final MP3s go?
FINAL=mp3/

for file in *.amr; do
	FILE=`echo $file | sed -e "s/.amr//"`;
	echo -n "$FILE [AMR] -> [$TEMP]"
	$CODEC/decoder $file $TEMP/$FILE.$TEMP > log.std 2> log.err;
	echo -n " -> [WAV] "
	sox -r 8000 -w -c 1 -s $TEMP/$FILE.$TEMP -r 16000 
		-w -c 1 $TEMP/$FILE.wav > log.std 2> log.err;
	echo -n " -> [MP3] "
	lame $TEMP/$FILE.wav $FINAL/$FILE.mp3 --silent 
		--tt $FILE --ta $USER --tl Aquarionics --ty `date +%y`
	echo  " :-) "
	rm $TEMP/$FILE.wav;
	rm $TEMP/$FILE.$TEMP;
done

That script as written takes all .amr files in the current directory, turns them into .mp3 files and puts them in a subdirectory called “mp3” (which needs to exist before you run the script.)

And there you have it. If you want to convert them to oggs, you’ll need to muck around with the “lame” line of the script a bit. Oh, and you’ll probably want to change the album away from “Aquarionics” too.

Related Posts