SuperCollider Quickies

Finished two tiny SuperCollider projects. The first is a reimplementation of the Csound modem instrument from this morning. The conversion to SuperCollider was straight forward; I basically swapped out randh for LFNoise1, limit and ceil for > (greater than), and oscil with sine table for SinOsc:

play{ > 0 * 200 + 1070)}

The second is an experiment short enough to tweet, which I did:


Faux Modem Audio

I’ve designed a series of audio samples based on classic modem technology and I’ve released them on SoundCloud under the Creative Commons attribution license.

Now for the extremely geeky party, how these samples are made. The sounds are generated with Csound using a form of frequency modulation called frequency-shift keying, a technique used by modems to transmit data to one another. Here’s a brief, and for this reason a not-to-entirely accurate, explanation of how a modem works. Modems communicate with each other by sending and receiving binary data between one another. The binary data is embedded into an audible signal by modulating a sine between two discreet frequencies at a specific time interval known as the baud rate.

To accomplish this modem-like sound, the randh opcode generates random noise at a user-specified frequency. The signal continues into the signal-to-binary converter, covered last week in Positive or Negative, creating a series of pulses consisting of 0s and 1s. These 0s and 1s are then mapped to the two desired frequency values by scaling then biasing them with the multiplication and addition opcodes. Finally, this signal is inserted into the frequency parameter of a sine wave oscillator, resulting in a sine wave whose frequency changes back and forth between two values at a timed interval determined by the randh at the top of the synthesizer graph.

Whether or not the results are authentic is kinda in the air, but isn’t necessarily the point. I’ve even played with parameters that have no basis in reality. The truth is, after the audible handshake a modem makes when connecting to another computer, I have no idea what the actual transmission sounds like and couldn’t find a reliable recording online. Based on what I’ve read, my design isn’t accurate, but close enough for sound design purposes. However, I’m thinking that designing a virtual modem simulator could be fun. Might have to pencil this project in for October.

Get the clean block diagram.

Get faux_modem.csd.

Positive or Negative

I recently ran into a situation in Csound in which I needed to know if a signal was positive or negative, and it had to work at the audio rate. I could have used if-else conditional statements, though these only work at k-rate, and would have required implementing a User-Defined Opcode utilizing the setksmps opcode. Perhaps I was lazy at the time, or in the mood for some simple hacking fun, but I decided to forgo this obvious solution for something else. And I wanted to do it without using conditionals.

Get positive_or_negative.csd.

The first thing I tried was using the > (greater than) opcode. In some other languages, an expression such as (0.8 > 0) will return a value of 1, while a (-0.8 > 0) will yield a 0. Unfortunately, this opcode is not designed this way in Csound. So I kept looking.

I eventually came up with a two opcode solution utilizing limit and ceil(). First, the signal passes through the limiter, clipping the waveform between the value range of 0.0 and 1.0. As the signal continues through the ceil opcode, any non-zero value becomes a 1.0, while a zero value remains 0.0.

For example, processing a sine wave through this configuration creates a unipolar square wave.

Now what? That’ll have to wait for another post.

Csound Group at SoundCloud

The Csound Group at SoundCloud is a collection of user submitted tracks that are created with the Csound computer music language.

At the time of posting this, there are 39 tracks listed. I’d like to see this number grow. So if you have anything of interest, whether it be a composition, improvisation, or patch, do add it to the group. Providing it’s built with Csound, of course.

Tempo-Synced LFO Wobble Bass

There is a simple, but highly useful hack I discovered a few years ago in which it’s possible to pass the current tempo from the score to an instrument using p3. And since dubstep is all the rage these days, I’ve designed a practical example in which a tempo-synced LFO modulates the cutoff of a low pass filter to create that “wobbly” bass effect.

Download the code here.

Passing the tempo of the score to an instrument is a fairly straight forward process. First, always set p3 to 1; This value of 1 is translated into seconds-per-beat (SPB) when the score is preprocessed. Second, use p4 for the desired duration. Third, in the instrument code, the following two lines obtain the tempo in SPB from p3 and then resets the duration of the instrument to the desired length:

ispb = p3 ; Seconds-per-beat. Must specify "1" in score
p3 = ispb * p4 ; Reset the duration

Now that we have the tempo, we can create a low frequeny oscillator that is synced to the tempo. To create that dubsteb wobble effect, p7 is designated as the division of the note. We need to take this p7 value and translate it into Hz utilizing the SPB value:

idivision = 1 / (p7 * ispb) ; Division of Wobble

Plugging this value in the frequency parameter of an oscillator yields a tempo-synced LFO. (some drift may occur over long periods of time)

klfo oscil 1, idivision, itable

Try changing the tempo in the score, and you’ll notice that the wobbles stay consistent relative to the tempo.

