spaceblog

converting .wav to .amr for fun and profit!

I’m about 2 years behind the trend – now I can record random noises and make them my ring and message alert tones, and this is great fun. Nick (I think) had the great idea of getting some pirate .wavs from the internets and using them instead of using my own voice.

I downloaded a snippet of Disney’s Pirates of the Carribean song, and uploaded the wav to my phone. No dice, phone doesn’t play wavs.

The track I recorded is an .amr, though, so lets see if sox can convert it… nope, it doesn’t know about it. But google mentions there’s some reference code at 3gpp.org which will do the conversion. Well, it didn’t at first, but to cut a long story short because it’s late, xa.bi has links to the code, which you want to download, unpack, and modify the makefile.gcc and decoder.c per the instructions there. Then:

make -f makefile.gcc
sox input.wav -r 8000 -w -c 1 -s output.raw
./encoder -dtx MR475 output.raw ringtone.amr

That differs from the xa.bi amrconvert script only in that there’s a -s option to tell sox to also convert to 16 bit signed PCM, in case the wav started out as GSM or some other format. The script also tries to fiddle with the amr after it’s encoded, but that didn’t work for me; short circuiting it and just loading the amr straight onto the phone worked fine.

So now I’ve got the glorious pirates singing along each time I get an SMS. Can’t wait for the monitoring to go off at work tomorrow…

OMG bluetooth and ubuntu

After the disappointing escapade with IrDA, the ThinkPad, Ubuntu, and the new phone, I had little hope of bluetooth working – how wrong I was!

I plugged in the little D-Link dongle, and it was immediately detected. A quick google suggested I install bluez-utils and gnome-bluetooth, and after running gnome-obex-server we had some 6 phones and laptops all buzzing around the sub ether in the lounge room. Exciting stuff! (gnome-obex-send and gnome-bluetooth-manager suck a bit to use, and I’d like to be able to browse the contents of the phone over -manager, but I’m still impressed that it just worked).

I got a fresh screengrab of glsnake to use as the wallpaper on the phone and beamed it up, it’s sweet as.

Ed Dumbill also has a phone manager application, install it as gnome-phone-manager – it speaks IrDA and bluetooth, and I was able to send an SMS from the laptop, totally rad.

ubuntu: 1, jaq: 0

So, after discovering I had the irda port disabled in BIOS, I managed to get something out of irdadump; but nothing from the phone.

Apparently this isn’t going to work though, this page informs me that the correct driver is only included in the 2.6.12 kernel, and unfortunately Hoary only runs 2.6.10. I’d upgrade to the Breezy preview but my workmate has just discovered an awesome bug in which /dev/input is deleted at startup, which causes X to fail because there’s no /dev/input/mice – creating /dev/input, restarting udev, and restarting gdm fixes it… but that’s a world of hurt I really don’t care to put myself into.

So instead I found the place where my old phone can copy contacts from memory to SIM, and put them all into my new phone. Unfortunately it decided not to keep the multiple-number contacts as a single contact, and expand them all, so now I have various people listed two or three times with their home and mobile and work numbers all separate.

Loves the technology!

synchronising nokia with ubuntu

I have a new phone; well not bleeding edge new, but it’s fresh from the packet and shiny and it has many redeeming features over my old phone: the primary “menu” button works. (There’s a short and not terribly interesting story behind this button, so I won’t bore you with the details!)

After swapping the SIM card, I discovered that the phonebook was not stored on the card as I had expected, but must be in the phone memory! Curses!

I’m not sure I trust my old phone to copy the addresses to the SIM card safely, so instead I want to get the phone to synchronise with my laptop, and then once my contacts are all safely backed up, I can resync with the new phone and all will be good with the world.

However, I’ve got no idea what I’m doing. The ThinkPad is running Ubuntu; it has the irda module loaded, and as far as I can tell, irdadump listens to… something. Setting the old phone to IR mode shows nothing though.

So, I ask the Internets: how do I get the laptop and phone to speak to each other over IR, and once that’s going, what application do I use to sync with?

I admit I expected it to just work, as has been the case mostly with Ubuntu interoperating with Things. A few googles shows some ubuntuforums posts that weren’t very helpful; creating device nodes sounds like something that should already be done for me.

Feel free to comment, or by email, or blog about it if you know the answers or can provide helpful advice. JWZ’s usual rules apply for replies, thanks.

evolution filter to procmail conversion

I find evolution to be pretty slow to filter my mail; if I come back after a weekend without evo running, then it can take a good 20 minutes or so filtering mail before it’s ready again. I use a pretty roundabout way of getting mail: fetchmail fetches it from the main mailserver and delivers it using procmail to my maildir inbox on NFS, which is then served by IMAP from the fileserver back to evo on my workstation. I like IMAP, and ideally the mail would just get delivered to the fileserver, but I don’t have that luxury yet :)

But I’m using procmail, which means that all the mail can potentially be filtered as it’s delivered, which would save plenty of perceived time. I wondered if there was such a beast that could convert evolution filters to procmailrc format. Turns out there isn’t.

But it also turns out that the filters are stored in an overengineered bit of XML in your .evolution directory, and after perusing it I realised I could probably write an XSLT to convert it.

So, here’s the first draft of evo2procmail.xsl which isn’t terribly crash hot, but can give you a .procmailrc fragment that’s pretty close to what you want. It will definitely need some editing afterwards, as I haven’t bothered translating evo filter names into their actual headers, nor do the targets look anything like what you want to send them to.

Run it like this:

xsltproc evo2procmail.xsl ~/.evolution/mail/filters.xml

Enjoy! (Experienced XSLT hackers are encouraged to improve this :)