Welcome to CodeHop

Welcome to CodeHop.

I’m consolidating all three of my former WordPress blogs into one, and broadening the scope to include all things that relate to code, art and music.

It’ll take some time for me to fully get all the details smoothed out, such as building a custom theme and fixing 400 imported posts. Though content is what’s important, so no point in waiting.

The existing 400 posts come from the following sources:

– Jake

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 Audio Programming Book

“This is not just a book; it is an encyclopedia of mathematical and programming techniques for audio signal processing. It is an encyclopedia focused on the future, but built upon the massive foundations of past mathematical, signal processing, and programming sciences.” – Max Mathews.

The Audio Programming Book, edited by Richard Boulanger and Victor Lazzarini and published by MIT Press, showed up at my doorstep last friday. Since receiving my copy, I’ve been thumbing through the pages at random, reading every little excerpt that caught my eye, while taking hard long looks at the various C programming examples. My initial impression, wow.

I suspect I’ll be covering some C programming here in the near future.


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.


This is a block diagram of all recent activity of this blog. Though seriously, I’ve been wicked busy lately, and things are just now starting to slow down just enough so that I can pick up where we left off with Jean-Luc’s NYU Synthesis class. Jean-Luc and I been in perpetual contact the whole time, and we’ve devised a plan to make up for the missing weeks. Starting tomorrow, I’ll start blogging again about the current topics being covered in class. Once the semester is over, JL and I plan to go back and fill in the blanks. There is still plenty of Csound information in the works.

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="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F6219223&show_comments=true&auto_play=false&color=cc0000" 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