Making music on a computer, from a programmers perspective

I spent most of yesterday’s evening setting up Cubase SE after my harddrive crash. I went through all free CD’s that I got with the issues of swedish computer music magazine Studio and discovered a bunch of interesting virtual effects and instruments.

A little background in how modern versions of Cubase (or indeed most any sequencer program works): The program mimics a analog multi-track recorder, to which you can record analouge sound sources (in my cases an electric guitar and an electric bass — soon, vocals as well). There’s nothing magical about the way the audio is recorded — basically they just end up as high-resolution WAV files on your harddrive.

In addition, you can record or program MIDI as well. A midi file is essentially a bunch of messages arranged on a time scale, the most important being Note on (that has some parameters, like pitch and velocity) and Note off. MIDI is about 20 years old as a standard now, but it’s surprisingly versatile in a computer recording environment.

In the old way of doing things (like 5 or 10 years ago), these MIDI messages were sent to an external unit of some kind — a synthesized/sampler/workstation/sound module or some other box outside of the computer that made some kind of sound, that was then recorded more or less like an analouge source (like a electric guitar). Nowadays, it’s feasible to simulate all kinds of sound-generating boxes inside of the sequencer program in form of plugins. In Cubase lingo, such a plugin is called a Virtual instrument, or VSTi (Virtual Studio Technology instrument), and it’s essentially a multithreaded win32 dynamically loaded library, compatible with C++ calling conventions. When writing a VSTi, you inherit from a base C++ class and override a bunch of methods. Basically, one method that the host application calls to notify you that there is a incoming MIDI message, and another that the host application calls to find out how the instrument sounds. Your plugin renders the sound, based on incoming MIDI data, in the form of an array of doubles that represent the sound (typically 44100 doubles each second) — essentially PCM samples.

Now, MIDI messages can be more than just Note on and note off. There’s a whole class of messages that are used for parametrizing various aspects of a electronic instruments sound generation — things like changing the cutoff frequency or the resonance. If you’ve ever twiddled on a Roland TR303 or it’s virtual cousin Rebirth you know the kind of things that can be tweaked, and what kind of sounds can come as a result. Each VSTi can choose if and how to map these messages to some form of internal state.

There are some additional methods that are used for the host application to query and set the state of the instrument (for things like changing the sound preset, or manipulating parameters that can’t be changed by MIDI messages), but essentially that’s the entire interface — it’s less than 10 methods, most with very very simple signatures. But that’s enough for building an amazing amount of virtual instruments — every known technique for generating sound (playing samples, frequency modulation, simulating analog circuits, and so on) has been encapsulated in the form of VSTi’s. I used to play with hardware synthesizers and ”music workstations” back in the day, and it’s so much more flexible and downright fun to work with virtual instruments.

There is a similar (and older) API for writing effect plugins, like reverb and delay — override some methods, recieve a bunch of floats and tweak them to produce the sound you want — enabling you to virtualize a bunch of effect boxes, and even simulate complex things like the sound of a Marshall tube amplifier playing through a 4×12 speaker.

My favorites so far:

  • sfz – a soundfont player. A soundfont is basically a bunch of audio samples with some metadata that tells which samples that corresponds to what notes and velocity ranges. This is a common format for free sample collections.
  • crystal – a polyphonic synthesizer with really good presets
  • creakbox – sounds like a Roland TR303, including all the knobs to tweak.
  • Lallapallooza lite – great for more noisy sounds
  • Little green amp II – a guitar amplifier simulator

Rule of thumb

If you find yourself playing the riff you just made up so hard that
the guitar strings break, you just might be onto something.

Update: If you find yourself thinking that the riff you made up just might be something,
you’ll find out that you unknowingly ripped it from another song (in this case ”By
the grace of god
” by the Hellacopters)

Oooh, what a shiny little gadget

The new CS-32
is a miniature control surface for fast access to the most commonly used
functions in most audio programs. It works with Digidesign ProTools, Digigram X-Track,
Steinberg Nuendo, Cubase SX, VST, MOTU Digital Performer, Soundscape REd, Cakewalk
Pro, Sonic Foundry, Abelton Live, Merging Technologies Pyramix, Logic Audio and Most
Audio Software Programs!

It’s around the size of a A4/Letter page. I’ve been using Cubase SE for a while,
I guess this little thing would be compatible with it as well as it’s basically a
stripped down SX. There is definitly something to be said for physically twiddling
the knobs and hearing the sounds. I’m sure it’s pretty good value for money, but the
swedish price (6500 SEK) is a little too much for me. The US price is $400 (around
2900 SEK), which makes it a little more affordable, even with import duty added. Anyone
know of any good US online stores that deliver to Sweden?

The bestest power chord ever

I used to think that this was the best powerchord:

0 X X X 
| | | | | | 
| 1 2 | | | 
| | | | | |
E B G D A E 

…but after careful consideration I’ve come to the conclusion that this one is, in
fact better.

      X X X
| | | | | |
| | | | | |
1 1 | | | |
| | 4 | | |

In particular, it sounds awsome when played mute just across the lower G and the C
(not the higher G), then gradually opened up to the full powerchord.

I hope this settles this ugly debate.

This one goes to 11^H^H8!

  • 8-string
    electric guitar
    , tuned F, Bb, Eb, Ab, Db, Gb, Bb and Eb (low to high) or to customer’s
  • 3-piece hard rock maple, graphite reinforced through-body neck, with an ebony 24-fret
  • Alder body with a maple top.
  • Extended scale length for a clear and defined low end with superb overtones.
  • Features an ABM bridge with fine-tuners, and a locking nut.
  • One custom-wound Lundgren humbucking pickup.

This is the guitar used by Mårten Hagström and Fredrik Thordendahl of Meshuggah.

Even without the celebrity endorsement, I still would have lusted after this one.
Wonder how hard it is to learn to play? Then again, I probably should be a little
more proficient with the 6-string version first.

Update: Meshuggah has been scheduled to
play this year’s Roskilde Festival.
One more reason to go!