Songs in the Key of Beatnik

The Beatnik Audio Engine is a software synthesizer that produces music and sound effects by playing sampled instruments controlled by MIDI data. The current

The Beatnik Audio Engine is a software synthesizer that produces music and sound effects by playing sampled instruments controlled by MIDI data. The current incarnation delivers high-quality, cross-platform interactive audio via the Beatnik Player, a browser plug-in that contains a compact library of sounds capable of rendering MIDI and Rich Music Format (RMF) files embedded in Web pages. More important, you can control all of the Beatnik Player's various functions with JavaScript commands, which let you create "sonified" Web sites that play sound effects in response to mouse clicks, Web-based interactive remixes of popular artists' songs, soundtracks for Macromedia Flash, and Shockwave movies. Versions of Beatnik's technology have also been licensed by Apple; WebTV; Be, Inc.; and Sun Microsystems.

You create RMF files with the Beatnik Editor, a Macintosh program available online at One of the most powerful aspects of the software, from a composer's point of view, is its ability to create custom instruments. Want a particular kick and snare sound for your General MIDI tune? Dogs singing "Jingle Bells"? No problem. Import your samples into the Editor, create an instrument using the sounds, add a MIDI file to play the instrument, and export the whole bundle as a copyright-protected RMF file, ready for computer users worldwide.

To demonstrate, I produced a song in RMF titled "every seven years." You can play it at feb00/examples.html. You can also download the Editor session and MIDI files so you can see exactly how I created the file. The song contains two custom instruments: a Steinway piano and a vocal track. Because the samples are MPEG compressed, the entire three-and-a-half-minute song is under 450 KB.

CUSTOM INSTRUMENTSLet's start with the piano. Earlier this year, I recorded all the C's and F#'s of my 1926 Steinway using a couple of Neumann mics in order to create a large, high-quality stereo instrument. Since I wanted to keep the data file size of this song as small as possible, I needed to make a more compact piano. Using only one note per octave, I looped the samples as short and tight as I could before downsampling to 22 kHz mono using Waves' WaveConvert. Then I fired up the Beatnik Editor, created a new, empty session, and imported the files by dropping them into the Samples window.

Now to create an instrument definition. From the Instruments window, I selected the User bank and named the first slot "steinway" (see Fig. 1). I double-clicked the name to call up the Keymap dialog box, which allowed me to specify which samples were to be played for what range of notes (see Fig. 2). On the right side of the dialog box, I added the piano samples; on the left, the required number of zones. Then I selected the first zone and the first sample and "linked" them; the second zone and second sample, and so on. Checking the Edit Keymap Ranges box let me specify the range of notes for each zone by clicking on the keyboard. In this case, I used G2 to F#3 for the C3 sample, G3 to F#4 for C4, and so forth. I was careful to set the triangular Instrument Root Key slider (at the bottom of the keyboard) to the appropriate note, and placed the Sample Volume slider (on the left of the keyboard) near the top to maximize the sound.

Finally, I set an ADSR envelope for the piano in the Volume dialog box, which allowed me to specify the rate of decay during the sustain loop. You can also set vibrato, tremolo, panning, and other effects using the Modulation and Filter dialog boxes. That was not necessary for this instrument, but I've found those features to be quite useful when file size is at a premium. Varying the settings can produce a wide range of sounds from a small number of tiny samples. For example, the Beatnik Editor created the WebTV GM bank, which can contain 128 instruments plus percussion in only 350 KB.

ADDING VOCALSTo produce the song in RMF format, I needed to create a Beatnik instrument that would play the vocal track. First, I recorded the piano part using Opcode's Vision sequencer and imported the MIDI file into Digidesign's Pro Tools for the recording session. With Jeff Lipton of Sonicopia engineering, I recorded Roberta Donnay singing the song at DubeyTunes in San Francisco.

At my studio, I began preparing the audio. I cut up the vocal phrases in Pro Tools on a 32nd-note grid, keeping track of where each piece started (to facilitate synching with the MIDI data later on) and splicing as close to the beginning of each phrase as possible (to keep the file sizes small). After shaving off extra space at the ends of the phrases, I used Waves' L1 to maximize the audio while limiting to a -1 dB ceiling (this prevents distortion when the samples are MPEG compressed). Finally, I converted all the files to 16-bit, 22 kHz mono SDII files and imported them into the Editor session.

I performed the same procedure to create the vocal instrument, except that I assigned each vocal sample to a key range consisting of a single note, so that playing a chromatic scale fired off each phrase in sequence. I also made the volume ADSR completely flat, which indicated to the Editor that MIDI notes received for that instrument were intended only to trigger the sample.