Csound Inspired Art by Michael Orr

By Michael Orr
Artist’s Website

Here is Michael’s profile from his August Art Opening:

“Just a few years before Michael Ladd Orr was born, Alvin Toffler introduced the concept of “future shock”. The concept, and the book of the same name, proposed we were entering an age when the future was arriving “prematurely” – when one could stay in one place and the culture around him/her would change so rapidly that it would have the same disorienting effect as simply moving to a foreign culture – when the rate of technological advancement would increase exponentially until the average person simply wouldn’t be able to keep up. Orr’s work often hints at these notions, whether he intends this or not is up for discussion. His art studio and tools are completely mobile at all times so he can create on the spot and in the moment. He may post a newly created image on the web or drop it in the mail. There is no time to dictate meaning, only to reinterpret the numerous images and impressions as they go whizzing by. Consumerist culture’s infinite supply of marketing images collides with arbitrary hand-drawn patterns. Ordinarily warm and vibrant yellows and oranges become jarring against nonsensical shapes and random household items. There is the sense of an artist trying to inject a touch of restraint and familiarity into a machine that is insatiable and alien. Collage becomes collision, but all the while a childlike kind of wonder and playfulness seeks to burst through the surface. Orr, 35, was born and raised in and around Atlanta, where he continues to live, work, and ply his craft.”


The event opcodes are some of my favorites in all of Csound. They are highly versatile in their application, as they can be used for algorithmically generating notes, transforming scores events, creating multiple interfaces to a single instrument, for triggering grains in a granular patch, etc. The list goes on and on.

Today’s example uses the event_i opcode to generate multiple score events from a single score event. The basic run down is this: Each instr 1 event generates 5 events for instr 2. Each of these 5 events are staggered in time, with the delay between notes set by the idelay parameter. The pitches also have a fixed half-step sequence of [0, 3, 7, 5, 10] in relation to the base pitch specified in the ipch parameter. Take a listen.

Download event_i.csd

Here are a couple of exercises to help get you going:

Exercise: 1

Create a new note pattern sequence. The last parameter of event_i is used to set the relative pitch. Set the value for x in ‘ipch * 2 ^ (x / 12)’.

Exercise: 2

Alter the rhythm. The third parameter controls how far into the future a particular event is trigger. The example uses integers, though using floats such 1.5 and 3.25 can completely transform the characteristics of the output.

Exercise: 3

Write a short etude with your modified instrument.

FM Synthesis with foscil

In the post “Low Frequency Oscillator,” an oscillator is used to modulate the frequency of a second oscillator; This is known as frequency modulation. By substituting a low frequency oscillator with a high frequency oscillator, we get Frequency modulation synthesis, which produces harmonically rich spectra with as few as two sine wave oscillators.

This technique was first applied to music by American composer John Chowning at Stanford University in 1967. FM was a real game changer. Since FM could produce a wide range of musically interesting sounds with very little computation, it helped pave the way for computer music to transition from a institutional commodity to a viable mainstream technology; Primitive digital devices could fiscally and audibly compete with physical and analog instruments. The Yamaha DX7, an FM synthesizer, was released in 1983 and became the “first commercially successful digital synthesizer.” If memory serves me correctly, I once heard that long before I was a student at The Berklee College of Music, their computer music program was FM Synthesis.

A Csound port of Chowning’s most famous musical work “Stria” is included with QuteCsound as one of the examples.

FM synthesis is a broad topic that would be impossible to cover in a single blog post. I encourage you to read chapter 9 of the Csound Book, “FM Synthesis and Morphing in Csound: from Percussion to Brass” by Brian Evens.

To get you started with some basic FM programming, I created an example CSD that uses the foscil opcode, a self contained FM synthesizer. You can immediately start plugging in various values to hear the results. Here’s a quick run down of the pfields for the instument:

  • p4 — Amplitude
  • p5 — Pitch
  • p6 — Carrier ratio. Changing this will generally affect the base frequency of the note played, as well as the timbre. This works in tandem with the modulator ratio.
  • p7 — Modulator ratio. Changing this will affect the timbre.
  • p8 — Index of modulation. This determines how much modulation is applied. A value of 0 will apply no modulation, resulting in a sine wave. The higher the value, the more spectra there is in the sound, producing a brighter timbre. The index is modulated by an envelope, so each note will start with an index supplied here, then fade to 0 by the time the note reaches the end.

[kml_flashembed movie="" width="550" height="81" wmode="transparent" /]Listen @ SoundCloud

Download foscil.csd here.

I personally have a strong association in which every time I hear a certain classes of FM sounds I can’t help but think of the Atari arcade classic Marble Madness. The sound chip inside the machine was produced by Yamaha and “is similar to a Yamaha DX7 synthesizer.” It was also the first Atari game to use it, which probably explains why I think of this particular game; I spent much of my childhood in various arcades.


