Csound Tutorial/Class Notes

by Jon Christopher Nelson

The following tutorial is designed for use by beginning Csound programmers working on the Macintosh platform. The tutorials are designed to introduce the various Csound opcodes in the order they are most likely to be encountered. This tutorial attempts to be thorough by incorporating almost all of the Csound opcodes in example instruments by the conclusion of the tutorial. Each of the tutorials includes a brief outline of the prototypes used (opcodes, function table generators, arguments, etc.) followed by an example instrument that uses the prototypes. The language of this tutorial is terse as it is meant to be used as class notes that are embellished through lectures and demonstrations. This tutorial is also meant to be used in conjunction with the Csound manual, which contains more information about each of the prototypes. The tutorial concludes with several appendixes containing information regarding Csound on the internet as well as speech synthesis formant tables and conversion tables.

Contents:

I. Overview 3

A. Structure of Csound 3

B. What you need to run Csound on your Mac 3

II. Csound Basics 4

A. Starting Csound—the select .orc and .sco window 4

B. Setting Your Directories—sf, analysis, sndin 4

C. Csound Unix Commands 4

D. Diagnostic Messages During Performance Time 4

III. Basic Orchestra and Score Syntax 5

A. The Csound Orchestra File 5

1. headers 5

2. instrument blocks 5

3. a, k, i, and g prefixes (also x prefixes in the manual) 5

B. The Csound Score File 6

1. function tables 6

2. tempo, section, and other specifiers 6

3. note information code 6

4. "e" 6

IV. Orchestra and Score Design 7

A. simple oscillator—oscil and out (.orc) 7

B. drawing wavetables—Gen 10 and 9 (.sco) 8

C. p-fields—using .sco parameters to drive .orc variables (.orc/.sco) 9

D. converters and math functions 10

1. pitch—cps, oct, and pch (.orc) 10

2. amplitude—dB and amp (.orc) 10

3. value—math in Csound (.orc) 10

4. MIDI 10

E. creating complex argument inputs—line and expon (.orc) 11

[krate pitch sweep and stereo panning]

F. adding envelopes—linseg, expseg, linen, and envlpx (.orc) 12

G. soundfile manipulation—soundin, loscil (.orc) and Gen 1 (.sco) 13

H. more function tables—Gen 5, 7, etc. (.sco) 14

I. vibrato (FM) and tremelo (AM)— (.orc) 15

J. more on FM—foscil (.orc) 17

K. alternate oscillators and waveshaping—phasor, table, and oscil1 (.orc) 18

L. pulse train generators—buzz and gbuzz (.orc) 20

M. filters (subtractive synth)—tone, atone, reson, areson, and balance (orc) 21

N. speech synthesis—fof (.orc) 22

O. Karplus-Strong algorithm—pluck (.orc) 23

P. using random—rand (.orc) 24

Q. granular synthesis— (.orc) 25

R. program control with conditionals—if-then, etc. (.orc) 26

S. more processing—reverb, alpass, comb, gain, and rms (.orc) 27

T. soundfile manipulation instruments— (.orc) 28

U. using globals— (.orc) 29

V. resynthesis using analysis files—pvoc, lpc, and adsyn (.orc) 30

W. more program control—init, reinit, rireturn, etc. (.orc)

X. odds and ends—upsamp, downsamp, delay, etc. (.orc) 33

V. Score Generation 35

Csound, Internet, and More Appendix A

Tables for Speech Synthesis Appendix B

Other Useful Conversion Tables Appendix C

Nelson Csound Notes

I. Overview

A. Structure of Csound

1. Csound Program—generates a soundfile from two input files—the

orchestra and score files

2. Orchestra File—a text file containing instrument descriptions much like

a patch on a synthesizer (called .orc files hereafter)

3. Score File—a text file containing instructions sent to the orchestra much

like a MIDI sequence file but much more flexible and can contain more

information (called .sco files hereafter)

B. What you need to run Csound

1. Csound

2. a text editor that can save ascii files (used to generate and edit the .orc

and .sco files)

3. a Digital Audio Converter (DAC) such as the the Digidesign or SoundBlaster sound cards or the internal

DAC on your computer

II. Csound Basics

A. Starting Csound

Upon startup, Csound opens the select .orc and .sco window (Macintosh Version). At this point you can simply select your .orc and .sco files and name your soundfile (if you do not like the default Csound may come up with) and click ok to generate a soundfile. Within this window you may also name a listing file in which to store all of the diagnostic messages. You may also choose a MIDI file to read as a score file. The smp format button allows selection of 8-bit int or u law, 16-bit int, or 32-bit int or floating pt. The options button allows you to select options during performance time concerning screen (or listing file) messages, table graphics, sound output, etc.

B. Setting Your Directories

If you are not using Csound exclusively, you will need to set up your Csound directories before actually creating your soundfile. To do this, select cancel in the choose orchestra and score window and then select the following in the csound menu:

sf directory—where to place your sound files

sound sample directory—where to find soundfiles you will access

sound analysis directory—where to find analysis files you are using

save settings—or you will have to reset them each time you run Csound

during your session

C. Csound Unix Commands

If you want to create analysis files you must select "enter command line" from the csound menu. Then you can enter the lpcanal, hetro, and pvanal commands followed by the desired flags and file names. One can also run csound using unix commands. This may be useful if you want to use the various Csound flags. The flags and typical Csound command line are as follows:

csound [flags] name.orc name.sco

-I,-n sound output inhibitors

-iName,-oName sound I/O filenames

-bNumb, -h audio buffer & header control

-c, -a, -u, -s, -1, -f audio output formats

-v, -mNumb, -d, -g message & display levels

-S, -xName score formats

-B, -NName, -MName realtime event control

Some of these flags can also be selected in the options box in the Macintosh version. However, the -x flag for extracting parts of a score may be useful to know about. See the manual for more information on the extract feature of Csound.

D. Diagnostic Messages During Performance Time

running Csound does the following:

loads your orc and sco

sorts your sco (the score does not have to be in chronological order)

compiles your orc and aborts the performance if any errors are found in your orc syntax

creates an audio address

creates a window for viewing graphic function table displays (you must

position/size the window click mouse at this point for Csound to continue)

displays diagnostic messages concerning all score events as follows:

displays a line each time an instrument in the orc is turned on

displays a line for each event (note on/offs) that looks like this:

B 4.000 .. 6.000 T 3.000 TT 3.000 M 7929. 7929.

beat location in actual time total time max amp for each channel

orig. sco (same as T

unless using sections)

displays any other error messages—samples out of range, pfield inconsistencies,

cancelled notes (if it could not access a soundfile or something)

displays and end of score line with the max amp for the entire file (you must

click to continue, which actually quits the program)

III. Basic Orchestra and Score Syntax

Both the .orc and .sco files must follow certain syntactical rules in order to function properly. Csound is very unforgiving so you can have difficulty with simple typos and other easy errors. However, Csound will give you diagnostic messages which will help you to isolate problems in your .orc files.

A. The Csound Orchestra File

Every orc file must begin with a header block followed by individual instrument blocks. Within each instrument block, each line of code must begin with one of four possible prefixes. Anything following a semicolon (;) on a line of code is disregarded by Csound—use semicolons for comments to keep everything straight in your orc files.

1. headers

sr=44100 ;sets the sample rate to any value (44100 here) but I would recommend

;using a value the DAC can play if you want to hear the files

kr=4410 ;sets the control rate to any value (4410 here) the control rate should be

;used for calculations that do not need to be performed at the audio rate in

;order to speed up the processing

ksmps=10 ;sr/kr (can be omitted in the orc but must be an integer)

nchnls=2 ;number of channels can be 1, 2, or 4 (if your DAC can handle 4 channels)

2. instrument blocks

instr # ;signifies the beginning of an instrument—each must have a unique #

actual instrument code—each line is as follows:

label: result opcode argument1, argument2, ... ; comments

The label is optional and identifies the basic statement that follows as the potential

target of a go-to operation. A label has no effect on the statement per se. The remainder

(result, opcode, and arguments) form the basic statement. This also is optional, i.e. a

line may have only a label or comment or be entirely blank. If present, the basic

statement must be complete on one line (which can continue as long as you do not hit the

carriage return). Note that Csound reads top-down and right-left (args, opcode, result)

endin ;signifies the end of an instrument block

3. a, k, i, and g prefixes

Every result in the actual instrument code must begin with the prefixes a, k, i, or g:

a=an audio rate calculation—calculated once per sample

k=a control rate calculation—calculated once per control period

i=an init rate calculation—calculated once at the start of the instrument

g=a global output—this is used in conjunction with the other prefixes (ie. ga,

gk, or gi) and can be read and used by other instruments

You will also see x prefixes in the manual. X simply indicates that the prefix can be a, k, or i rate result. The label p# can be used anywhere in your orc. p# simply refers to a score parameter (ie. p5 refers to the fifth parameter in the line of code in the score)

 

B. The Csound Score File

Every sco file typically begins with function tables, and is followed by other specifiers and code containing note information. Every score must have a closing e (end of score) statement. As in orc files, anything following a semicolon (;) on a line of code is disregarded by Csound—use semicolons for comments to keep everything straight in your sco files. The basic format of a standard numeric score statement is:

opcode p1 p2 p3 p4... ;comments

Legal opcodes are f, i, a, t, s, and e:

f invokes the generation of a function table

i turns on an instrument in the orchestra

a an advance statement

t indicates a tempo map

s divides the score into sections

e indicates the end of a score

p1, p2, p3, etc... are parameter fields (pfields). Each contains a floating point number comprised of an optional sign, digits, and an optional decimal point.Continuation lines are permitted. If the first printing character of a new scoreline is not an opcode, that line will be regarded as a continuation of the pfields from the previous scoreline.

1. function tables

These each begin with the prefix f and call on function table generating subroutines. The basic format is as follows:

f1 0 512 10 1

f# start time size Gen# Gen subroutine specific parameters

The table size must be a power of 2 or a power of 2 + 1

2. note information code

These each begin with the prefix i and are used to turn notes on and off. The basic format is as follows:

i1 0 3 x x x x

instr# start time duration user defined parameters

