l; The first character in this line is a command to the preprocessor to pass the remainder of the line as a literal
l; The next character is the Csound comment character. These two lines will appear in the csound input file
l; Name: next8. 03/25/04 8:47am
l;
l; Current Title: Next Piece
l;
@ The @ sign is a comment command. The rest of the line is ignored, and will not appear in the csound input
@ The next section is passed as is to the csound input file.
l<CsoundSynthesizer>
l
l<CsOptions>
l-W -G -m2 -+y -o sflib\next8.wav
l</CsOptions>
l
l<CsInstruments>
l sr = 44100
l ksmps = 10 ; any higher than 10 and I hear clicks - use 1 for final take
l; typically save 5x processing time by increasing ksmps by 10x
l nchnls = 2
l
l instr 1
l
l; p1 is always 1
l; p2 start time
l; p3 duration
l; p4 velocity, 60-80 works best
l; p5 tone - which tone is this note - 1-43 for Partch scale
l; p6 Octave
l; p7 voice
l; p8 stereo - pan from left = 0 to right = 16
l; p9 envelope - one of several function tables for envelopes 1 - 16
l; p10 glissando - one of several function tables to modify pitch
l; p11 upsample - use a sample higher (>0) or lower (<256) than normal
l;
l ifunc table p7,1 ; find the location of the sample wave tables
l iwavchan table p7,2 ; is it mono (iwavchan = 1) or stereo sample file (iwavchan = 2)
l ; or are sustain points in separate table iwavchan=3
l ioct = p6+3 ; I am used to Middle C = 6
l inum = p6*12 + int(p5/43*12) ; convert to MIDI note number to pick ftable
l ifno2 table inum, ifunc ; map midi note number to ftables
l ifno = ifno2 + (p11 < 128 ? p11 : p11-256) ; offset the chosen ftable by parameter 11
l iamp = ampdb(p4) ; velocity input is 60-80 - convert to amplitude
l i9 = 298-p9 ; valid envelope table number are 298, 297, 296, 295 etc.
l i10 = 301+p10 ; valid glissando table number are 301, 302, etc
l kamp oscili iamp, 1/p3, i9 ; create an envelope from a function table
l kpanl tablei p8/16, 4, 1 ; pan with a sine wave using f table #4
l kpanr tablei 1.0 - p8/16, 4, 1; inverse of kpanl
l ibasno table ifno-(3+ifunc), 1 + ifunc ; get basnot for each ftable
l icent table ifno-(3+ifunc), 2 + ifunc ; get cents to flatten each note
l iloop table ifno-(3+ifunc), 3 + ifunc ; get loop or not
l ibasoct = ibasno/12 + 3 ; find the base octave
l ibascps = cpsoct(ibasoct+(icent/1200))
l ipitch table p5, 3 ; convert note number 1-43 to oct.fract format
l kcps = cpspch(ioct+ipitch) ; convert oct.fract to Hz
l kcpsm oscili 1, 1/p3, i10 ; create an set of shift multiplicands from table
l kcps2 = kcps * kcpsm ; shift the frequency by values in glissando table
l print p1,p5,p6,inum,p7,p11,ifno2,ifno,iwavchan,iloop
l ; Four choices: Mono looping, stereo looping, mono no-loop, stereo no-loop
l if iwavchan = 5 goto akaister
l if iwavchan = 4 goto akaimono
l akaister:
l if iloop = 0 goto noloops
l ; print p7, ifno,ibascps,iloop,i10,iwavchan
l a1,a2 loscil kamp, kcps2, ifno, ibascps; stereo sample with looping
l ; ihertz = cpspch(ioct+ipitch) ; what frequency are you trying to make
l ; print p5, p6, ihertz, ifno ; show me the tone, octave, frequency, and function table containing the sample
l ; a3 oscili kamp/2, kcps, 4 ; make a square wave to compare the sample frequency to
l ; a4 = a1 + a3 ; add the sample to the square wave right
l ; a5 = a2 + a3 ; and left
l outs a1 * kpanl ,a2 * kpanr
l ; outs a4 * kpanl ,a5 * kpanr ; if you need to have a comparison oscilator for pitch matching
l goto skipstereo
l noloops:
l a1,a2 loscil kamp, kcps2, ifno, ibascps,0,1,2 ; stereo sample without looping - note that 1,2 is bogus workaround
l outs a1 * kpanl ,a2 * kpanr
l goto skipstereo
l akaimono:
l if iloop = 0 goto noloopm
l a1 loscil kamp, kcps2, ifno, ibascps; mono AIFF sample with loop
l outs a1 * kpanl ,a1 * kpanr
l goto skipstereo
l noloopm:
l a1 loscil kamp, kcps2, ifno, ibascps,0,1,2 ; mono AIFF sample without loop
l outs a1 * kpanl ,a1 * kpanr
l
l skipstereo:
l endin
l</CsInstruments>
l
l<CsScore>
l; The next function table transforms a note number into a cpsoct value
l; These are the values required for the Partch 43 tone scale
lf3 0 64 -2 .0000000 .0021506 .0053273 .0084467 .0111731 .0150637 .0165004
l.0182404 .0203910 .0231174 .0266871 .0294135 .0315641 .0347408 .0386314 .0417508
l.0435084 .0470781 .0498045 .0519551 .0551318 .0582512 .0617488 .0648682 .0680449
l.0701955 .0729219 .0764916 .0782492 .0813686 .0852592 .0884359 .0905865 .0933129
l.0968826 .0996090 .1017596 .1034996 .1049363 .1088269 .1115533 .1146727 .1178494
l.1200000
l; the next function table is for stereo panning
lf4 0 1025 9 .25 1 0 ;The first quadrant of a sin
l; glissando function tables
l; 1st take 2nd take 3rd take 4th take 5th take 6th take sum of takes = size of table
l; these are useful for taking a note up or down an octave without moving the sample up or down - built in munchkinization
lf301 0 256 -7 1 256 1 ; g0 = no change; g1 oct up 1; g2 oct up 2; g3 oct down 1
lf302 0 256 -7 .75 256 .75 ; g1 down 4/3
lf303 0 256 -7 1.5 256 1.5 ; g2 up 3/2
lf304 0 256 -7 .5 256 .5 ; g3 1 octave down no slide
lf305 0 256 -7 1.111111 256 1.111111 ; g4 up 10:9
lf306 0 256 -7 .9090909 256 .9090909 ; g5 down 11:10
lf307 0 1024 -7 1 512 1 0 1.09090909 256 1.09090909 0 .8571429 256 .8571429 0 ; g6 1 2 6 = F G-- D++
lf308 0 1024 -7 1 512 1 0 1.1 256 1.1 0 .9166667 256 .9166667 0 ; g7 2 3 1 = G-- Ab F
lf309 0 1024 -7 1 512 1 0 1.111111 256 1.111111 0 .9090909 256 .9090909 0 ; g8 3 4 2 = Ab A# G--
lf310 0 1024 -7 1 512 1 0 1.125 256 1.125 0 .9000000 256 .9000000 0 ; g9 4 5 3 = A# C Ab
lf311 0 1024 -7 1 512 1 0 1.14285714 256 1.14285714 0 .8888889 256 .8888888 0 ; g10 5 6 4 = C D++ A#
lf312 0 1024 -7 1 512 1 0 1.16666667 256 1.16666667 0 .8750000 256 .8750000 0 ; g11 6 1 5 = D++ F C
lf315 0 129 -6 1 4 1 4 1 16 1.3750 16 1.7500 4 1.7300 4 1.7100 4 1.7300 4 1.7500 4 1.7300 4 1.7100 4 1.7300 4 1.7500 4 1.7300 4 1.7100 4 1.7300 4 1.7500 4 1.7300 4 1.7100 4 1.7300 4 1.7500 4 1.7300 4 1.7100 4 1.7300 4 1.7500 4 1.7300 4 1.7100 ; g14
lf316 0 129 -6 1 4 1 4 1 16 1.2500 16 1.5000 4 1.4800 4 1.4600 4 1.4800 4 1.5000 4 1.4800 4 1.4600 4 1.4800 4 1.5000 4 1.4800 4 1.4600 4 1.4800 4 1.5000 4 1.4800 4 1.4600 4 1.4800 4 1.5000 4 1.4800 4 1.4600 4 1.4800 4 1.5000 4 1.4800 4 1.4600 ; g15
lf317 0 129 -6 1 4 1 4 1 16 1.1667 16 1.3333 4 1.3133 4 1.2933 4 1.3133 4 1.3333 4 1.3133 4 1.2933 4 1.3133 4 1.3333 4 1.3133 4 1.2933 4 1.3133 4 1.3333 4 1.3133 4 1.2933 4 1.3133 4 1.3333 4 1.3133 4 1.2933 4 1.3133 4 1.3333 4 1.3133 4 1.2933 ; g16
lf318 0 129 -6 1 4 1 4 1 16 1.1250 16 1.2500 4 1.2300 4 1.2100 4 1.2300 4 1.2500 4 1.2300 4 1.2100 4 1.2300 4 1.2500 4 1.2300 4 1.2100 4 1.2300 4 1.2500 4 1.2300 4 1.2100 4 1.2300 4 1.2500 4 1.2300 4 1.2100 4 1.2300 4 1.2500 4 1.2300 4 1.2100 ; g17
lf319 0 129 -6 1 4 1 4 1 16 1.1000 16 1.2000 4 1.1800 4 1.1600 4 1.1800 4 1.2000 4 1.1800 4 1.1600 4 1.1800 4 1.2000 4 1.1800 4 1.1600 4 1.1800 4 1.2000 4 1.1800 4 1.1600 4 1.1800 4 1.2000 4 1.1800 4 1.1600 4 1.1800 4 1.2000 4 1.1800 4 1.1600 ; g18
lf320 0 129 -6 1 4 1 4 1 16 1.0714 16 1.1429 4 1.1229 4 1.1029 4 1.1229 4 1.1429 4 1.1229 4 1.1029 4 1.1229 4 1.1429 4 1.1229 4 1.1029 4 1.1229 4 1.1429 4 1.1229 4 1.1029 4 1.1229 4 1.1429 4 1.1229 4 1.1029 4 1.1229 4 1.1429 4 1.1229 4 1.1029 ; g19
lf321 0 129 -6 1 4 1 4 1 16 1.0625 16 1.1250 4 1.1050 4 1.0850 4 1.1050 4 1.1250 4 1.1050 4 1.0850 4 1.1050 4 1.1250 4 1.1050 4 1.0850 4 1.1050 4 1.1250 4 1.1050 4 1.0850 4 1.1050 4 1.1250 4 1.1050 4 1.0850 4 1.1050 4 1.1250 4 1.1050 4 1.0850 ; g20
lf322 0 129 -6 1 4 1 4 1 16 1.0556 16 1.1111 4 1.0911 4 1.0711 4 1.0911 4 1.1111 4 1.0911 4 1.0711 4 1.0911 4 1.1111 4 1.0911 4 1.0711 4 1.0911 4 1.1111 4 1.0911 4 1.0711 4 1.0911 4 1.1111 4 1.0911 4 1.0711 4 1.0911 4 1.1111 4 1.0911 4 1.0711 ; g21
lf323 0 129 -6 1 4 1 4 1 16 1.0500 16 1.1000 4 1.0800 4 1.0600 4 1.0800 4 1.1000 4 1.0800 4 1.0600 4 1.0800 4 1.1000 4 1.0800 4 1.0600 4 1.0800 4 1.1000 4 1.0800 4 1.0600 4 1.0800 4 1.1000 4 1.0800 4 1.0600 4 1.0800 4 1.1000 4 1.0800 4 1.0600 ; g22
lf324 0 129 -6 1 4 1 4 1 16 1.0833 16 1.1667 4 1.1467 4 1.1267 4 1.1467 4 1.1667 4 1.1467 4 1.1267 4 1.1467 4 1.1667 4 1.1467 4 1.1267 4 1.1467 4 1.1667 4 1.1467 4 1.1267 4 1.1467 4 1.1667 4 1.1467 4 1.1267 4 1.1467 4 1.1667 4 1.1467 4 1.1267 ; g23
lf325 0 129 -6 1 4 1 4 1 16 1.0455 16 1.0909 4 1.0709 4 1.0509 4 1.0709 4 1.0909 4 1.0709 4 1.0509 4 1.0709 4 1.0909 4 1.0709 4 1.0509 4 1.0709 4 1.0909 4 1.0709 4 1.0509 4 1.0709 4 1.0909 4 1.0709 4 1.0509 4 1.0709 4 1.0909 4 1.0709 4 1.0509 ; g24
lf326 0 129 -6 1 4 0.99 4 0.98 4 0.99 4 1 4 0.99 4 0.98 4 0.99 4 1 4 0.99 4 0.98 4 0.99 4 1 4 0.99 4 0.98 4 0.99 4 1 4 0.99 4 0.98 4 0.99 4 1 4 0.99 4 0.98 4 0.99 4 1 4 0.99 4 0.98 4 0.99 4 1 4 0.99 4 0.98 4 0.99 4 1 ; - g25 down & back vibrato
lf327 0 129 -6 1.01 4 1.00 4 0.99 4 1.00 4 1.01 4 1.00 4 0.99 4 1.00 4 1.01 4 1.00 4 0.99 4 1.00 4 1.01 4 1.00 4 0.99 4 1.00 4 1.01 4 1.00 4 0.99 4 1.00 4 1.01 4 1.00 4 0.99 4 1.00 4 1.01 4 1.00 4 0.99 4 1.00 4 1.01 4 1.00 4 0.99 4 1.00 4 1.01 ; g26
@
l; Envelopes
l; autoscale all following tables to 1
l;#7 0 siz 7 start take getto take getto take getto
lf297 0 1024 7 0 2 1024 990 512 32 0 ; e1 - Attack and decay slowly
l;#5 0 siz exp start take reach take reach
lf296 0 513 5 1024 512 1 ; e2 - exponential - dead piano
l;#6 0 siz exp min values mid val max val mid val min val mid val max val mid val min
lf295 0 129 6 0 8 .5 8 1 16 .6 16 .3 16 .5 16 .6 24 .3 24 0 ; e3 big hump, small hump
lf284 0 1025 6 1 1 1 1 1 192 .99 192 .98 16 .5 16 0 303 0 303 0 ; e14 hit and sustain 1/3 the normal length
lf282 0 1025 6 0 1 .2 1 .4 479 .7 479 1 32 .5 32 0 ; e16 sustain piano sound
l; set the tempo
lt0 5200 2872 5000
@ note names I use
@ in the tonality diamond
@ the dot in the first character position says "here comes a macro"
@ The name of the macro follows the dot, and the contents of the macro follows the space until the end of the line
.C t0
.C+ t1
.C++ t2
.C# t3
.Db t4
.D-- t5
.D- t6
.D t7
.D+ t8
.D++ t9
.D# t10
.Eb t11
.E-- t12
.E- t13
.E t14
.E+ t15
.E++ t16
.F- t17
.F t18
.F+ t19
.F++ t20
.F# t21
.Gb t22
.G-- t23
.G- t24
.G t25
.G+ t26
.G++ t27
.G# t28
.Ab t29
.A-- t30
.A- t31
.A t32
.A+ t33
.A++ t34
.A# t35
.Bb t36
.B-- t37
.B- t38
.B t39
.B+ t40
.B++ t41
.C- t42
@ McGill University Master Sample Set
@
@ Instruments available
@
@ 2 HARP-HARMONC 3 HARP 4 HARPSIC-STOP 5 HARPSI-4 FT 6 HARPSI-4+8FT 7 HARPSI-8 FT
@ 8 MARIMBA 9 OBOE-BAROQUE 10 OBOE 11 PIPES-CORNET 12 PIPES-fLUTE 13 PIPE-PEDALS
@14 PIPES-PLENUM 16 PIPES-PRINZ 17 PIPES-REEDS 20 GRAND PIANO FF 107 GRAND PIANO MF
@21 PEDAL PIANO FF 107 PEDAL PIANO MF 23 PIANO HARMON 24 PLUCKEDPIANO 25 PICCOLO W-VB
@26 PICCOLO 27 RECRDER-ALTO 28 RECRDER-BARQ 29 SOP.BRQ.RDRQ 30 BASSINETT 31 BASS RECORDR
@32 RECRDR-QUART 33 SOPRANO RCRD 34 SHAWM-ALTO 35 TROMBONE-BS 36 TROMBONE-MTD 37 TROMBONE-ALT
@38 TROMBONE-TNR 39 TRUMPET-BACH?? 40 TRUMPET-C 41 TUBA 42 TUBULAR BELL 43 TYMPANI-HARD
@45 TYMPANI-SOFT 46 TYMPANI-WOOD 47 VIBRAPHONE 48 BASS VIOL 49 TREBLE VIOL 50 VIOLA-BOWED
@51 VIOLA-MARTEL 52 VIOLA-PIZZ 53 VIOLA W-VIB 54 VIOLIN-BOWnovib 55 VIOLIN-HARM 56 VIOLIN-MART
@57 VIOLIN-PIZZ 58 VIOLIN W-VIB 60 VIOLIN ENSM 61 VIOL.ENS.HRM 62 VIOL.ENS.MRT 63 VIOL.ENS.PIZ
@65 XYLOPHONE 66 Piano MF 67 Piano FF 68 Oberheim 70 ARCHLUTE 71 BASSOON
@72 CELESTA 73 CELLOMARTELE 74 CELLO PIZZ 75 CELLO W-VIB 76 BS. CLARINET 77 B- CLARINET
@78 E- CLARINET 79 C. CLARINET 80 CLASS.GTR.HM 81 PONTICEL.GTR 82 SULTASTO GTR 83 CLASS.GUITAR
@84 CONTf.BASSOON 85 TRBL.CORNETT 87 CROTALES 88 CRUMHORNS 90 DBL.BS.MRTLE 91 DB.BASS PIZZ
@92 DOUBLE BASS 93 ENGLISH HORN 94 A.FLUTE W-VB 95 ALTO FLUTE 96 B.FLUTE W-VB 97 BASS FLUTE
@98 FLUTTERFLUTE 99 FLUTE W-VIB 100 FLUTE NO-VIB 101 FR.HORN-MUTE 102 FRENCH HORN 103 GLOCKENSPIEL
@ Each channel needs an instrument. Channels are numbered from 0 to 16, instruments listed above
@ The next two lines define channels 1 & 2 to be tenor trombones, instrument number 38 in mcgill.dat file
n1m38
n2m38
@ 107 pedal piano MF
n3m107
@ define a bunch of macros used later in the piece
@ Major keys in the diamond: A# Ab G-- F D++ C
@ C__maj C D+ E F++ G A++
@ note that macro contents can include other macros to indefinite depth
@ The next few macros allow us to refer to notes as steps in the c major scale, instead of numbers
.c__maj1-1 &C.
.c__maj1-2 &D+.
.c__maj1-3 &E.
.c__maj1-4 &F++.
.c__maj1-5 &G.
.c__maj1-6 &A++.
@ 3 in a row up - define some chords
.c__maj3u-a135 &c__maj1-1.o+1 &c__maj1-3. &c__maj1-5.
.c__maj3u-b246 &c__maj1-2.o+1 &c__maj1-4. &c__maj1-6.
.c__maj3u-a351 &c__maj1-3. &c__maj1-5. &c__maj1-1.o+1
.c__maj3u-b462 &c__maj1-4. &c__maj1-6. &c__maj1-2.o+1
.c__maj3u-a513 &c__maj1-5. &c__maj1-1.o+1 &c__maj1-3.
.c__maj3u-b624 &c__maj1-6. &c__maj1-2.o+1 &c__maj1-4.
.pia-envl1 e1
@ piano octaves
@.side-0 s2
.side-1 s4
.side-2 s6
.side-3 s7
.side-4 s8
.side-5 s8
.side-6 s8
.side-7 s9
.side-8 s10
.side-9 s12
@.side-10 s15
.all-velx v87
.pia-vel1 &all-velx.v-1
.pia-vel2 &all-velx.v-4
.pia-oct5-0 o5u0
.tro-oct5-0 o5u0
.tro-oct5-1 o5u255
.tro-oct5-1 o5u254
.tro-velm0 &all-vel*.v-10e1
.tro-vell1 &all-vel*.v-6e1
.tro-vell2 &all-vel*.v-8e1
.tro-vels3 &all-vel*.v-10e1
.tro-hol8a h6
.tro-hol8b h8
.tro-hol8c h10
.tro-hol16a h12
.tro-hol16b h16
.tro-hol16c h24
.tro-hol24a h22
.tro-hol24b h24
.tro-hol32a h28
.tro-hol32b h32
.tro-hol32c h36
.tro-hol48b h48
.tro-hol64a h64
.tro-hol64b h70
.tro-hol96a h96
.tro-hol112a h112
.tro-hol112b h118
.tro-hol128a h120
.tro-hol128b h128
.tro-hol128c h144
.tro-hol192a h208
.tro-hol256a h268
.tro-holsh24a h8
.tro-holsh24b h12
.tro-holsh24c h16
.tro-holsh24d &tro-hol24*.
.tro-holsh48a h16
.tro-holsh48b h20
.tro-holsh48c h24
.tro-holsh48d &tro-hol48*.
@ initialize each
.tra c1&pat-int.z0r16&tro-oct*.g0&side-*.&tro-vels*.&pat-not.
.trb c2&pat-int.z0r16&tro-oct*.g0&side-*.&tro-vels*.&pat-not.
.pno c3&pat-int.z0r16&pia-env*.&pia-oct*.g0&side-*.&pia-vel*.&pat-not.
@ 33 means sequentially through the list forward 34 means backward
@ p1 means highly random, never repeat. p8 is random. p25 is repetitive. p32 is always repeats.
.pat-int p8
.pat-not p8
.pat-per p8
@ g0 = no change
@ g1 = down 4/3
@ g2 = up 3/2
@ g4 up 10:9
@ g5 down 11:10
@ when you use a macro, you can let the program chose which one to pick.
@End the specific with an * like this: &tro-hol128*.
@ might pick any that start with tro-hol128, including tro-hol128a, tro-hol128b, etc.
.tra128-c__maj1a d128&tro-hol128*.o+1&c__maj1-3.
.tra128-c__maj1b d96&tro-hol96*.o+1&c__maj1-1. &tro-hol32*.d32&c__maj1-2.
.trb128-c__maj1a &tro-hol128*.&tro-vell*.o+1&c__maj1-1.d128
.trb128-c__maj1b d32&tro-hol32*.&c__maj1-3. &tro-hol64*.d64&c__maj1-6. &tro-hol32*.d32&c__maj1-4.
.pno128-c__maj1a o-2d0e16h128o+1&c__maj3u-a*.d128
.pno128-c__maj1b o-2d0e16h128&c__maj1-1. o+1h32&c__maj3u-a*.d32 o-1d0h64&c__maj3u-b*.d64 o-1d0h32&c__maj3u-a*.d32
@ might pick tra128-c__maj1a or tra128-c__maj1b
.play1 &tra.&tra128-c__maj1*. &trb.&trb128-c__maj1*. &pno.&pno128-c__maj1*.
&play1. &play1. &play1. &play1.
&play1. &play1. &play1. &play1.