Monday, March 12, 2007

Bhajis Loops

Of the more than 20,000 third-party applications that have been written for the Palm OS, Bhajis Loops has got to be one of the most ambitious, quirky, and downright brilliant software applications ever to run on a Treo mobile phone.

Bhajis Loops is the brainchild of French programmer Olivier Gillet, who named his one-man company after a chocolate-eating pink pet octopus named Chocopoolp. (When you write great software, you get to call your company whatever you want.)

Composing and creating music is what Bhajis Loops is all about. Despite the whimsical name, this is a serious digital audio workstation software package that offers a sample editor, virtual instruments with wavetable synthesis, a pattern editor and sequencer, effects, automation, and more.

Squeezing all that processing power into code slim enough to run a Palm device is not a trivial feat of software engineering. In terms of features and capabilities, Bhajis Loops doesn't lag far behind some popular Windows-based music applications. The fact that it runs on a Treo is pretty amazing. And oh by the way, Bhajis Loops is a $27 download. How's that for value?

Once I got my hands on Bhajis Loops, I knew immediately that I had to try to create something interesting with this software. My project: A mash-up of bon mots from Stephen Colbert's keynote at the 2006 White House Correspondents' Dinner (CSPAN video), set to my own music and composed on my Treo 650.

I composed, created, arranged, and mixed down the track using Bhajis Loops exclusively -- with the exception of the first and last steps as noted below. The result is a two-minute song that I named "The Gut":

The Gut - Lars Kongshem vs. Stephen Colbert (MP3)

Here's a step-by-step description of how I created my composition:

Step 1: Capture the dialogue. I could have used Bhajis Loops for this task, as the program includes a feature to record samples. However, given the lack of a line-in audio input on my Treo 650, I would have had to use the built-in cell phone microphone to record the samples, which would have resulted in poor audio quality. So I chose to complete this preliminary step using Windows software instead. First I used Total Recorder to record the entire sound track of the White House event as a WAV file (using the Google video stream from C-SPAN as the audio source). Next I used Audacity to crop the WAV file into the choice bits of dialogue that I wanted to use in my song. Finally I copied the raw samples to my Treo's 2 GB SD card.

Step 2: Choose and edit samples.

To get started creating music in Bhajis Loops, you begin by choosing samples that you can then edit and tweak to your liking. I downloaded a bunch of free sample packs, which got me started with a wide variety of synth, drum, and percussion samples. I also imported the raw Stephen Colbert dialogue snippets that I had created in Step 1, which I then edited and trimmed using the built-in sample editor. All in all, I used a total of 16 instrument samples and 19 dialogue samples for this song.

Step 3: Create instruments.

Once you've chosen and edited your samples, you can then create virtual instruments that are based on those samples. Or, as the excellent help file puts it: "The instrument editor is where you adjust the synthesis and playback parameters of a given sample to create an instrument." As you can see from the screenshot, you've got parameters galore to choose from -- everything from volume to modulation and resonance. (As a newbie, I was just scratching the surface of the capabilities of the instrument editor.)

Step 4: Build patterns.

This is where you compose the melodic riffs, basslines, and drum patterns that make up the building blocks of your composition. The pattern editor allows you to choose instruments and "paint" the notes using a piano roll interface. (Other views are also available, but I found this interface to be the easiest to use.)

Step 5: Arrange the song.

Now you're ready to put the patterns together in sequences to arrange the composition. This is where your adrenaline really starts to kick in, as the song starts to take its final form. And here's where I hit the Treo's technical limits, as I began to run out of internal memory and the application began to display a series of warning messages. When this happens, the song data becomes corrupted in memory -- so it's imperative to NOT save the file over the previous version. Which is of course what I did. Luckily I had a backup, so I didn't lose more than a couple of hours of work.

A little background on the Treo's brain-dead memory handling: Regardless of how much Flash RAM is available to the device as file storage (internal and via the SD card), the Treo is limited by 10 MB of internal true (volatile) RAM to run applications. When you launch an application, it has to be copied to true RAM -- along with the data accessed by that application -- in order to run. As you add more and more samples and create longer and longer compositions in Bhajis Loops, you run the risk of busting that 10 MB barrier ... and when it happens, you're basically screwed. So be careful.

Step 6: Mix down.

This is the final step in the music production chain. Here you can adjust the volume and placement of each track in the stereo soundfield. You can also add effects to individual tracks. Each effect adds CPU overhead, which means you may not be able to audition all the effects simultaneously. I created three effects buses -- chorus, EQ, and reverb -- to sweeten selected tracks.

Once I had tweaked everything exactly the way I wanted it, I rendered the song to a WAV file on the Treo's SD card -- an operation that took about 10 minutes for the Treo to complete. A helpful progress indicator took the guesswork out of this step.

Step 7: Convert to MP3. This operation has to be done on a PC, because there is no MP3 encoding software (that I'm aware of) available for the Palm OS. I used Audacity for this operation, using the Lame encoder at 192 Kbps.

The final result:

The Gut - Lars Kongshem vs. Stephen Colbert (MP3)

Give it a listen and let me know what you think.

Bhajis Loops is an impressive feat of miniature software engineering. You wouldn't want to create all your music on a Palm device, naturally. But this is a great way to make time pass by doing something creative. So next time you're stuck on an intercontinental flight with a boring movie, try making some music with Bhajis Loops instead.