(or beat) (#beats)

3. tempo, section, and other specifiers

t 0 tempoA beatB tempoB beatC tempoC

This opcode sets the starting tempo and then draws line segments

between the set tempi. Without this opcode, the default sco tempo is 60.

s # marks the end of section #, can then begin with beat 0 again in the score

a 0 beat to begin advance duration of advance in beats

This statement allows the beat count within a score section to be

advanced without generating intervening sound samples. This can be of

use when a score section is incomplete and you do not wish to generate

and listen to a lot of silence.

4. e—must appear at the end of every score

IV. Orchestra and Score Design

A. simple oscillatoroscil and out (.orc)

PROTOTYPES USED:

k/ar oscil k/xamp, k/xcps, ifn[, iphs]

k/ar oscili k/xamp, k/xcps, ifn[, iphs]

out asig

outs asig1, asig2

outs1 asig

outs2 asig

outq asig1, asig2, asig3, asig4

outq1 asig

outq2 asig

outq3 asig

outq4 asig

k/xamp=control/any rate amplitude

k/xcps=control/any rate frequency

ifn=number of the function table containing the waveshape

iphs=initial phase of the sampling, expressed as a fraction of a cycle (0-1)

EXAMPLE: test tone generator orc

sr=44100 ;sampling rate

kr=4410 ;control rate

ksmps=10 ;samples per control period (optional)

nchnls=2 ;number of channels

instr 1 ;simple oscillator

a1 oscil 32000,440,1 ;test tone—amp=32000, cps=440, and the wave

outs a1,a1 ;function table in the score is #1

endin

 

B. drawing wavetablesGen 10 and 9 (.sco)

PROTOTYPES USED:

f # time size 9 pna stra phsa [pnb strb phsb . . .]

f # time size 10 str1 [str2 str3 . . .]

pn=partial number

str=relative strength of the partial

phs=phase of the partial, expressed in degrees (0-360)

EXAMPLE: sco for the test tone generator above

;sine wave function table for the oscillator to read

f1 0 8192 10 1 ;fundamental strength of 1

;now turn the instrument on

i1 0 10 ;used with the orc above, this creates a 10 second test tone

e ;once again, every sco must conclude with this end statement

EXAMPLE: other function tables using gen 9 or 10

;cosine wave function table

f2 0 8192 9 1 1 90 ;fundamental strength of 1, phase at 90°

;a square wave—odd harmonics at a strength of 1/harmonic#

f 3 0 513 10 1 0 .333 0 .2 0 .143 0 .111 0 .0909 0 .077 0 .0666 0 .0588 0 .0526

;a sawtooth wave—all harmonics at a strength of 1/harmonic#

f 4 0 513 10 1 .5 .333 .25 .2 .166 .143 .125 .111 .1 .0909 .0833 .077 .071 .0666 .0625 .0588 .055 .0526 .05

;a triangle wave—odd harmonics at a strength of 1/harmonic#squared with

;alternating phases of 0 180 0 180. . .

f5 0 513 9 1 1 0 3 .111 180 5 .04 0 7 .0204 180 9 .01234 0 11 .00826 180 13 .005917 0

;half of a sine

f 11 0 513 9 .5 1 0

;sine with varied strength to partials—quasi square wave

f7 0 513 10 1 .2 0 .06 0 .4

;sine with detuned partials

f8 0 513 9 1 1 0 1.643 .38 30 2.001 .7 0 3.98 .5 90

 

C. p-fields—using .sco parameters to drive .orc variables (.orc/.sco)

;orc headers and sco function tables are left out to save space in the following examples

EXAMPLE: using p-fields to control the amp, cps, and function table # from the sco

instr 2 ;simple oscillator

a1 oscil p5,p4,p6 ;p5=amp, p4=cps, and p6=function table number

outs a1,a1 ;function table in the score is #1

endin

;p1 p2 p3 p4 p5 p6 . . . (as desired)

i2 0 1 440 32000 1

i2 + 1 < pp5 2

i2 + 1 < < 3

i2 + 1 < < <

i2 + 1 < < 5

i2 + 1 < < 6

i2 + 1 < < 7

i2 + 1 < < 8

i2 + 1 < < np3

i2 + 1 880 2000 1

e

+=carry—adds the preceding p3 value to p2, allowing a stream of consecutive notes—

can only be used in p2

<=ramp—derives values by linear interpolation between the numbers at the

beginning and end of the ramp figures—cannot be used in p1, p2, or p3

pp#=previous p—looks in the preceding line of code (for the same i# only) in the p#

specified to determine its value—cannot be used in p1, p2, or p3 but can refer to

them

np#=next p—looks in the next line of code (for the same i# only) in the p# specified

to determine its value—cannot be used in p1, p2, or p3 but can refer to them

D. converters and math functions

1. pitch—cps, oct, and pch (.orc)

PROTOTYPES USED:

octpch(pch) (i/kr args only) ;converts octave.pitch-class into octave.decimal

pchoct(oct) " " ;converts octave.decimal into octave.pitch-class

cpspch(pch) " " ;converts octave.pitch-class into cycles per second

octcps(cps) " " ;converts cycles per second into octave.decimal

cpsoct(oct) (xr) ;converts octave.decimal into cycles per second

2. amplitude—dB and amp (.orc)

PROTOTYPES USED:

dbamp(x) (no rate restriction) ;converts raw amplitude into dB

ampdb(x) " " ;converts dB into raw amplitude

3. value—math in Csound (.orc)

PROTOTYPES USED:

ftlen(x) (ir args only) ;returns length of function table x

int(x) (i/kr args only) ;returns integer part of x

frac(x) " " ;returns fractional part of x

i(x) (kr args only) ;returns an init-type equivalent of x

abs(x) (xr) ;returns the absolute value of x

exp(x) " " ;returns e raised to the xth power

log(x) " " ;returns the natural log of x (x>0)

sqrt(x) " " ;returns the square root of x (x>0)

sin(x) " " ;returns the sine of x (x in radians)

cos(x) " " ;returns the cosine of x (x in radians)

The following 6 math functions are paired in order from weakest to strongest in terms of operation precedence. When the operations share the same strength, Csound calculates them in right to left order. Parenthesis may also be used to force operation order.

- a

+ a

a && b logical AND

a || b logical OR

a + b simply adds a and b

a - b subtracts b from a

a * b multiplies a and b

a / b divides a by b

4. MIDI converters (.orc)—for use with the real-time versions of Csound.

ival notnum

ival veloc

icps cpsmidi ;converts note number to cps

i/kcps cpsmidib ;converts note number to cps at k-rate

ioct octmidi ;converts note number to oct

i/koct octmidib ;converts note number to oct at k-rate

ipch pchmidi ;converts note number to pch

i/kpch pchmidib ;converts note number to pch at k-rate

iamp ampmidi iscal[,ifn] ;converts velocity to amp according to the scaling factor iscal

kaft aftouch iscal ;converts after touch to a scaled k-rate value

kchpr chpress iscal ;converts channel pressure to a scaled k-rate value

kbend pchbend iscal ;converts pitch bend into pch according to the scaling factor iscal

i/kval midictrl inum ;converts controller number "inum" into an i/k-rate value

E. creating complex argument inputsline and expon (.orc)

[krate pitch sweep and stereo panning]

PROTOTYPES USED:

k/ar line ia, idur1, ib

k/ar expon ia, idur1, ib

;note that exponential curves can only incorporate values greater than 0 (.001 is ok)

EXAMPLE: oscillator with both a glissando up an octave and exponential panning

instr 3 ;p4-5=pchi-f p6=dB p7=fn#

;create a line segment between the desired initial and final pitches

icps1=cpspch(p4) ;use = to assign values—here, p4 is converted from pch to cps and

icps2=cpspch(p5) ;assigned to icps1 which can then be used later in the orc

kgliss line icps1,p3,icps2

;make the sound without the panning

iamp=ampdB(p6)

a1 oscil iamp,kgliss,p7 ;;;a1 oscil ampdB(p6),kgliss,p7—would work but it

;is computationally more efficient to calculate ampdB(p6) as an

;initial argument rather than calculate it with each sample

;pan from left to right with an amplitude multiplier for each channel

kleft expon 1,p3,.001

kright=1-kleft

outs a1*kleft,a1*kright

endin

;p1 p2 p3 p4 p5 p6 p7

i3 0 2 8.00 9.00 80 1

e

 

F. adding envelopeslinseg, expseg, linen, and envlpx (.orc)

PROTOTYPES USED:

k/ar linseg ia, idur1, ib[, idur2, ic[...]]

k/ar expseg ia, idur1, ib[, idur2, ic[...]]

k/ar linen k/xamp, irise, idur, idec

k/ar envlpx k/xamp, irise, idur, idec, ifn, iatss, iatdec[, ixmod]

EXAMPLE: add an envelope to the same instrument to avoid the nasty discontinuities at the beginning and end of notes

instr 4 ;p4-5=pchi-f p6=dB p7=fn#

icps1=cpspch(p4)

icps2=cpspch(p5)

kgliss line icps1,p3,icps2

iamp=ampdB(p6)

kenv linen iamp,.05,p3,.05 ;all durations can be expressed as a constant time value

;or as a p3-dependent variable (ie. p3/2 or p3*.05)

a1 oscil kenv,kgliss,p7

kleft expon 1,p3,.001

kright=1-kleft

outs a1*kleft,a1*kright

endin

;p1 p2 p3 p4 p5 p6 p7

i4 0 2 8.00 9.00 80 1

e

EXAMPLE: other possible envelopes to insert in place of the kenv above

kenv linseg 0,.05,1,p3-.2,.85,.15,0

kenv expseg .00001,p3/2,1,(p3*.5)-.05,.5,.05,.00001

kenv envlpx iamp,.08,p3,.12,10,.75,.0001,-.5

OR

k1 linseg 0,.15,1,p3-.3,.8,.15,0

k2 expseg .0001,.15,1,p3-.3,.75,.15,.0001

k3 expseg .0001,.15,1,p3-.15,1

kenv=k1*k2*k3*iamp

 

G. soundfile manipulationsoundin, loscil (.orc) and Gen 1 (.sco)

PROTOTYPES USED:

a1 soundin ifilno[, iskptim][, iformat] ;mono

a1, a2 soundin ifilno[, iskptim][, iformat] ;stereo

a1, a2, a3, a4 soundin ifilno[, iskptim][, iformat] ;quad

a1 loscil xamp,kcps,ifn,ibas[,imod1,ibeg1,iend1][,imod2,ibeg2,iend2]

a/kr linenr x/kamp, irise, idec, iatdec ;decays during extended time for use with loscil

f# time size 1 filcod skiptime format

The soundin unit generator reads soundfiles into your orc instrument where the soundfile can be manipulated. Loscil is a special looping oscillator that reads through a sampled sound which has been read into a function table using Gen1. The soundin arguments are as follows:

filno=# of the sound file entitled soundin.#—can also list the entire name in double

quotes ie. "great sound file"

skptim=skip time into the file—begin reading the file at skptim-seconds into the file

format=sound file format (shouldn't need—Csound reads the sound file header)

The loscil opcode arguments are as follows:

amp=amplitude factor

cps=rate at which to sample the function table

fn=function table number (of a Gen1 function table containing a sampled sound)

bas=base cps of the sampled sound (must have this to function)

mod1-2=looping mode for the optional sustain and release loops (1=normal,

2=forward-backward, 0=no looping)

beg1-2 and end1-2=beginning and ending loop points (in sample frames)

The linenr opcode is similar to linen but differs in that the specified decay time (idec) extends the note in time. This opcode was designed to be used with loscil so that your sampled sounds can decay beyond the final loop point. The decay is an exponential curve which approaches the final amp value specified by iatdec.

The Gen 1 arguments are as follows:

filcod=# of sound file entitled soundin.#—can also list the entire name in double

quotes ie. "great sound file"

skiptime=skip time into the file

format=audio data file format (4=AIFF)—optional as the soundfile header is read

EXAMPLE: simple soundin instrument

instr 26 ;converts mono files to stereo p4=sndin# p5=skiptime p6=chnl1%

i1=p6

i2=1-p6

a1 soundin p4,p5

a1=a1*i1

a2=a1*i2

outs a1,a2

endin

instr 6 ;simple loscil instrument p4-5=pchlow-high p6=peak amplitude

ilow=cpspch(p4)

ihigh=cpspch(p5)

kenv linenr p6,.05,.25,.001 ;envelope with .05" attack time and .25" decay down to .001 amp

kcps linseg ilow,p3*.1,ihigh,p3*.9,ilow ;gliss up for 1/10th of duration then gliss back down

a1 loscil kenv,kcps,43,440,0,22050,44100 ;plays soundfile in function table #43 and loops it with a

outs a1,a1 ;normal loop with .5 second start and 1 second end point

endin ;note that loop points are expressed as sample numbers

H. more function tablesGen 5, 7, etc. (.sco)

PROTOTYPES USED: (Generator numbers in bold typeface)

line segments, exponential segments, and cubic spline curves

f # time size 7 a n1 b n2 c n3 . . .

f # time size 5 a n1 b n2 c n3 . . .

f # time size 8 a n1 b n2 c n3 . . .

In each of the above:

a, b, c, . . .=ordinate values (for Gen 5 they must be non-0 and alike in sign)

n1, n2, n3 . . .=segment length expressed as number of table points

normalizing table

f # time size 4 source# sourcemode

source#=number of the function table to be normalized

sourcemode=how to read the source table: 0=l-r, non-0=mid-out by pairs (bipolar)

cubic polynomial segments

f # time size 6 a n1 b n2 c n3 . . .

a, c, e, . . .=maxima or minima of successive segments

b, d, f, . . .=ordinate values at points of inflexion at the ends of successive segments

n1, n2, n3, . . .=length between specified points expressed as number of table points

harmonic partials with DC offset option

f # time size 19 pna stra phsa dcoa pnb strb phsb dcob . . .

pn=partial number str=relative partial strength phs=partial phase dco=DC offset

additive set of cosine partials (pulse train)

f # time size 11 nh lh r

nh=number of harmonics

lh=lowest harmonic number

r=multiplier in amplitude coefficient series (default=1—can be +, -, non-integer)

polynomial generators (Chebyshev, etc.) for use in waveshaping

f # time size 3 xval1 xval2 c0 c1 c2 . . . . cn

xval1, xval2=left and right x values over which the polynomial is defined

c0, c1, c2 . . . cn=coefficients of the nth-order polynomial (+ or - real numbers)

f # time size 13 xint xamp h0 h1 h2 . . .

f # time size 14 xint xamp h0 h1 h2 . . .

f # time size 15 xint xamp h0 phs0 h1 phs1 h2 phs2 . . .

xint=left (-xint) and right (+xint) x values over which the polynomial is defined

xamp=amp scaling factor of the sine expected to produce the following spectrum:

h0, h1, h2 . . .=relative strength of partials 0 (DC), 1 (fund.), 2, . . . when a sine of amp

xamp*int(size/2)7xint is waveshaped using this function table

phs0, phs1, phs2 . . .=phase of the desired harmonics

Gen 3 draws a polynomial in x over a fixed interval with specified coefficients

Gen 13 and 14 use Chebyshev (first and second kind) coefficients to generate

polynomial functions—(they call on Gen 3 to make the table)

Gen 15 also calls on Gen 3 to draw two polynomial functions in tables f # and F #+1—

Gen 15 is used in phase quadrature operations

Bessel function generator for use in amp-modulated FM

f # time size -12 xint

xint=right x value over which the function is drawn (0 to +xint)

step function generator from x-y pairs (for mapping sets of data)

f # time size 17 x1 a x2 b x3 c . . .

x1, x2, x3 . . .=ascending x-ordinate values

a, b, c . . .=held y values

transfers value data from up to 150 p-fields into a table

f # time size 2 v1 v2 v3 v4 . . .v150

v=value

 

I. vibrato (FM) and tremelo (AM)— (.orc)

instr 7 ;simple oscillator with vibrato—p4=amp, p5=fn#, p6=pch

ipch=cpspch(p6)

kamp line p4,p3,p4*.8

kenv linen kamp,.07,p3,.1

kvib oscil ipch*.05,5,1 ;vib of 1/20 cps at 5x/sec using a sine in f1

a1 oscil kenv,ipch+kvib,p5

out a1

endin

instr 8 ;simple FM—p4=amp, p5=fn#, p6=pch

ipch=cpspch(p6)

kamp line p4,p3,p4*.8

kenv linen kamp,.07,p3,.1

kpwr line 0,p3,10000

afm oscil kpwr,ipch*1.5,1 ;FM modulator at 1.5*f with a strength of kpwr

a1 oscil kenv,ipch+afm,p5

out a1

endin

instr 9 ;simple oscillator with tremolo—p4=amp, p5=fn#, p6=pch

ipch=cpspch(p6)

kamp line p4,p3,p4*.8

kenv linen kamp,.07,p3,.1

ktrm oscil p4*.25,3,1 ;tremolo of 1/4 amp at 3x/sec using a sine in f1

a1 oscil kenv+ktrm,ipch,p5

out a1

endin

instr 10 ;simple AM—p4=amp, p5=fn#, p6=pch

ipch=cpspch(p6)

kamp line p4,p3,p4*.8

kenv linen kamp,.07,p3,.1

ksweep line ipch*2,p3,8673

am oscil p4*.25,ksweep,1 ;AM modulator sweeps from ipch*2 to 8000

a1 oscil kenv+am,ipch,p5

out a1

endin

 

instr 11 ;strings?? p4-5=pchi-f p6=amp

i1 = cpspch(p4)

i2 = cpspch(p5)

k1 linseg i1,p3*.66,i1,p3*.34,i2

k2 envlpx p6,.07,p3,.1,10,.5,.01,.25

k10 oscil 8,5.5,1

k11 oscil 4,5,1

k12 oscil 7,7,1

k13 oscil 5,6.1,1

a1 oscili .2,(k1+k10)+1,1

a2 oscili .2,(k1+k11)-2,2

a3 oscili .2,(k1+k12)+3,5

a4 oscili .2,(k1+k13),6

a5 oscili .2,k1,7

a1 = (a1+a2+a3+a4+a5)*k2

out a1

endin

f1 0 513 10 1 ;sine

f2 0 513 7 0 56 1 175 1 51 -1 175 -1 56 0 ;quasi square wave

f5 0 513 10 1 .2 0 .06 0 .4 ;altered sine

f6 0 513 9 1 1 0 1.643 .38 30 2.001 .7 0 3.98 .5 90 ;detuned partials

f7 0 513 7 0 400 1 33 -.5 40 0 20 -1 20 0 ;quasi saw

f10 0 257 7 0 130 .4 17 .37 25 .5 10 .45 30 .73 10 .6 38 1 ;envlpx

i11 0 4 8.1 8.1 30000 0

e

 

J. more on FMfoscil (.orc)

PROTOTYPES USED:

ar foscil xamp, kcps, kcar, kmod, kndx, ifn[, iphs]

ar foscili xamp, kcps, kcar, kmod, kndx, ifn[, iphs]

xamp=amplitude

kcps=fundamental frequency

kcar=cps factor that determines actual carrier frequency (carrier=kcps*kcar)

kmod=modulator frequency

kndx=index of modulation (0-4)—determines the spread of energy to partials

ifn=function table number

iphs=initial phase of sampling, expressed as a fraction of a cycle (0-1)

EXAMPLE:

instr 12 ;FM using foscil p4=amp p5=pch p6-7=mod.factor.i-f p8-9=index.low-peak

;p10-11=chnl1amp.i-f p12=fn# p13=attack%(<.4) p14=decay%(<.2)

ipch=cpspch(p5)

iatk=p3*p13

idec=p3*p14

isus=p3-(iatk+idec)

kenv expseg .00001,iatk,p4,isus,p4*.75,idec,.00001 ;amp envelope

kpwr linseg p8,iatk*2,p9,p3-(iatk*2),p8 ;changing power index

kmd line p6,p3,p7 ;changing modulator

a1 foscil kenv,ipch,1,kmd,kpwr,p12

krght line p10,p3,p11

klft=1-krght

outs a1*krght,a1*klft

endin

f1 0 8192 10 1 ;sine

i12 0 4 15000 7.06 1.494 1.475 1.8 2.24 .9 .25 1 .13 .12

e

EXAMPLE:

instr 13 ;simple finger cymbals p4=pchi p5=amp p6=chnl1amp ;;;f1=sine in sco

i1 = cpspch(p4)

k1 expseg .0001,.05,p5,p3-.05,.0001 ;env—also try k1 linseg 0,p3/2,p5,p3/2,0

k2 linseg 1.69,.1,1.75,p3-.1,1.69 ;power to partials—k2 linseg 1.69,p3/2,1.75,p3/2,1.69

a1 foscil k1,i1,1,2.01,k2,1 ;these alternate k1 and k2 make nice

a1 = a1*p6 ,sustained shimmering sounds

a2 = a1*(1-p6)

outs a1,a2

endin

 

K. alternate oscillators and waveshapingphasor, table, and oscil1 (.orc)

PROTOTYPES USED:

k/ar phasor k/xcps[, iphs]

i/k/ar table i/k/andx, ifn[, ixmode][, ixoff][, iwrap]

i/k/ar tablei i/k/andx, ifn[, ixmode][, ixoff][, iwrap]

kr oscil1 idel, kamp, idur, ifn

kr oscil1i idel, kamp, idur, ifn

cps=frequency

phs=initial phase, expressed as a fraction of a cycle (0-1)

ndx=index into the table

fn=function table #

xmode=index data mode default=0=raw data in table 1=normalized data

xoff=index offset

wrap=wraparound index flag default=0=no wraparound 1=wraparound

del=delay time in seconds

amp=amplitude factor

dur=duration

phasor produces a control or audio rate normalized moving phase value (counts from 0-1) at a frequency of k/xcps with a starting phase of iphs. The phasor multiplied by a table's length can be used to index a table containing a waveshape, building an oscillator. table can be indexed at the init, control, or audio rate. oscil1 reads through a function table one time only—this can be useful for reading envelope shapes stored in sco function tables, etc.

EXAMPLE: phasor indexing a table to create a test tone sine wave

instr 14 ;test tone oscillator using phasor and table

kph phasor 440 ;phases 0-1 440 times/second

ilength=ftlen(1) ;determines table size of f1 which contains a sine wave

kph=kph*ilength ;new kph now phases from 0-table length 440 times/second

a1 table kph,1 ;now, the phasor reads through the sine wave at 440cps

outs a1,a1

endin

EXAMPLE: the following is an example (and brief explanation) of waveshaping pulled down from the internet Csound mailing list

On the electronica email list ( mail electronica+@cmu.andrew.edu to join )

someone asked 'whats a waveshaper?' and Ab Wilson describes one unit for

doing in a kurzweil k2000 :

>I only really know about the ones in the K2k. These basically consist

>of a table containing four cycles of a sine wave. The input signal

>gets multiplied by a gain factor (which Kurtzweil call the adjust

>ammount) and the resulting number becomes the index to look up in the

>table to get the output value. So with a perfect saw wave with a range

>from -1 to +1 as input, and an adjust ammount of 0.25 you get a sine

>wave out. For an adjust ammount of 0.5 you'd get a sine wave an octave

>higher etc. For intermediate values (and inputs other than saw waves)

>you get interestingly distorted waveforms. When you modulate the

>adjust ammount you get wierd sweeping effects which sort of sound like

>alien filter sweeps. If you set things up right you can get PPGish

>sounds like bowing noises etc. Have you heard `Wind Power' by Thomas

>Dolby? Not done with waveshapers but a very similar sound.

Heres a .orc and .sco that do the stuff, not EXACTLY as described above, but near enough:

 

instr 15 ;p4=pch p5-6=sweepstart-end

ifreq = cpspch(p4)

ia = p5 ; sweep start

ib = p6 ; sweep end

ampenv linen 20000,.01,p3,.02 ;click preventing env

; sweep "adjust" function this is a bit extreme, more subtle variations would

; probably make more gently varying sounds

asweep expseg ia,p3/2,ib,p3/2,ia ;or try asweep line ia,p3,ib

ain oscil 1, ifreq, 2 ; signal input to shaper

asig tablei (ain*asweep),1,1 ; lookup output

out asig*ampenv

endin

f1 0 1024 10 0 0 0 1 ; four sinewaves

f2 0 257 7 0 256 1 ; saw input note only 0 to 1, not as described in text

i15 0 2 9.05 .4 .99

e

EXAMPLE: one of my waveshaping instruments using chebyshev polynomials

instr 16 ;cheby bass p4=pch p5=amp p6=chebyfn# p7=chnl1amp

i1 = cpspch(p4)

k1 linen .5,p3*.4,p3,p3*.2 ;driving sweep env

k2 line 1,p3,.5

k1 = k2*k1

k10 expseg .0001,p3/20,p5,.85*p3,p5*.8,p3/10,.0001 ;amp env

a1 oscili k1,i1,3

a2 tablei a1,p6,1,.5 ;tables a1 to fn13, others normalize

a3 balance a2,a1 ;this balances a2's amp to the amp level of a1

a1 = a3*p7*k10

a2 = a3*(1-p7)*k10

outs a1,a2

endin

f3 0 513 10 3 1 0 .25 .3 .76

f30 0 513 13 1 1 2 3 4 5 6 ;gen 13 for table look up

i16 0 7.5 6.02 15000 30 .25 1

e

 

L. pulse train generatorsbuzz and gbuzz (.orc)

PROTOTYPES USED: these create additive sets of harmonically related cosine partials

ar buzz xamp, xcps, knh, ifn[, iphs]

ar gbuzz xamp, xcps, knh, klh, kr, ifn[, iphs]

amp=amplitude

cps=frequency

nh=number of harmonics

lh=lowest harmonic

r=multiplier in series of amplitude coefficients (power to upper partials)—+,-, or 0

fn=function table # where you have a 8192 size sine (for buzz) or cosine (for gbuzz)

phs=initiial phase of the sampling, expressed as a fraction of a cycle (0-1)

EXAMPLE:

instr 17 ;simple 8va harmonic instr p4=pch p5=amp p6=chnl1amp

i1 = cpspch(p4-1)

k1 linseg 0,p3/2,p5,p3/2,0

k10 oscil k1/10,1.5,1 ;tremelo

a1 gbuzz k1+k10,i1,2,2,0,4 ;2 harmonics, lowest is 2, factor of 0, fn#4=cosine

a1 = a1*p6

a2 = a1*(1-p6)

outs a1,a2

endin

M. filters (subtractive synthesis)tone, atone, reson, areson, and balance (.orc)

PROTOTYPES USED:

ar tone asig, khp[, istor] ;low-pass filter

ar atone asig, khp[, istor] ;high-pass filter

ar reson asig, kcf, kbw[, iscl, istor] ;band-pass filter

ar areson asig, kcf, kbw[, iscl, istor] ;notch filter

ar balance asig, acomp[, ihp, istor] ;gain change

sig=audio signal to be filtered

hp=response curve's half-power point expressed in cps

cf=center frequency

bw=band width at the half-power point around the center frequency

stor=disposition of internal data space default=0=clear the data 1=data remains

scl=coded scaling factor for peak response of resonators default=0=no scaling

comp=comparator—the input signal's gain is matched to the comparator

Good inputs for the filters are any sort of complex sound source (pulse trains, noise, complex sampled sounds, etc.)

EXAMPLE: relatively simple instrument

instr 18 ;marimba p4=pch p5=amp p6=chnl1amp

i1 = cpspch(p4)

k1 expseg .0001,.03,p5,p3-.03,.001 ;env

k25 linseg 1,.03,1,p3-.03,3

k1 = k25*k1

knh=int(sr/2/i1) ;a real pulse train over the entire spectrum

k10 linseg 2.25,.03,3,p3-.03,2 ;power to partials

a1 gbuzz k1,i1,knh,0,k10,4 ;fn#4 must be a cosine wave

a2 reson a1,500,50,1 ; four band pass filters in a series

a3 reson a2,1500,100,1 ;filt

a4 reson a3,2500,150,1 ;filt

a5 reson a4,3500,150,1 ;filt

a6 balance a5,a1 ;the output of the last filter is matched to the original amp

a1 = a6*p6

a2 = a6*(1-p6)

outs a1,a2

endin

This instrument has the reson filters tuned to vocal formants for ooh. By simply changing the envelope, you can approximate a vocal sound. This would be enhanced if you ran the filters in parallel, adjusted the gain, and added vibrato. By having a different vibrato on each of the formant center frequencies you will get more of a chorus effect.

 

N. speech synthesisfof (.orc)

fof is a special sort of granular sine burst generator that can be used either for granular synthesis (with low frequecies) or for producing speech-like formants. It is modelled in large part on IRCAM's CHANT.

PROTOTYPES USED:

ar fof xamp, xfund, xform, koct, kband, kris, kdur, kdec,

iolaps, ifna, ifnb, itotdur[, iphs][, ifmode]

amp=peak amp of each sine burst

fund=frequency of the grains (granular synth if fund<25 speech formant if fund>25)

form=frequency of the sinusoids in each grain

oct=octaviation index (usually 0, >0 lowers fund by attenuating odd# grains 1=8vb)

band=formant bandwidth

ris, dur, and dec=rise, duration, and decay time for each grain (voice=.003, .02, & .007)

note that the dur value effects the density of the grains (and computation time)

olaps=# of preallocated spaces needed to hold overlapping burst data (fund*dur)

fna=function table with 4096 or bigger sine wave for the sine bursts

fnb=function table with a rise shape (used forwards and backwards for the grain env)

totdur=total duration (usually set to p3) during which a sine burst can be generated

phs=initial phase of the fundamental expressed as a cycle fraction (0-1)

fmode=formant frequency mode:

0=form cps at grain start time remains constant through grain

1=form cps can change throughout the duration of the grain

EXAMPLE:

instr 19 ;p4=granular-25-speech p5=cps

iolap=p4*.02

kamp line 10000,p3,500 ;big diminuendo

kbw line 0,p3,200 ;bandwidth increases

a1 fof kamp,p4,p5,0,kbw,.004,.02,.005,iolap,1,2,p3,0,0

outs a1,a1

endin

 

O. Karplus-Strong algorithmpluck (.orc)

PROTOTYPES USED:

ar pluck kamp, kcps, icps, ifn, imeth [, iparm1, iparm2]

amp=amplitude

kcps=frequency

icps=desired frequency (used to set up an audio buffer of 1 cycle of samples)

fn=function table # used to initialize the cyclic decay buffer

IF fn#=0, a random number series is used rather than a table

(implication: an oscil with a fn# of 0 generates random noise)

meth=method of decay (1-6)

parm1=additional parameter (used in decay methods 2-5)

parm2=additional parameter (used in decay methods 4-5)

methods:

1=simple averaging=simple smoothing

2=stretched averaging=simple smoothing with a stretch factor of parm1 (>=1)

3=simple drum=roughness factor parm1 0-1=pitched-noise (0=string, .5=snare drum)

4=stretched drum=parm1 0-1 for roughness/parm2 >=1 for stretch factor

5=weighted averaging=parm1 weights the current sample and parm2 weights the

previous sample—parm1+parm2<=1

6=1st order recursive filter with coefficients .5

Plucked strings (methods 1, 2, 5, and 6) work best with a noise source for a function.

Drums (methods 3 and 4) work best with a wide pulse (Gen 11—like buzz).

EXAMPLE: a simple pluck instrument with a variety of variables

instr 20 ;pluck p4=amp p5=pch p7=fn p8=chnl1amp p9=method p10-11=parm1-2

ipch=cpspch(p5)

a1 pluck p4,ipch,ipch,p7,p9,p10,p11

ichnl1=p8

ichnl2=1-p8

outs a1*ichnl1,a1*ichnl2

endin

;;;NOTE: in using methods which do not require parm2 or parm1, p11 and p10 in the score can be left blank. Although Csound will give you error messages (warning: pcnt in orc=11, pcnt in sco=9—or something like that) during the performance of the score, it will generate the sound with no problems.

P. using randomrand (.orc)

PROTOTYPES USED:

kr or ar rand xamp[, iseed] ;simple random

kr or ar randh k or xamp, k or xcps[, iseed] ;random hold

kr or ar randi k or xamp, k or xcps[, iseed] ;random interpolate

amp=amplitude or range of values (actual range is from -amp to +amp)

cps=frequency at which to select a new random value within the amp range

randh holds the value until the next value is determined while randi does a straight line interpolation between the consecutive random values. Rand is very useful not only for generating noise, but for adding random elements to vibrato, tremelo, or generating random sequences of pitches.

EXAMPLES: some simple applications of rand

instr 21 ;shimmering with random tremelo p4=pch p5=amp p6=power p7=chnl1amp

i1 = cpspch(p4-2) ;added a pitch correction

k1 linseg 0,p3/2,p5,p3/2,0 ;env

k2 randi 2,25

k3 oscil .03,4+k2,1 ;rand trem

a1 gbuzz .33+k3,i1,50,1,p6,4

k4 randi 1.2,15

k5 oscil .03,4+k2,1 ;rand trem

a2 gbuzz .33+k5,i1+(i1*.02),50,1,p6,4

k6 randi 1.5,20

k7 oscil .03,4+k2,1 ;rand trem

a3 gbuzz .33+k7,i1-(i1*.021),50,1,p6,4

a4 = (a1+a2+a3)*k1

a1 = a4*p7

a2 = a4*(1-p7)

outs a1,a2

endin

instr 22 ; temple blocks p4=pch p5=amp p6=chnl1amp

i1 = cpspch(p4)

k1 expseg .0001,.01,p5,p3-.01,.0001

a1 rand k1 ;a burst of broad band noise

a2 reson a1,i1,i1/25,1 ;filtered to an approximate pitch

a3 balance a2,a1

a1 = a3*p6

a2 = a3*(1-p6)

outs a1,a2

endin

instr 23 ; unpitched perc

;p4=pch p5=amp p6=chnl1amp

i1 = cpspch(p4)

k1 randh i1/3.5,500 ;random deviations to pitch

k2 expseg .0001,.025,p5,p3-.5,p5*.001,.025,.0001 ;amp envelope

a1 oscili k2,i1+k1,1

outs a1*p6,a1*(1-p6)

endin

Q. more on granular synthesis— (.orc)

The following example is an instrument that generates a stream of random notes with random durations. If the rate of attacks is sufficiently fast (50-200 notes per second) and you use several copies of this instrument simultaneously, you will get a form of quasi-synchronous granular synthesis. If you use it at slower rates, you simply have a random note generator.

EXAMPLE:

instr 24 ;fast flurried random pitch instr p4-5=center cpsi-f

;p6-7=randF rangei-f p8-9=randcps rangei-f p10-11=ampi-f

;p12=envfunction p13=oscilfunction p14=chnl1amp

i1 = cpspch(p4)

i2 = cpspch(p5)

k2 line p6,p3,p7 ;dev around center frequency

k3 line p8,p3,p9 ;rate of attacks

k5 randh 2,k3 ;random element in attack rate

k4 randh k2,k3+k5 ;actual attack rate

a5 oscili 1,k3+k5,p12 ;env determined by attack rate (audio rate clarity)

k6 line p10,p3,p11 ;amp change

k1 line i1,p3,i2 ;center frequency line

a1 oscili a5*k6,k1+k4,p13 ;actual sound

a1 = a1*p14

a2 = a1*(1-p14)

outs a1,a2

endin

 

R. program control with conditionalsif-then, etc. (.orc)

PROTOTYPES USED:

i/ti/kgoto label

goto label

if i/ka R i/kb i/kgoto label

if ia R ib goto label

(a > b ? v1 : v2) ;if-then-else math conditionals as opcode arguments

(a < b ? v1 : v2)

(a >= b ? v1 : v2)

(a <= b ? v1 : v2)

(a == b ? v1 : v2)

(a != b ? v1 : v2)

 

EXAMPLES: conditional branches env. and gliss choices (i1) and loops (i2)

instr 25 ;tpt? or instr for chordal passage dyads

;p4=pch p5=amp p6=chnl1amp p7=0=nogliss p8=1=smooth attack

;p8=0=sharp attack w/decay p8=2=sharp attack w/out decay

i1=cpspch(p4) ;used to determine oscillator frequency

i2=octpch(p4) ;used to determine power to partials peaks in sharp attack and held notes

k100 randi 1,10

k101 oscili i1/85,5+k100,1

k102 linseg 0,.2,0,.3,1,p3-.5,1

k100 = i1+(k101*k102)

if p7=0 goto nogliss ;any value other than 0 in p7 results in next two lines of code replacing k100

k50 linseg .95*i1,.08,i1,p3-.08,i1

k100 = k50+(k101*k102)

nogliss:

if p8=1 goto smooth ;this routes flow to different envelope generators

if p8=2 goto sharphold

k10 linseg 0,.03,1,.04,1,.03,.4,p3-.1,0 ;amp env

k20 linseg 1.4,.03,1.7,.04,1.7,.03,1.5,p3-.1,1.385 ;power to partials

goto last ;once an envelope is calculated, skip down to last to generate sound--without this, the

sharphold: ;envelope would be recalculated with new k10 and k20 values

ipwr1=(i2 > 8 ? (p4/5)+.1 : 1.7) ;use conditionals to set power coefficients relative to the pitch

ipwr2=(i2 > 8 ? (p4/6)+.1 : 1.45)

k10 linseg 0,.03,1,.04,1,.03,.75,p3-.15,.7,.05,0 ;amp env

k20 linseg 1.4,.03,ipwr1,.04,ipwr1,.03,ipwr2,p3-.1,1.385 ;power to partials

goto last

smooth:

k10 linseg 0,.06,.85,p3-.06,0 ;amp env

k20 linseg 1.4,.06,1.57,p3-.06,1.385 ;power to partials

last:

k1 = .5*k10 ;driving oscil env

a1 oscili k1,k100,9

a2 tablei a1,4,1,.5 ;tables a1 to Gen 13 function

a3 balance a2,a1

a4 = (a3*k10)*p5

a5 foscil k10,k100,1,1.999,k20,1 ;try other fn as well

a6 = a5*p5

a4 = (a6*.7)+(a4*.3)

a1 = a4*p6

a2 = a4*(1-p6) ;this is computationally inefficient, better to calculate 1-p6 and assign to an

outs a1,a2 ;i-value rather than repeat the same subtraction for each sample

endin

 

 

S. more processingreverb, alpass, comb, gain, and rms (.orc)

PROTOTYPES USED:

ar comb asig, krvt, ilpt[, istor] ;comb reverb (colored)

ar alpass asig, krvt, ilpt[, istor] ;alpass reverb (flat)

ar reverb asig, krvt[, istor] ;reverb (natural room)

kr rms asig[, ihp, istor] ;root-mean-square follower

ar gain asig, krms[, ihp, istor] ;gain adjust

sig=input audio signal

rvt=reverb time (although this can be changed at the control rate, it sounds nasty)

lpt=looptime (if you want to tune your combs, set looptime to 1/desired cps)

rms=root-mean-square (ie. power of the signal) this is an amplitude follower unit

hp=half power point of a special low pass filter—default=10

stor=initial disposition of internal data space—default=0

EXAMPLES: another way to balance two signals

The following two lines of code are the same as a balance statement:

k1 rms audiosignal1 ;follows the amp of audio signal 1

a1 gain audiosignal2,k1 ;maps the envelope onto audio signal 2

 

(see Richard Karpen's approximate translation of CCRMA's old NREV reverberator into Csound

for a good example of using comb and alpass filters to design a nice reverb instrument)

 

T. soundfile manipulation instruments— (.orc)

The nice thing about soundin is that you can read in soundfiles and then perform a variety of operations on them (filtering, reverberating, AM, envelope following, waveshaping, granulating, etc.)

instr 26 ;soundin AM1 p4=sndin# p5=mod.cps p6=mod.amp p7=amp.factor

i1=cpspch(p5)

a1 soundin p4,0

k1 rms a1

a2=a1/k1 ;normalizes soundin amp to allow for mult at out

kmod oscil p6+1,i1,1 ;amp factor of anything up to 1

kenv=(kmod*k1)*p7

out a2*kenv ;can also get less controlable AM by simply

endin ;multiplying two sound sources

instr 27 ;soundin waveshaping p4=sndin# p5-6=sweep.low-high p7=table.fn#

i1=p5

i2=p6

asweep linseg i1,p3*.3,i2,p3*.7,i1

ain soundin p4,0

afinal table (ain*asweep),p7

krms rms ain ;track sndin env to use in final sound

knr linseg 0,.05,1,p3-.1,1,.05,0 ;env click remover

kenv=krms*knr ;master env

a1=afinal*kenv

outs a1,a1

endin

instr 28 ;soundin comb p4=sndin# p5=comb.pch p6=sf/comb.balance

i1=1/cpspch(p5)

i2=p6

i3=1-p6

a1 soundin p4,0

a2 comb a1,1,i1

axx=(a1*i2)+(a2*i3)

outs axx,axx

endin

instr 29 ;soundin env and cps generator1 p4=sndin# p5=pch p6=amp.factor p7=fn#

i1=cpspch(p5)

a1 soundin p4,0

k1 rms a1

kenv1 linseg 0,.02,p6,p3-.05,p6*.8,.03,0 ;smooths beg. and end of file

kenv=kenv1*k1

a2 oscil kenv,i1+(k1/5),p7 ;note that the rms/5 is being added onto the frequency of the oscil--the pitch

outs a2,a2 ;will change radically at the onset and decay of the note while the psuedo-

endin ;steady state will remain relatively stable--you can impose this env on any

;other sound generator (FM, AM, pulse, noise, soundin, etc.)

 

 

(see also Russel Pinkston's Phase Vocoder instrument)

 

U. using globals— (.orc)

There is no need to build reverb into every instrument of your orc, especially if you want to use it in all of the instruments or do not want to use it all of the time in the score. Instead, simply add a g (for global) in front of all of your audio output signals:

ga1=audiochannel1

ga2=audiochannel2

outs ga1,ga2

By using these globals, you can now read the outputs of one instrument as the input into another—like the reverb and comb instruments below. You can also use global outputs for control and init rate signals if you want to communicate between the different instruments of your orc.

EXAMPLES:

instr 30 ;global reverb unit--reads global outputs

krev line p4,p3,p5 ;p4=start reverb time, p5=end reverb time

a1 reverb ga1,krev

a2 reverb ga2,krev

outs a1,a2

endin

instr 31 ;global comb filter unit--reads global outputs

krev line p4,p3,p5 ;p4=start comb time, p5=end comb time

a1 comb ga1,krev,.1 ;.1 second looptime

out a1

endin

EXAMPLE: Eric Lyon's feedback oscillator from the Csound mailing list

> Is there any way to implement oscillator feedback?

Yes, use global variables.

---

instr 32

ga1 = 0 ; or whatever

endin

instr 35

a2 oscil p4, ga1, 1

ga1 oscil p4, a2, 1

out ga1

endin

---

(Orcs like that are good candidates for subtractive synthesis :)

 

V. resynthesis using analysis filespvoc, lpc, and adsyn (.orc)

PROTOTYPE USED: fft analysis file resynthesis

ar pvoc ktimpnt, kfmod, ifilno [,ispecwp]

timpnt=passage of time through the file (forwards, backwards, changing rate, etc.)

fmod=transposition factor (also changes through time—linear or disjunct motion)

fmod must be at least .5 or higher for pvoc to function

filno=# of an analysis file entitled pvoc.#

specwp=spectral envelope preserver (default=0=transpose all —0=attempt to preserve

spectral envelope while transposing the frequency content only)

EXAMPLE:

instr 33

;flowers p4-5=pchi-f p6-7=chnl1ampi-f make note 9" long

iratio1=(cpspch(p4))/196 ;mod ratio of desired pitch1/normalized cps

iratio2=(cpspch(p5))/196 ;mod ratio of desired pitch2/normalized cps

i1=196/175 ;normalized cps/actual sound file cps1

i2=196/132 ;normalized cps/actual sound file cps2

i3=196/136 ;normalized cps/actual sound file cps3

;now normalize the file to a 196 cps with the following ratio line

knorm linseg 1,.235,1,.005,i1,1.76,i2,.1,i3,6.9,i3

kdesired linseg iratio1,2,iratio1,.1,iratio2,6.9,iratio2 ;desired pchs

kfm=knorm*kdesired ;normalizer*desired reaps the ratio linseg needed

ktime linseg 0,.24,.24,1.76,.44,.1,.5,6.5,.78,.4,1.01 ;time progression

a1 pvoc ktime,kfm,6

kamp line p6,p3,p7

kamp1=kamp*.00003

kamp2=(1-kamp)*.00003

outs a1*kamp1,a1*kamp2

endin

 

PROTOTYPES USED: resynthesis using analysis files of time-varying filter coefficients

krmsr,krmso,kerr,kcps lpread ktimpnt, ifilno[, inpoles][, ifrmrate] ;reads file

ar lpreson asig ;reads the filter coefficients

ar lpfreson asig, kfrqratio ;reads and shifts the filter coefficients

timpnt=time progression through the analysis file

filno=# of analysis file entitled lpcanal.#

npoles and frmrate=# of filter poles and frame rate of analysis file (if not in header)

rmsr=rms of the residual of analysis

rmso=rms of the original (use to drive the amp of the driving asig)

err=the normalized error signal (use to determine pitched/unpitched nature of asig)

cps=pitch in cps of the analysis file (use to drvie pitch of the driving asig if desired)

asig=driving audio signal (usually a pulse train or wide-band signal—but try others)

frqratio=ratio of shifted to original formant regions

EXAMPLE: simple instr reads backwards through a 1 second analysis file lpcanal.1

instr 34 ;lpc

ktime line 1,p3,0

krmsk,krmso,kerr,kcps lpread ktime,1

abuzz gbuzz 1-kerr,kcps,1 ;f1=8192 size sine

anoise rand kerr

a1 lpreson abuzz+anoise

a2=a1*krmso

outs a2,a2

endin

instr 35 ;lpc instrument p4=lp# p5=snd driver (1=buzz, 2=gbuzz, 3=FM)

ktime linseg 0,p3/2,.52,p3/2,0

krmsr,krmso,kerr,kcps lpread ktime,p4

kpwr=(1-kerr)*25

kmult1=.4-kerr

kmult1=(kmult1<0 ? 0 : kmult1)*2.5

ablnc oscil krmso,440,1

if p5=3 goto fm

if p5=2 goto gbuzz

asnd buzz krmso*kmult1,kcps,20,1 ;fn1= 8192 point sine wave

goto more

gbuzz:

asnd gbuzz krmso*kmult1,kcps,20,0,kpwr,2 ;fn2=8192 point cosine

goto more

fm:

kpwr=(kpwr+1)*2

asnd foscil krmso*kmult1,kcps,1,1.5319,kpwr,1

more:

kmult2=(kerr-.2)*1.25

anz rand krmso*kmult2

a1 lpreson asnd+anz

a1 balance a1,ablnc

out a1

endin

;;;;;;;;;;;;;;;;;;;;

f 1 0 8193 10 1

f 2 0 8193 9 1 1 90

 

 

PROTOTYPE USED: hetrodyne filter analysis of up to 50 component sine waves

ar adsyn kamod, kfmod, ksmod, ifilcod

amod=amplitude factor

fmod=frequency modulation factor

smod=speed modulation factor (speed to read through file—2=2*speed, .5=half speed)

filcod=# of analysis file entitled adsyn.#

instr 36 ;adsyn instrument

kamod line .75,p3,1

kfmod expon .2,p3,.3

ksmod line .25,p3,.05

a1 adsyn kamod,kfmod,ksmod,3

out a1

endin

 

 

W. more on program controlinit, reinit, rireturn, etc. (.orc)

PROTOTYPES USED:

timout istrt, idur, label

reinit label

rigoto label

rireturn

ar delayr idlt[, istor] ;delay read

delayw asig ;delay write

ar delay asig, idlt[, istor] ;delay asig by delay time dlt

ar delay1 asig[, istor] ;delay one sample

ar deltap kdlt ;delay tap—between delayr-w pairs

ar deltapi xdlt ;delay tap interpolating

instr 37 ;demonstrating reinit, rireturn, timout, delays, and

;global outputs. This instr will play repeated

;plucked sounds with an increasing delay. p4=pch

icps=cpspch(p4)

doagain: timout 0,p3/20,noise

;conditional branch during perf to noise

reinit doagain

noise: ga1 pluck 10000,icps,icps,0,1

;uses function table 0, a random generator

rireturn ;returns from conditional branch (to reinit line)

k1 line 0,p3,.25 ;controls the ensuing delay time change

adel delayr .25 ;delay read gives max delay time

achng deltap k1 ;taps delay line at var. offset times

delayw ga1 ;delay write writes the audio into delay line

out achng ;generates sound

endin

 

instr 38 ;instr that reads a global soundin and imposes a number of comb filters that "sparkle" by

;changing frequencies regularly---use many copies of this instrument simultaneously to get randomly

;shifting chords, sort of a granular comb filter bank---this instrument addresses the problem of using

;reinitialization passes to reset arguments that must be init values

;p4=base env attack rate

;p5=base env attack rate deviation

;probably works best if p4 + -p5 to +p5 = .25-2 cps

;however, try different values for different effects---

;shorter values for longer notes, higher values for a

;more granular approach

;p6=#octave rand range p7=#octave base (5-12) p8=amp factor

doagain:

krrate randh p5,p4,-1 ;set initial krrate

krate=p4+krrate ;set actual cps rate for first note

ktime=1/krate ;actual note duration used in timout below

krevtime=ktime/5 ;reverb time to allow decay before end of loop

;use the following for random envelope functions (assumes 50 function table envelopes)

;kenvfn randh 49,krate,-1 ;random number -49 to +49

;kenvfn=int(abs(kenvfn)) ;integer-absolute value to get 0-49

kplace randh .5,krate,-1 ;no seed reinit, values -.5 to +.5

kchnl1=kplace+.5 ;values 0-1, chnl1 amp multiplier

krcps randh p6,krate,-1 ;no seed reinit, values -p6 to +p6

;random l-r placement for each note

krcps=abs(krcps)+p7 ;make rand output all positive and add base

ioct=i(krcps)

ilpt=1/cpsoct(ioct)

timout 0,i(ktime),comb

reinit doagain

comb:

;kenv oscil1 i(ktime)/4,1,i(ktime)/2,i(kenvfn)+1 ;random env fn

kenv oscil1 i(ktime)/4,1,i(ktime)/2,1 ;random env fn

kenv2 oscil1 0,1,i(ktime),1 ;overall smoothing envelope

a1=ga1*kenv ;ga1 from soundin to be filtered below

acomb comb a1,krevtime,ilpt,0

acomb=acomb*kenv2

rireturn

ablnc balance acomb,a1

ablnc=ablnc*p8

afinal1=ablnc*kchnl1

afinal2=ablnc*(1-kchnl1)

outs afinal1,afinal2

endin

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

f 1 0 513 8 0 150 .5 50 1 113 1 50 .5 150 0

 

X. odds and ends

PROTOTYPES USED:

i/k/ar divz i/k/xa, i/k/xb, i/k/ksubst ;a/b if b=0 then subst

ir tival ;tied note flag

kr port ksig, ihtim[, isig] ;portamento

kr downsamp asig[, iwlen] ;converts audio rate to control rate

ar upsamp ksig ;control to audio (by repetition)

ar interp ksig[, istor] ;control to audio (by interpolation)

k/ar integ k/asig[, istor] ;integration (low pass)

k/ar diff k/asig[, istor] ;differentiation (high pass)

k/ar samphold x/asig, k/xgate[, ival, ivstor] ;sample-and-hold

ktemp tempest kin, iprd, imindur, imemdur, ihp, ithresh, ihtim, ixfdbak,

istartempo, ifn[, idisprd, itweek]

kx, ky xyin iprd, ixmin, ixmax, iymin, iymax[, ixinit, iyinit]

tempo ktempo, istartempo

a1 in

a1, a2 ins

a1, a2, a3, a4 inq

a1, a2, a3, a4 pan asig, kx, ky, ifn[, imode][, ioffset]

print iarg[, iarg,...]

display xsig, iprd[, iwtflg]

dispfft asig, iprd, iwsiz[, iwtyp][, idbouti][, iwtflg]

;the following spectral operators are experimental and cannot generate sound—specaccm does not work and is not listed here

dsig octdown asig, iocts, isamps[, idisprd]

wsig noctdft dsig, iprd, ifrqs, iq[, ihann, idbout, idsines]

wsig specscal wsigin, ifscale, ifthresh

wsig specaddm wsig1, wsig2[, imul2]

wsig specdiff wsigin

wsig specfilt wsigin, ifhtim

specdisp wsig, iprd[, iwtflg]

ksum specsum wsig[, interp]

V. Score Generation

A. algorithmic composition using MAX

B. MIDI to Csound score via MAX

C. Cscore

 

 

 

 

FOR OTHER INTERESTING ORCHESTRAS AND SCORES SEE:

1) the Csound morefiles folder (contains stuff in the Richard Boulanger anthology of Csound orchestras and scores)—of particular interest are:

James Dashow's orc and sco for the beginning of In Wintershine

Russell Pinkston's orc and sco coding of DX7 and Risset's Endless Glissando

John Chowning's FM instruments

2) the morefiles folder also contains examples of simpler orchestras and scores

APPENDIX A

Csound.Internet and More

This file contains the following:

1) Csound

2) Power PC version of Csound

3) Mailing Lists of Interest

4) Csound performance results on various workstations and PCs

5) Computer Music Journal

6) MacMUSIC

7) Csounder Version Two

8) Computer Music Bibliography as suggested by Stephen Travis Pope of CMJ

1) Csound

available via ftp at:

cecelia.media.mit.edu in pub/Csound (1992 version)

and pub/Csound/csbeta (1993 version)

Csound-881.hqx uses the math coprocessor

Csound.hqx is a version for Macs without the coprocessor

Csound.man.hqx is the manual

Csound.sit.hqx includes both versions as well as all of the source code

2) Power PC version of Csound

available at the following ftp sites:

ftp.maths.math.ac.uk in pub/dream/CSound.ppc.sit.hqx

ella.mills.edu in pub/ccm/csound.ppc/csound.ppc.hqx

(also can get SoundHack at Mills)

ftp.ircam.fr, in pub/music/programs/mac

and pub/music/programs/ibm

3) Mailing Lists of Interest

A) Csound mailing list—

Subj: Your mail to csound-request@maths.ex.ac.uk

All routine administrative requests (including subscriptions and unsubscriptions) concerning this mailing list are handled by an automated server. Please read this message carefully to find the information relevant to you.

SUBSCRIBING

===========

To subscribe to csound, send the following in the body (not the subject line) of an email message to "Majordomo@maths.ex.ac.uk": subscribe csound

This will subscribe the account from which you send the message to the csound list.

If you wish to subscribe another address instead (such as a local redistribution list), you can use a command of the form: subscribe csound other-address@your_site.your_net

UNSUBSCRIBING

=============

To unsubscribe from csound, send the following in the body (not the subject line) of an email message to "Majordomo@maths.ex.ac.uk": unsubscribe csound

This will unsubscribe the account from which you send the message. If you are subscribed with some other address, you'll have to send a command of the following form instead: unsubscribe csound other-address@your_site.your_net

If you don't know what address you are subscribed with, you can send the following command to see who else is on the list (assuming that information isn't designated "private" by the owner of the list):o who csound

If you want to search non-private lists at this server, you can do that by sending a command like: which string

This will return a list of all entries on all lists that contain "string".

HELP

====

To find out more about the automated server and the commands it understands, send the following command to "Majordomo@maths.ex.ac.uk": help

If you feel you need to reach a human, send email to: csound-approval@maths.ex.ac.uk

B) DAW-MAC (digital audio workstation-Macintosh)—send "subscribe daw-mac" or "unsubscribe daw-mac" in the body to listserv@netcom.com

C) ICMA list (for ICMA members only)—Requests to post, e-mail: icma@umich.edu

Subscription requests, e-mail: msimoni@umich.edu (Mary Simoni)

NEWSGROUPS:

rec.audio.pro

rec.music.makers

comp.music

4) Csound performance results on various workstations and PCs

Thanks to the various people who have assisted so far, we now have the following table, sorted into some kind of order

Csound Benchmark results [All times in seconds elapsed]

========================

Test Bach-d Bach-m Riss-g Riss-m Guit-d Guit-m Jame-g pvanal lpanal

Length 115.73s 115.73s 63.75s 63.75s 87.75s 87.75s 6.75s 6.75s 5.00s

------------------------------------------------------------------------------

INDY2 8.47 8.09 5.23 5.00 10.53 10.42 00.90 - -

R4000 17.25 10.00 6.84 5.94 17.26 16.02 01.78 10.99 05.54

R3000 27.45 21.06 15.50 12.52 42.86 35.04 02.82 22.23 11.13

586-90 27.57 25.05 16.03 14.05 38.12 33.23 02.02 - -

586-90W 30.00 21.00 16.00 10.00 29.00 21.00 02.00 - -

SPARC 34.8 33.1 20.5 20.2 63.8 62.3 04.8 39.9 25.8

486DX66 96.72 91.40 55.53 52.24 126.38 119.14 09.39 82.56 75.14

386-25 899.95 863.26 2347.85 2314.40 7558.63 7447.45 362.92 3964.00 3351.61

The lack of a floating point processor of the 386-35 is obvious (the Bach makes few demands, Riss-m does)! I have promises/indications that other processors are to be reported.

5) Computer Music Journal

abstracts now available via ftp at:

mitpress.mit.edu:/pub/Computer-Music-Journal

ccrma-ftp.stanford.edu:/pub/Publications/cmj

CMJ also has Web pages. The URL's are:

file://ccrma-ftp.stanford.edu/pub/Publications/cmj/CMJ.html

file://mitpress.mit.edu/pub/Computer-Music-Journal/CMJ.html

6) MacMUSIC

MacMUSIC is a graphic interface for Csound on the Mac (a little like MAX, KYMA, or TurboSynth). Although it currently only runs on system 6.07, a new version for system 7 is to be released soon. The 1992 program is by Isodoro P. Garcia at LIEM—CDMC & EVIT Telecommunications in Madrid, Spain.

7) Csounder Version Two

Csounder is a windows shell for Csound. You must have a version of csound installed on your machine, and included in your PATH statment for Csounder to work properly. Csound is available at ftp.maths.bath.ac.uk:pub/dream. Csounder is also available at this site, however the latest updates and "home site" is vax1.umkc.edu:\music.

In this version:

Smoother orchestra and score creation

Support for pvanal,hetro,and lpcanal analysis

Perfs are now run with the 50% in background option so you can work while perfing.

Utility Orchs and Scores—a collection of orchs and scores that you may use often, available from any project directory. You can save orch's like stereo to mono, or mixing orchestras here instead of copying them to each project. You create the utility files yourself!

Csounder has been through some testing, and appears to be running fine. If you have a comment, suggestion for a new feature, or (gasp!) bug report, please email to dburke@vax1.umkc.edu.

You can get this new version via anonymous ftp to ella.mills.edu (/ccm/soundhack) or to music.calarts.edu (/pub/SoundHack). The archive contains versions for both floating point and non-floating point macs.

 

8) Computer Music Bibliography as suggested by Stephen Travis Pope of CMJ

-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

In response to Shlomo Dubnov's query, I thought I'd distribute the Computer Music Journal's annotated computer music bibliography. It appeared in CMJ 17:3 (Fall, 1993) and is also available on the Internet and World-Wide Web from mitpr ess.mit.edu:/pub/Computer-Music-Journal/EdNotes/Bibliography.t.

-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Editor's Note: Computer Music Journal 17:3 (1993)

The Basic Computer Music Library

Stephen Travis Pope

Computer Music Journal

P. O. Box 9496

Berkeley, California 94709 USA

electronic mail: stp@CNMAT.Berkeley.edu

Developing an annotated bibliography and diskography of the seminal printed and recorded works of the computer music literature will be the topic of this and the next CMJ Editor's Notes. The editor developed a draft list, and circulated it for comment. Additions and annotations to this first round were provided by (in alphabetical order) Roger Dannenberg, Giovanni DePoli, Guy Garnett F. Richard Moore, Curtis Roads, Bill Schottstaedt, and Julius Smith.

It is hoped that this list can serve as a valuable resource for the field, and that it will continue to grow, both in the references cited, and their annotations. The text of this list can be retrieved by anonymous Internet file transfer (ftp) from the directory pub/cmj on the network server ccrma-ftp.stanford.edu.

A taxonomy of our field can be informally derived from the tables of contents of the Proceedings of the International Computer Music Conferences, from Deta Davis' excellent and valuable bibliographies (see below), or from the ICMA Source Book (see below). The current outline of this bibliography is:

Music Theory and Composition with Computers

Acoustics, Psychoacoustics, and Music Perception

Mathematics and Digital Audio Signal Processing

Computer Music Software Technology

MIDI and Real-Time Event Processing

Anthologies of the Computer Music Literature

The Computer Music Library Starter Kit

====================A Basic Computer Music Bibliography============

Music Theory and Composition with Computers

Painter, J et al. eds. 1992. "Companion to Contemporary Musical Thought." (in two volumes). London: Routledge. A huge work with over 30 essays from the leading composers and theorists of our time; many computer-music related contributions.

Roads, C. ed. 1985. "Composers and the Computer." Madison, Wisconsin: A-R Editions. A collection of interviews with nine of the most important composers of computer music.

Haus, G. ed. 1993. "Music Processing", A-R Editions. Essays on computer music theory and practise by a number of experts in the field.

Emmerson, S. ed. 1986. "The Language of Electroacoustic Music." Macmillan. Composing and listening to electroacoustic music.

Barbaud, P. 1966. "Initiation a la Composition Musicale Automatique." Paris: Edition Dunod. The formal description of this composer's algorithmic composition method; of great historical value.

Landy, L. 1990. "What's The Matter with Today's Experimental Music?" London: Harwood Academic Publishers. The premise is that contemporary music suffers from lack of attention.

De Poli, G., A. Piccialli, and C. Roads, eds. 1991. "Representations of Musical Signals." MIT Press. Papers on models for music synthesis, with sections on time-frequency representations, granular synthesis, physical models, architectures, and parallel distributed processing.

Howell, R., R. West, and I. Cross. 1991. "Representing Musical Structure." Academic Press.

Marsden, A. and A. Pople. 1992. "Computer Representations and Models in Music." Academic Press. Two interesting collections covering models and knowledge representation for music, the second of which is more directly concerned with computational representations..

Baroni, M., and Callegari, L. eds. 1984. "Musical Grammars and Computer Analysis." Olschki Publishers. Some of the papers are of only historical significance, but others are still very relevant.

Cope. D. 1991. "Computers and Musical Style."A-R Editions. An in-depth discussion of the use of "signatures" in the author's pattern-based composition expert system in Lisp.

 

Acoustics, Psychoacoustics, and Music Perception

Pierce, J. R. 1992. (revised edition) "The Science of Musical Sound." W. H. Freeman.

Sundberg, J. 1992. "The Science of Musical Sounds." Academic Press.

Rossing, T. D. 1990. "The Science of Sound." Addison-Wesley.

Three excellent primers on musical acoustics.

Backus, J. 1969. "The Acoustical Foundations of Music," New York: W. W. Norton and Co.

Benade, A. H. 1990 "Fundamentals of Musical Acoustics." New York: Dover Press.

The standard texts on musical issues in acoustics.

Olson, H. F. 1957. "Acoustical Engineering." Professional Audio Journals.

Benson, K. B., ed. 1988. "Audio Engineering Handbook." New York: McGraw-Hill.

Two valuable recording and sound engineering text books.

Fletcher, N. H. and T. D. Rossing, 1991. "The Physics of Musical Instruments". Springer Verlag. This is especially good for those interested in physical modeling.

Roederer, J. G. 1975. "Introduction to the Physics and Psychophysics of Music." Springer Verlag. This one is not to be missed.

Sundberg, J. 1987. "The Science of Singing Voice." Northern Illinois University Press. The bible of the voice.

Blauert, J. 1983. "Spatial Hearing." MIT Press. Seminal treatment of spatial localization of sound.

Deutsch, D. 1982. "The Psychology of Music." Academic Press. A rich collection of papers on all psychological aspects of music perception, performance, and processing.

McAdams, S. and I. Deliege. 1990. Music and the Cognitive Sciences, Harwood Academic Publishers. A substantial collection of stimulating papers from psychologists, theorists and composers, including some concerning computer models.

Dowling, W. J., and D. L. Harwood. 1985. "Music Cognition." Academic Press. An important work on many aspects of music perception and understanding.

Bregman, A. 1990. "Auditory Scene Analysis: The Perceptual Organization of Sound." MIT Press. The measure of sound and music perception texts.

Handel, S. 19879. "Listening: An Introduction to the Perception of Auditory Events" MIT Press

Sundberg, J., L. Nord, and R. Carlson, eds. 1991. "Music, Language, Speech, and Brain." MacMillan Press. This was a really great conference; not all computer music, but very good work all around.

Mathematics and Digital Audio Signal Processing

Rabiner, L., and B. Gold, 1975. "Theory and Application of Digital Signal Processing." Prentice-Hall.

Oppenheim, A.V. and R.W. Schafer, 1989. "Discrete-Time Signal Processing" Prentice Hall.

The two most-widely used texts--up-to-date versions of all of DSP. Highly-relevant signal processing technology.

Rabiner, L., and R. W. Schafer. 1978. "Digital Processing of Speech Signals." Prentice-Hall. DSP methodology for speech signals.

Fisher, R. C., and A. D. Ziebur. 1982. "Integrated Algebra, Trigonometry and Analytic Geometry." Prentice-Hall. A good "basic math" reference.

Strawn, J. ed. 1985. "Digital Audio Signal Processing: An Anthology," and "Digital Audio Engineering: An Anthology." A-R Editions. Two valuable anthologies of DSP for computer music.

Pohlmann, K. 1989. "Principles of Digital Audio". Howard W Sams.

Pohlmann, K. 1991. "Advanced Digital Audio". Howard W Sams.

Introductory and intermediate texts on audio signal processing.

Markel, J. D., and A. H. Gray. 1976. "Linear Prediction of Speech." New York: Springer-Verlag. Excellent development of lattice and ladder digital filter forms.

Computer Music Software Technology

Moore, F. R., 1990. "Elements of Computer Music." Prentice-Hall. The best comprehensive in-depth computer music technology and software for composition, synthesis, and processing.

Mathews, M. V. 1969 " The Technology of Computer Music" Mit Press. The standard reference for software sound synthesis in Music V.

Brinkman, A. 1990. "Pascal Programming For Music Research." University of Chicago Press. Many programming techniques for composition and analysis.

Dodge, C. and T. A. Jerse. 1985. "Computer Music : Synthesis, Composition, and Performance." Schirmer Books.

Tarabella, L. 1992. "Informatica e Musica." Milan: G. E. Jackson. A good introduction to hardware and software issues.

Wells, T. 1981. "The Technique of Electronic Music." New York: Schirmer Books.

Chowning, J., and D. Bristow. 1986. "FM Theory & Application." Yamaha Music Foundation. The title says it all; a practical-thinking introduction.

Pope, S. T. ed. 1990. "The Well-Tempered Object." MIT Press. Object-oriented software for composition, performance and DSP in Lisp, Smalltalk-80, and Objective C.

Todd, P. M., and D. G. Loy. eds. 1992. "Music and Connectionism." MIT Press. Collected papers on neural networks for musical applications.

Balaban, M. K. Ebcioglu, and O. Laske, eds. 1992. "Understanding Music with AI: Perspectives on Music Cognition." MIT Press. A good survey of artificial intelligence tools for music.

Buxton, W., W. Gaver, and S. Bly. 1993. "Auditory interfaces: The Use of Non-Speech Audio at the Interface." Cambridge University Press. An important contribution to the field of "non-speech audio" in user interfaces.

Press, W., et al. 1989. "Numerical Recipes in C." Cambridge, UK: Cambridge University Press. Efficient C-language routines for all common numerical algorithms

MIDI and Real-Time Event Processing

Yavelow, C. 1993. "The Macintosh Music and Sound Bible." IDG Books. Truly biblical in scale; covers all aspects of sound and music processing on Apple Macintoshs.

Rowe, R. 1992. "Interactive Music Systems." MIT Press. (includes CD-ROM with software and sound examples) Machine composition and performance with Cypher and other tools; the CD-ROM includes software sources in Lisp, C, Max, and Smalltalk-80.

Rothstein, J. 1991. "MIDI: A Comprehensive Introduction." A-R Editions. Recommended as a basic introduction.

Chamberlain, H. 1987. "Musical Applications of Microprocessors." Indianapolis, Indiana: Hayden Books. Small systems for composition and performance.

Anthologies of the Computer Music Literature

Roads, C. and J. Strawn. 1985. "Foundations of Computer Music." MIT Press. Computer Music Journal: the first five years.

Roads, C. ed. 1989. "The Music Machine." MIT Press. Computer Music Journal: the second five years.

Davis, D. 1990. "A Computer Music Bibliography." A-R Editions (2 volumes). The very valuable kernel of any reference library.

Hewlett, W., and E. Selfridge-Field, eds. 1985-1992. "Directory of Computer Assisted Research in Musicology." Center for Computer Assisted Research in the Humanities. (7 volumes). Annual volumes surveying representations, databases, and computer applications in musicology.

Mathews, M. V., and J. R. Pierce, eds. 1989. "Current Directions in Computer Music Research." MIT Press (includes a CD of sound examples). An intense set of papers on the research issues in the field.

Harris, C. R. and S. T. Pope. 1987. "Computer Music Association Source Book: Activities and Resources in Computer Music." International Computer Music Association. The desktop reference of the computer-music community.

Abbott, C. ed. 1985. "Special issue on Computer Music." ACM Computing Surveys 17(2). New York: ACM Press. Contains good overviews of many aspects of computer music.

"Proceedings of the 1977-1992 International Computer Music Conferences." San Francisco: International Computer Music Association. A shelf-full of our literature; must-have.

Baggi, D. ed. 1992. "Readings in Computer-Generated Music." New York: IEEE Press. Has several important articles on modern applications.

The Computer Music Library Starter Kit

Roads, C. and J. Strawn. 1985. "Foundations of Computer Music." MIT Press.

Roads, C. ed. 1989. "The Music Machine." MIT Press.

Davis, D. 1990. "A Computer Music Bibliography." A-R Editions (2 volumes).

Hewlett, W., and E. Selfridge-Field, eds. 1985-1992. "Directory of Computer Assisted Research in Musicology." Center for Computer Assisted Research in the Humanities. (7 volumes).

"Proceedings of the 1977-1992 International Computer Music Conferences." International Computer Music Association.

Roads, C. ed. 1985. "Composers and the Computer." A-R Editions.

De Poli, G., A. Piccialli, and C. Roads, eds. 1991. "Representations of Musical Signals." MIT Press.

Pierce, J. R. 1992. (revised edition) "The Science of Musical Sound." W. H. Freeman.

Benade, A. H. 1990 "Fundamentals of Musical Acoustics." Dover Press.

Deutsch, D. 1982. "The Psychology of Music." Academic Press.

Oppenheim, A.V. and R.W. Schafer, 1989. "Discrete-Time Signal Processing" Prentice Hall.

Strawn, J. ed. 1985. "Digital Audio Signal Processing: An Anthology." A-R Editions.

Pohlmann, K. 1989. "Principles of Digital Audio". Howard W Sams.

Moore, F. R., 1990. "Elements of Computer Music." Prentice-Hall.

Rothstein, J. 1991. "MIDI: A Comprehensive Introduction." A-R Editions.

Pope, S. T. ed. 1990. "The Well-Tempered Object." MIT Press.

Todd, P. M., and D. G. Loy. eds. 1992. "Music and Connectionism." MIT Press.

Balaban, M. K. Ebcioglu, and O. Laske. 1992. "Understanding Music with AI: Perspectives on Music Cognition." MIT Press.

Rowe, R. 1992. "Interactive Music Systems." MIT Press.

__Stephen Travis Pope

__Editor, Computer Music Journal

__Research Associate, Center for New Music and Audio Technologies (CNMAT)

__Department of Music, U. C.Berkeley

__stp@CNMAT.Berkeley.edu, (510) 644-3881

APPENDIX B

Wayne Slawson Tables for Speech Synthesis

These are taken from Slawson's article "A Speech-Oriented Synthesizer" in the Journal of Music Theory, 1968

The FON Tables:

This table includesw the FON names and the transfer function lookup numbers over time from FON.TF 1-4. The FON names are english phonetic representations of vowel sounds. Points 1-4 seem to function within an ADSR (attack-decay-sustain-release) model as follows: 1) onset of the note, 2) peak of the attack, 3) end of the steady state, and 4) end of note. As I have not read the article, I do not know what SKLNBR and FNMODE refer to.

A slash between two vowels (ie. A/E) represents a steady state vowel somewhere between the two.

An asterisk following a vowel (ie U*) indicates an extra low frequency bass reflex resonance.

A single quote before a name (ie ' I) indicates noise excitation.

A), Y, W, D, B, and G preceeding or following vowels are indications of dynamic consonant spectrum

envelope transitions during attack or release transients.

Two vowels in a single name notffset by ) or / (ie. AU) indicates a dipthong with a changing spectral

envelope.

FON name FON.TF 1 FON.TF 2 FON.TF 3 FON.TF 4 SKLNBR FNMODE

1 NEUT 8 8 8 8 1 0

2 U 10 10 10 10 1 0

3 I 11 11 11 11 1 0

4 A 18 18 18 18 1 0

5 O 16 16 16 16 1 0

6 A/E 14 14 14 14 1 0

7 A/O 9 9 9 9 1 0

8 *U 17 17 17 17 1 0

9 AU 9 9 10 10 1 0

10 IU 11 11 10 10 1 0

11 AI 9 9 11 11 1 0

12 OU 16 16 10 10 1 0

13 UA 10 10 9 9 1 0

14 U* 7 7 7 7 1 0

15 I* 12 12 12 12 1 0

16 YU 11 10 10 10 1 0

17 WI 10 11 11 11 1 0

18 YUI 11 10 11 11 1 0

19 YU*I* 11 7 12 12 1 0

20 WIU 3 11 10 10 1 0

21 A)U 2 10 10 10 1 0

22 A)I 2 11 11 11 1 0

23 A)UI 2 10 11 11 1 0

24 A)IU 2 11 10 10 1 0

25 A)NEUT 2 8 8 8 1 0

26 UI 11 11 10 10 1 0

27 DA 5 6 18 18 2 0

28 DI 5 6 11 11 2 0

29 BA/E 13 9 14 14 4 0

30 BI 13 11 11 11 4 0

31 BA 13 18 18 18 4 0

32 BA/O 13 15 9 9 4 0

33 BO 13 17 16 16 4 0

34 BA/EG 13 9 14 14 5 0

35 BAG 13 18 18 18 5 0

36 BA/OG 13 9 9 9 5 0

37 BOG 13 17 16 16 5 0

38 WIU* 3 11 7 7 1 0

39 ' I 4 4 4 4 3 1

40 ' A 18 18 18 18 3 1

41 ' U 3 3 3 3 3 1

42 ' NEUT 1 1 1 1 3 1

43 ' A)IA 9 11 9 9 3 1

44 ' A)UA 9 10 9 9 3 1

45 ' OU 16 16 10 10 3 1

46 ' AI 18 18 11 11 3 1

Transfer Function Tables:

transfer functions to access from the FON table—includes bandwidth and center frequency pairs for the first four formants. I am not sure what the amplitude factor does as I have not read the article but the bw and cf information has been useful anyway.

TF # bw 1 cf 1 bw 2 cf 2 bw 3 cf 3 bw 4 cf 4 Amp Factor

1 50 650 50 1950 50 3250 50 4550 2.0

2 50 1050 50 1300 50 3250 50 4550 .72

3 50 325 50 910 50 2860 50 4550 8.0

4 50 325 50 2860 50 3900 50 4810 1.0

5 150 150 100 2860 100 3900 100 4810 1.0

6 50 150 100 2860 100 3000 100 4810 1.0

7 70 80 50 220 100 550 200 2500 300.0

8 50 500 100 1500 150 2500 150 3500 2.0

9 150 800 150 1000 200 2500 300 3500 2.0

10 50 200 70 700 150 2200 150 3500 10.0

11 50 200 100 2200 150 3000 150 3700 5.0

12 70 80 50 220 100 2200 150 3000 300.0

13 70 100 100 1300 150 2300 200 3500 5.0

14 150 800 150 1800 200 2500 300 3500 0.8

15 70 600 90 900 150 2500 200 3500 3.0

16 150 500 150 850 200 2500 300 3500 6.0

17 150 350 150 700 150 2500 300 3500 7.0

18 150 800 150 1300 200 2500 300 3500 2.0