Using CSound to create a new Doorway to Creative Music.

Andrew R. Glendening

Denison University

 

Introduction

The arcane language of music notation and the complexities of music theory can present a substantial barrier to students who wish to experience music in a creative compositional context. By contrast, students who seek to experience painting, sculpting, or throwing a pot can jump into the creative phase of the art with a minimum of background. The student seeking to experience the process of musical creation is normally faced with the daunting task of learning the language of music and music theory prior to any creative attempts. The abstract medium of CSound can allow students without an extensive musical background to use their knowledge of mathematics, basic physics, and computers to create a doorway to the creative domain of music without extensive coursework in music theory.

CSound allows students to begin their musical adventure in the domain of math and physics with waves and harmonic functions creating simple oscillators using sine functions and non-calculus mathematics. Tuning systems and harmony can be expressed in term of mathematics, timbre as a function of waveform and audio spectra, rhythm as a simple function of time and articulation as a sound envelope. The aesthetic experience begins with the realization that simple oscillators and rigidly controlled performances lack sonic sophistication and the human elements of error and instability. By studying more sophisticated synthesis schemes, the student can experience first-hand the issues of change and expression.

Beyond the basic realm of additive synthesis, CSound can be used to manipulate sound files. Working with sound files affords the student an opportunity to incorporate his or her daily experience with sound into granular synthesis, allowing the student to think of music as a quantum analog or "cloud of sound." Music is then created by manipulating densities and centering frequencies to create whole tapestries of sound.

An added benefit of working in such an abstract medium allows for new ways of thinking about music. Sounds can be treated like paint colors to be mixed, scores can be based on algorithms, or visual images can be converted into sound. Such freedom to create sound also places the student squarely in the face of the issue of musical form. How do you keep the listener's interest as the work grows longer?

The basic idea is for the student to enter the creative musical process from a familiar world–in this case math and science–have an interesting creative experience, and hopefully be infected with a curiosity to know more about music. The process of studying music is then framed in terms that resonate with the student.

Overview of CSound

Introduced by Barry Vercoe in 1986, CSound is a unit generator based computer language for the direct synthesis of sound and is available as freeware for Mac OS, Windows, Unix, and Linux platforms. Source code, tutorials, scores, and utilities are all readily available on the web. Since CSound is not a real-time synthesizer, it can be run–albeit slowly–on older and slower hardware.

CSound uses two sub-languages for synthesis. The score file specifies the note list and the function tables (typically waveforms and envelopes). The orchestra file is used to construct the instruments from unit generators (Figure 1).

The basic orchestra file contains a header that describes the sample rate, control rate, the number of samples in each control period, and the number of output channels. The header is followed by instrument definition statements. Each instrument statement is nested between the "Instr #" and "endin" statements (Example 1). There is no limit to the number of instruments a file can contain.

 

Figure 1. A flowchart representing the CSound synthesis process.

 

 

Example 1. Basic Orchestra File

sr = 44100 ;sample rate = 44.1 kHz
kr = 4410 ;control rate
ksmps= 10 ;number of samples in a control period [sr/kr=ksmps]
nchnls= 1 ;number of channels of output
Instr 1
a1 oscil 10000, 440, 1
out a1
endin

The matching score file (Example 2) has a header with the function tables that describe the wavetables and envelopes for use by the orchestra and the instrument statements (note lists.)

Example 2. A basic score file.

f1 0 4096 10 1 ; Function table (f1) describes a simple sine wave *1
i1 0 5 ;instrument statement *2
e ; end of score

By adding more unit generators and parameters it becomes possible to control pitch, sound envelope, vibrato, and timbre of each note. Pedagogical applications include a variety of ways of experimenting with pitch, tuning systems, harmonics, interference, articulation, vibrato and timbre.

Experiments with Pitch

Pitch can be expressed in terms of frequency (Example 3), pitch class notation (Example 4), or octave decimal notation (i.e., fractional division of the octave, as shown in Example 5). It is a simple matter to construct programs to help students equate frequency with pitch, interference (beats), harmonics, and alternative tuning systems.

Example 3. Frequency in Hertz.

 

instr 1
a1 oscil p4, p5, 1
out a1
endin

; instrument start duration amp(p4) freq(p5)
i1 0 1 10000 440
i1 1 1 10000 220
i1 2 1 10000 880
i1 5 5 10000 440
i1 5 5 10000 443
e

