diskin2

One of the the easiest ways to play a sound file in Csound is to use the diskin2 opcode. With it, you can loop samples, modulate the pitch, apply filtering and ring modulation, etc. You go really far with just this mini-sampler. It does have its limitations. The approach of the Beat Mangler X example overcomes them, but requires a more advanced design, which we’ll cover at some later point. Though for many situations, you’ll find that diskin2 is the perfect solution.

The listening example uses the amen loop used in the Beat Mangler X example, though you can easily use your own mono files by making changes to the score. Diskin2 supports stereo files, though this example only works with mono samples.

Download diskin2.csd here.

Synthesis Fall 2010

Recontextualizing Ambient Music in Csound

For the first four weeks, we’ve covered much ground in terms of Csound basics and synthesizer fundamentals. Today, we begin transitioning into elements of computer music composition, starting with Recontextualizing Ambient Music in Csound by Kim Cascone.

There are few resources that approach introductory Csound compostion as elegantly as Cascone’s chapter from The Csound Book. In it, Cascone provides a bit of history and personal background, techniques for composing in a computer music environment, and six instrument designs. There is one particualr passage that I want to emphasize, as I think it can be of great use:

“I started studying instrument design by taking other composers’ instruments and drawing them out on paper in flowchart form. I took the scores and isolated a particular instrument by commenting out all other instruments except the one I wanted to listen to. I would then start to modify that instrument in various ways so I could hear the effect my code was having.”

Synthesis Fall 2010

Flat Drum


(click image for large version)

After two weeks of synthesizer fundamentals, now is a good time to do a quick review of what has been covered so far by putting these techniques into an actual working instrument. I designed Flat Drum for just this purpose. With the Flat Drum block diagram and code handy, go back and look through the material from the last couple of weeks. Which concepts are used in this instrument? Which are not? Are there any new opcodes? Do you see any familiar synthesizer design patterns? Is there anything in the code that you haven’t seen or don’t understand? etc.

Perhaps the most important thing you can do is to make a copy of the file, make changes to the values in the code, and listen to the results. Theory is useless without practice and hands-on experience.

Download flat_drum.csd here.

Synthesis Fall 2010

Random

The random number generator is perhaps one of the most useful and versatile tools in your synthesis tool kit. It can be used for everything from sound design to algorithmic composition. Beat Mangler X makes use of random by generating different splice and stutter patterns each time it is rendered. In Markov Experiment II, note nodes are chosen based on weighted odds, producing variations of a melody.

The listening example is fairly straight forward. The frequency of a triangle wave oscillator is modulated by a random unit generator that updates its value 4 times a second.

Download random.csd here.

“Any one who considers arithmetical methods of producing random digits is, of course, in a state of sin”John von Neumann (source)

Note. Computers don’t really produce random numbers, they produce pseudorandom numbers.

Synthesis Fall 2010

Detuned Oscillators

A quick and easy way to create a thicker sounding synthesizer patch is to use two oscillators whose frequencies are slightly out of tune. With a minute amount of detuning, you can hear a bit of flange in the voice, as various frequencies are phased in and out through phase cancellation and phase reenforcement. A bit more detuning, and it can create a chorus like effect. Excessive amounts of detuning will cause the listener to hear two separate voices rather than a unified voice. This all depends greatly on the audio source(s), as different waveforms and samples will get different mileage out of this classic technique.

Download detuned_oscillators.csd here.

Synthesis Fall 2010

Filters

A filter in audio synthesis is “a device or process that removes from a signal some unwanted component or feature”. Filters are used all over the place, and have the ability to fully transform audio in a variety of ways.

Csound comes with several types of filters, though this example focuses on the four most common: low pass, high pass, band pass and band reject. A low pass filter removes/attenuates frequencies above a specified cutoff frequency, while allowing frequencies below the cutoff to “pass through.” A high pass does the opposite, allowing the highs to pass, while removing/attenuating frequencies below the cutoff. A band pass filter can be thought of as a combination of the two, as is it removes high and low frequencies, leaving a band of frequencies at the cutoff. The band pass has an additional parameter; The band width of a band pass determines how large a band will be. A wide band will allow more frequency information to pass through, while a very narrow band will nearly produce a sine wave. A band reject filter is the opposite of a band pass, as it removes frequencies at the cutoff.

Download filters.csd here.

The listening example plays bursts of white noise through these filters with various settings to the cutoff or band width parameters of the filters. The first group of notes starts with a low pass fully open, with each new burst being filtered lower than the previous. The second group of bursts are processed with a high pass. The filter starts open, until only the high end is left.

