OM record – a sample collection tool

A couple of years ago i bought an Openmoko Freerunner mobile phone handheld computer with GSM modem. This is a very useful device, which can run Debian and a number of other free operating systems.

One of the tasks I want to carry out with the Freerunner is recording samples to use in musical compositions – insect noises, mechanical rhythms, etc. A decent field recorder is in the US$3-400 range, so using my Freerunner for the task would be a good idea, and would also make me feel slightly less aggrieved about the large, heavy, expensive and slow brick in my pocket. There’s nothing available in free software land that I have found (although qarecord is pretty close; shame about having to manually name the record file each time it is fired up – maybe I will modify it to do this automatically, as it has the bonus of built-in recording meters), so I had to write my own.

The requirements are:
* a simple interface with large controls (start record, stop record, maybe measure levels and volume control)
* automatic filenaming (either incremental, by date, or some other non-interactive method)
* something i could quickly write with my basic programming skills (shell scripts)

The application has a UI based upon gtkdialog, and uses arecord (a wave recording utility forming part of the Advanced Linux Sound Architecture, or ALSA, utilities) to record the files. The first attempt is pretty simple: running the shell script creates a dialogue with one button, which says ‘Record’. Hitting the button starts recording from the soundcard listed in the script (on my Freerunner, this is a Samson C01U USB microphone, connected via a USB male-male converter), and also pops up another diaogue which says ‘Stop’. I’ll leave it to you to figure out what that does. At the moment it’s pretty hacky – the recording is stopped by using the sledgehammer-like ‘killall arecord’ command, it’s split into two scripts because of the inherent clunkiness of gtkdialog, there’s no deb/rpm/portage package, and hence no dependency checking.

Click here to get a tar.gz of the code (two scripts, one for the UI and one to call arecord) and two basic .png files for the ‘record’ and ‘stop’ buttons

To use it, you will need:
gtkdialog (tested with 0.7.20-4), which is currently in debian lenny and squeeze – i think development on the package has stopped though
alsa-utils (tested with 1.0.23-2ubuntu3.4), which is currently in debian lenny and squeeze

Uncompress the files somewhere, make sure the scripts are executable, and then run:
$ ./om_rec

The files will be recorded in the ‘samples’ sub-directory of the user’s home directory.

To do (likely):
* add a level meter
* add a volume control
To do (unlikely):
* replace ‘killall arecord’ with ‘kill <pid>’
* make a .deb package
* find out which versions of arecord it works with (I think it’s poor programming to only check it against what I have installed)
* record via libasound directly rather than calling arecord
* allow a different soundcard to be selected without editing the code
* find out why gtkdialog is not developed anymore, and possibly replace it with something still actively maintained (possibly ‘dialog’, whiptail’, ‘kdialog’, ‘cdialog’ or ‘ssft’)
* convince someone to rewrite qrecord so it automatically names the files

The code is released under the GNU GPL version 2 – click here to see what that means, and your rights for using the software
The images are released under cc-by-sa 3.0 unported – click here to see what that means, and your rights for using the images

If you are prepared to help, either by working on this or qarecord, drop me a line.

Leave a Reply

Your email address will not be published. Required fields are marked *