Synthesis Fall 2010

Organizing Sounds: Sonata Form

When working with Csound, or in the computer music genre in general, organizing the sounds and grooves we create into finished compositions can sometimes be a bit tricky, or perhaps more difficult than when working with more traditional musical material. We don’ t always, if at all, deal with melodic, harmonic or rhythmic material in the classic, Western, sense of these terms. Therefore we sometimes lack a framework, or context within which to develop our material from ideas to complete pieces. In this series of articles we will discuss various approaches to composition and form specific to the context of electronic and computer music and explore various approaches to the organization of musical data.

Whether we think or ourselves as artists, composers, sound designers or researchers, we all at some point are confronted with this issue. But working with new media, and cutting edge techniques does not mean we should forget our legacy, and the issue of form is certainly not a new one. A tried and true classic is the Sonata form, which as we shall see, can be of tremendous help.

“I alter some things, eliminate and try again until I am satisfied. Then begins the mental working out of this material in its breadth, height and depth.” — Ludwig van Beethoven

I. The Sonata Form

The word Sonata comes from the Italian suonare, ‘ to sound’ , which implied music to be ‘ sounded’ through instruments, distinct from cantata, a piece to be sung. While it is difficult to establish with certainty when the Sonata form was invented, it became very popular in the 18th century as the predominant form used in instrumental music.

A sonata consists of three sections:

1. Exposition
2. Development
3. Recapitulation

Traditionally, composers will introduce two opposing or complimentary themes in the exposition, the first theme establishes the home key and a transitional bridge leads us to the second theme, often in the dominant key.

The development tends to vary in format and length, but is used to build tension, or interest by developing the themes in the exposition along with new material. Traditionally the development begins the key the exposition ended, only to go through a number of modulations while building up melodic complexity before going onto the last part of the development: the retransition, a section often in the dominant key intended to prepare us for the next section and the return to the tonic.

The recapitulation is a modified version of the exposition, which follows a similar structure, theme 1, bridge, theme 2 and coda, but some variations are introduced to differentiate it from the exposition. The main purpose of the recapitulation is to release the tension from the development and bring a sense of closure and continuity.

Or in condensed form:

AB – C – AB’

As it turns out, the sonata form is still very much alive today, even and perhaps especially in electronic music, which tends to put less of a focus on vocals and is therefore ideally suited to the form.

II. Case Study: Digitalism

Let’ s take a listen to the track ‘ Idealistic’ by the band Digitalism released on their album Idealism on May 9th 2007. The German duo has enjoyed worldwide success and this track is fairly representative of their work.

‘Idealistic’ by Digitalism:


It is also, a perfect example of the sonata form being used in electronic music.

1. Exposition

The track opens with a strong beat, supported by a steady guitar riff and soon after an abrasive bass line is introduced (bar 9 or 0:21 into the track) which goes on until 0:59, when a keyboard riff is introduced underneath the beat at first but alone soon thereafter during the breakdown at 1:06. After being stated a few times, vocals are then brought in at 1:25 at which point the main elements of the piece have been all introduced. By the time the next section begins, at 1:50, the band starts developing them.

2. Development

The development begins with a paired down version of the first riff, adding rhythmic complexity to the drum beat and bass line riff, until after being hinted at a few times before that point, the keyboard riff comes back in full at 2:22. The two themes are played together until 2:52, when a new variation is introduced, this time it is a play between the vocals and a simplified version of the keyboard riff, which goes on until 3:05 when they stop and only the beat and the bass holding a single note come in. This is the retransition, tension is built up also by introducing shortly after a busy hi-hat pattern in the main beat until 3:20 which marks the beginning of the recapitulation.

3. Recapitulation

The recapitulation begins with much like the exposition only this time the bass line comes in before the guitars, introduced at 3:35, supported by additional sound design elements. The keyboard riff is hinted at many times as a motif that comes in at the end of the four bar phrases until the end of the track, at 4:04 where everything drops out except for the guitar riff before stopping altogether at 4:13.

III. In Closing

There is a lot of information to be found on line on the Sonata form in great detail, and while I encourage you to look it up and find out as much as you can, we’ re not too concerned with the details here, as a lot of it simply wouldn’ t apply to what we’ re doing. The basic ideas behind the Sonata form and how themes are introduced and developed however is still as relevant today than it was 300 years ago, and provides us with a solid frame of reference to structure and organize our ideas. Keep in mind that you can apply this form not only to musical themes and ideas, but also to elements of a composition such as dynamics, timbral development, rhythmic elements etc… The possibilities are literally endless.

Synthesis Fall 2010