The second two groups of notes maintain a cutoff of 440Hz, while the width of the bands are changed. The band pass starts open, then narrows until only a dirty sine is left in the signal. Due to the loss of gain from this process, I’ve used the balance opcode to make up for lost amplitude so you can hear it. Finally, the band reject removes frequencies at the cutoff, creating a hole in the white noise. In the last couple of notes, you can hear a distinction between the high noise and the low noise.

Synthesis Fall 2010

Pulse Wave and PWM

The square wave is one of the previously mentioned fundamental waveform. Though it also belongs to another class of waveforms: The pulse wave. The two defining characteristics of a pulse wave are its shape and its width. The shape refers to the fact that it has a flat top and flat bottom. The width of a pulse wave refers to the difference in size between the high level and the low level. A width of 50% means the upper and lower sides are equal, and is known as the square wave. Anything other than 50%, and it is no longer a square wave, but still qualifies as a pulse wave.

Different pulse widths produce difference timbres. A square wave produces a big round sound. As the pulse width moves towards 0% or 100%, it takes on a nasal-like quality. It personally reminds me of picking a string on a guitar; You get a bigger, rounder sound if you pick the middle of the string, and a much lighter, mid-rangy sound near the bridge. In the first part of the listening example, the width starts at 50% and is decremented 5% for each new note until it reaches a width of 5%.

Furthermore, the width can be modulated in time just as we’ve done with amplitude and frequency. This is known as Pulse Width Modulation. At the end of the listening example, the width is modulated by a triangle LFO, producing a timbre that changes over time.

Download pulse_wave.csd here.

We’ve also encountered a special variant of the pulse wave in the 2600 Synthesis example from week two; The polypulse wave.

Note. The vco2 opcode used to generate the pulse wave in this examples produces a band-limited version of the pulse wave. If you we’re to open up the example in an audio editor, the tops and and bottoms would not be flat. We’ll get into the concept of band-limited later.

Synthesis Fall 2010

Beat Mangler X

Beat Mangler X is an automatic splice and stutter instrument that generates variations of a looped sample. This instrument is a descendant of the beat mangler Jean-Luc and I designed back in 2007. We’ve created several versions since, with today’s example having a reduced set of features compared to its ancestors. It supports random splicing, stereo stuttering and splice enveloping. The randomness of the instrument is controlled in the score; The user sets the odds that a random splice or stutter will occur. Though it shares many qualities of the built-in opcodes bbcutm and bbcuts, it definitely has its own personality. Since it is also coded in Csound, the internals of the instrument are exposed, and can easily be modified. For example, adding random pitch control.

There are two main principles used to drive the mangler. 1) Using a phasor to read through a stored loop in memory. 2) Using random for musical purposes. These will be covered this week as we continue with more synthesizer fundamentals tutorials.

Download beat_mangler_x.csd here.

For the source material of the audio example, we used the infamous Amen Break, “a brief drum solo performed in 1969 by Gregory Cylvester “G. C.” Coleman in the song “Amen, Brother” performed by the 1960s funk and soul outfit The Winstons.” You can acquire the loop in Step 1 of the Audio Tuts article Make a Crazy Drum and Bass Breakbeat by Slicing and Dicing in FL Studio. The loop itself has a fascinating history, which the following video makes apparent:

[youtube]http://www.youtube.com/watch?v=5SaFTm2bcac&feature=player_embedded [/youtube]

If you want to play with the instrument, which I highly recommend, try modifying the csd file in the following ways and see how far you can get: Load in a different loop, change the tempo, and play with the various p-fields. And of course, ask questions if you have any.

Synthesis Fall 2010

Low Frequency Oscillator

Much like the envelope, the low frequency oscillator (LFO) is a synthesis fundamental utilized for changing sound parameters over time. A LFO is basically the same thing as an audio oscillator, with the biggest difference is that they’re designed to run at a much smaller frequency range. The range is generally below the limits of human hearing, 0Hz to 20Hz. Though many analog and digital LFOs usually oscillate at higher frequencies. There are generally no restrictions for using an audio oscillator as an LFO.

Today’s example uses an LFO to modulate the frequency of a square wave oscillator. I use three different waveforms (triangle, sawtooth, square) so that you can hear how their shapes affect the sound. For example, at the lower frequencies, the triangle wave causes the pitch of the audio to smoothly go up and down while the square produces a trill-like quality.

In the listening example, you’ll hear everything from vibrato, to trills, to classic sci-fi lasers to something straight out of Pac-Man.

Download low_frequency_oscillator.csd here.

Synthesis Fall 2010