Example 4. Pitch class notation.

instr 1
a1 oscil p4, cpspch(p5), 1
out a1
endin

; instrument start duration amp(p4) freq(p5)
i1 0 1 10000 8.00
i1 1 1 10000 8.01
i1 2 1 10000 8.02
i1 3 1 10000 8.03
i1 4 1 10000 8.04
i1 5 1 10000 8.05
i1 6 1 10000 8.06
i1 7 1 10000 8.07
i1 8 1 10000 8.08
i1 9 1 10000 8.09
i1 10 1 10000 8.10
i1 11 1 10000 8.11
i1 12 1 10000 9.00

e

Example 5. Octave decimal notation.

instr 1
a1 oscil p4, cpsoct(p5), 1
out a1
endin

; instrument start duration amp(p4) freq(p5)
i1 0 1 10000 8.00
i1 1 1 10000 8.01
i1 2 1 10000 8.02
i1 3 1 10000 8.03
i1 4 1 10000 8.04
i1 5 1 10000 8.05
i1 6 1 10000 8.06
i1 7 1 10000 8.07
i1 8 1 10000 8.08
i1 9 1 10000 8.09
i1 10 1 10000 8.10
i1 11 1 10000 8.11
i1 12 1 10000 9.00
e

   

 

Adding a unit generator to the amplitude parameter can control articulation (Example 6).

Example 6. A Simple sound envelope.

instr 1
k1 linen p4, p6, p3, p7
;linen creates an envelope of duration p3, peak amplitude p4, attack amplitude p6*p4, and release amplitude p7*p4.
a1 oscil k1, p5, 1
out a1
endin

; instr start duration amp(p4) freq(p5) attack(p6) release(p7)
i1 0 1.5 10000 440 .1 .9
i1 2 1.5 10000 440 .9 .1
i1 4 1.5 10000 440 .3 .7
i1 5 1.5 10000 440 .7 .3

Using a different synthesis scheme can modify timbre. Although advanced students might be able to write their own orchestra files, students can incorporate any of a large number of examples from the various websites.

Though the interface may seem rather daunting, there are several distinct advantages. Students are free to create music in a non-linear fashion. Adding notes to a score is an easy process since note statements do not need to be sequential … either by time or by instrument. Students do not need to understand traditional rhythmic notation since rhythm is expressed in decimal divisions of seconds. Pitch can be expressed without the traditional learning curves associated with intervals. Anyone who has taught music theory to non-majors can appreciate how hard students struggle with the uneven spacing of the keyboard and the difference between enharmonic intervals. CSound allows students the chance to work within mathematical systems of frequency, pitch class, or octave-decimal. The numerical expression of pitch also allows for mathematical manipulation either by algorithm or spreadsheet.

Articulation can be expressed simply as a sound envelope (a graph). Students must visualize the "shape" of a note. Timbral exploration can be as simple as downloading orchestra files from instrument collections. Audio examples can be easily created to demonstrate waveforms and functions, interference, harmonics, and tuning systems.

Above all, the abstract nature of CSound allows students to concentrate on the means of organizing sound.

Internet References

The CSound FrontPage at MIT

Links to download, music, examples, tutorials, utilities, books, etc.http://mitpress.mit.edu/e-books/csound/frontpage.html

The CSound Front Page

http://www.leeds.ac.uk/http://www-ks.rus.uni-stuttgart.de/people/schulz/fmusic/m

CCM at Mills College

http://www.mills.edu/LIFE/CCM/CCM.homepage.html

CalArts Public ftp Site

ftp://music.calarts.edu/pub/

Boulanger Tutorials at Vanderbilt

http://www.vanderbilt.edu/Blair/Courses/MUSC216/Boulanger/Boulanger.html

Amsterdam Collection of Instruments at Buffalo

http://wings.buffalo.edu/academic/department/AandL/music/pub/accci/index.html

CSound Manual in html

http://www.concentric.net/~Mingalls/software/csound/manual.html

 


Notes

*1 Each parameter in this statement provides important information. "f1" simply provides a number for the function table being created, "0" is the start time, "4096" is the number of points used (must be a power of 2 or 1 greater), "10" is the generating subroutine (chosen from a prescribed list"), and additional parameters allow the user to provide relative amplitudes to each partial. Here, "1" shows that there is only a single partial.
*2 play Instrument 1 beginning time 0 for 5 seconds