MPEG COMPRESSIONAt this point, the session file contained over 6 MB of samples, which is a bit too much for a 28.8 kbps modem connection to handle. Here comes MP3 to save the day! The Beatnik Editor contains an MPEG compression algorithm that can squeeze samples to less than a tenth of their original size with very little loss of character. I am continually amazed by how well this technology works; in a low-bandwidth world, it's an absolute lifesaver. If your original audio is like a marble statue, then the compressed version is like a thin plastic cast of the sculpture-it looks the same, but it weighs a lot less! MPEG compression analyzes the frequencies present in certain bandwidths, then applies psychoacoustic principles to encode only the frequencies the human ear can hear.

The Editor's Compression menu gives you a number of bit rates to choose from, and selecting the correct one requires a little trial and error. Caveat: there is currently no Undo for MPEG compression in the Editor. It's best to make a number of copies of the sample in question and to test the various rates on them. A 16-bit, 22 kHz mono file will frequently compress at the 48 kbps bit rate without causing audio artifacts, but this is heavily dependent on the content. Sharp transients like snare will usually require a higher rate, resulting in a larger file. Vocals, with their limited frequency range and smooth attack, generally compress like a charm at the lowest available rate (32 kbps), whereas noise (ocean surf, for example) will sound as though it's submerged in electronic soup at that level of resolution. Sometimes the compression algorithm produces a loud click at the end of the sample, which you can eliminate by adding about 30 ms of silence to the tail of the original audio. Of course, Beatnik has one major advantage over other systems: it remembers where your loop points are. Thus, I was able to squeeze almost 1 MB of looped piano sample data down to 140 KB.

CREATING THE MIDI FILENow that the instruments and samples were in place, I needed to make a MIDI file to play them. I did this by selecting Link to Sequencer from the Editor File menu. The command loads all the samples into RAM, where they can be accessed by the sequencer via OMS. You can then create 16 channels of Beatnik MIDI just as if the Editor software were an outboard synth. Setting up this link can be a little tricky, but the Beatnik site provides helpful documentation on connecting with Vision, along with some special tweaks that are required for users of Performer. Once the connection is in place, however, MIDI data from the sequencer is routed to the Editor, and you can hear your sequences played by the Beatnik instruments.

In Vision, I put the piano part I'd used for the recording session on the first channel and put the vocals on another channel (see Fig. 3). Notice that the patch controller specifies which channel is assigned to the instrument. In the case of the vocals, the channel is "bank2, patch1." I initialized volume, pan, chorus, and reverb amounts, then used CC 90 to select one of the built-in Beatnik reverbs. Applied judiciously, this effect can help mask some of the audio artifacts introduced by MPEG compression; this is also true of the built-in chorus effect.

I then carefully entered trigger notes on a 32nd-note grid according to the layout I created when I cut up the audio in Pro Tools. When I played back the sequence, I could hear the piano and vocal tracks together, played by the instruments I'd created using the Beatnik Editor. After adjusting mix levels in both the MIDI and instrument definitions, I experimented with various chorus and reverb settings. Then I exported a Standard MIDI File, unlinked the Editor from Vision, and imported the file into Beatnik Editor by dropping it into the Songs window. I could then play the song from the Editor and enter copyright, credit, and other information.

EXPORTING THE RMF FILEAt over 800 KB, the file was still too large (I was shooting for under half a meg), so some tricks and compromises were necessary. Using one set of samples for both the first and second choruses saved a lot of space, and I was even able to use one sample of the words "we are" in two different lines. To pull that off, I had to re-edit some of the samples and "earball" the MIDI trigger notes to get the audio to line up seamlessly, but when I was done, I'd removed over 300 KB with minimal impact on the lyrical content.

When all the final versions of sample and MIDI data were in place, I selected the Export RMF command from the Editor File menu. That created a flat, cross-platform, 40-bit encrypted, copyright-protected RMF file that any Beatnik-enabled browser can download and play. The file can simply be embedded in a Web page or playback can be controlled by JavaScript code using the Music Object API, an interface protocol that provides the mechanism for Beatnik's powerful interactive features. You can also export a stand-alone application for Mac or PC that will play the song when you double-click on the file. That method bypasses any browser issues and is useful if you want to distribute a version of your tune on disc.

CREATIVE CHALLENGEWhile producing this kind of RMF file can be technically challenging, the flexibility of the software lets composers incorporate any kind of audio into their online creations, limited only by their skill and imagination. Guitar chords, saxophone solos, drum loops, wolf howls, rude noises-anything is possible, and the file will sound as intended on any computer. With audio becoming a standard part of the Web, more and more people will be creating songs in the key of Beatnik.

Peter Drescher is a composer and owner of Twittering Machine, a project studio in San Francisco. He has used Beatnik technology to produce sound effects for games, WebTV, the BeOS, Adobe, and Sonicopia.