| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac -m128 |
| 4 |
--env:SSDIR+=../../SourceMaterials |
| 5 |
</CsOptions> |
| 6 |
<CsInstruments> |
| 7 |
sr = 44100 |
| 8 |
ksmps = 32 |
| 9 |
nchnls = 2 |
| 10 |
0dbfs = 1 |
| 11 |
|
| 12 |
;waveforms used for granulation |
| 13 |
giSoundL ftgen 1,0,1048576,1,"ClassGuit.wav",0,0,1 |
| 14 |
giSoundR ftgen 2,0,1048576,1,"ClassGuit.wav",0,0,2 |
| 15 |
|
| 16 |
seed 0; seed the random generators from the system clock |
| 17 |
gaSendL init 0 |
| 18 |
gaSendR init 0 |
| 19 |
|
| 20 |
instr 1 ; generates granular synthesis textures |
| 21 |
prints p9 |
| 22 |
;define the input variables |
| 23 |
kamp linseg 0,1,0.1,p3-1.2,0.1,0.2,0 |
| 24 |
ivoice = 64 |
| 25 |
iratio = 0.5 |
| 26 |
imode = 1 |
| 27 |
ithd = 0 |
| 28 |
ipshift = p8 |
| 29 |
igskip = 0.1 |
| 30 |
igskip_os = 0.5 |
| 31 |
ilength = nsamp(giSoundL)/sr |
| 32 |
kgap transeg 0,20,14,4, 5,8,8, 8,-10,0, 15,0,0.1 |
| 33 |
igap_os = 50 |
| 34 |
kgsize transeg 0.04,20,0,0.04, 5,-4,0.01, 8,0,0.01, 15,5,0.4 |
| 35 |
igsize_os = 50 |
| 36 |
iatt = 30 |
| 37 |
idec = 30 |
| 38 |
iseedL = 0 |
| 39 |
iseedR = 0.21768 |
| 40 |
ipitch1 = p4 |
| 41 |
ipitch2 = p5 |
| 42 |
ipitch3 = p6 |
| 43 |
ipitch4 = p7 |
| 44 |
;create the granular synthesis textures; one for each channel |
| 45 |
aSigL granule kamp,ivoice,iratio,imode,ithd,giSoundL,ipshift,igskip,\ |
| 46 |
igskip_os,ilength,kgap,igap_os,kgsize,igsize_os,iatt,idec,iseedL,\ |
| 47 |
ipitch1,ipitch2,ipitch3,ipitch4 |
| 48 |
aSigR granule kamp,ivoice,iratio,imode,ithd,giSoundR,ipshift,igskip,\ |
| 49 |
igskip_os,ilength,kgap,igap_os,kgsize,igsize_os,iatt,idec,iseedR,\ |
| 50 |
ipitch1,ipitch2,ipitch3,ipitch4 |
| 51 |
;send a little to the reverb effect |
| 52 |
gaSendL = gaSendL+(aSigL*0.3) |
| 53 |
gaSendR = gaSendR+(aSigR*0.3) |
| 54 |
outs aSigL,aSigR |
| 55 |
endin |
| 56 |
|
| 57 |
instr 2 ; global reverb instrument (always on) |
| 58 |
; use reverbsc opcode for creating reverb signal |
| 59 |
aRvbL,aRvbR reverbsc gaSendL,gaSendR,0.85,8000 |
| 60 |
outs aRvbL,aRvbR |
| 61 |
;clear variables to prevent out of control accumulation |
| 62 |
clear gaSendL,gaSendR |
| 63 |
endin |
| 64 |
|
| 65 |
</CsInstruments> |
| 66 |
<CsScore> |
| 67 |
; p4 = pitch 1 |
| 68 |
; p5 = pitch 2 |
| 69 |
; p6 = pitch 3 |
| 70 |
; p7 = pitch 4 |
| 71 |
; p8 = number of pitch shift voices (0=random pitch) |
| 72 |
; p1 p2 p3 p4 p5 p6 p7 p8 p9 |
| 73 |
i 1 0 48 1 1 1 1 4 "pitches: all unison" |
| 74 |
i 1 + . 1 0.5 0.25 2 4 \ |
| 75 |
"%npitches: 1(unison) 0.5(down 1 octave) 0.25(down 2 octaves) 2(up 1 octave)" |
| 76 |
i 1 + . 1 2 4 8 4 "%npitches: 1 2 4 8" |
| 77 |
i 1 + . 1 [3/4] [5/6] [4/3] 4 "%npitches: 1 3/4 5/6 4/3" |
| 78 |
i 1 + . 1 1 1 1 0 "%npitches: all random" |
| 79 |
|
| 80 |
i 2 0 [48*5+2]; reverb instrument |
| 81 |
</CsScore> |
| 82 |
</CsoundSynthesizer> |
| 83 |
;example written by Iain McCurdy |