| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac -m128 |
| 4 |
--env:SSDIR+=../../SourceMaterials |
| 5 |
</CsOptions> |
| 6 |
<CsInstruments> |
| 7 |
sr = 44100 |
| 8 |
ksmps = 16 |
| 9 |
nchnls = 2 |
| 10 |
0dbfs = 1 |
| 11 |
|
| 12 |
; waveform used for granulation |
| 13 |
giSound ftgen 1, 0, 0, 1, "ClassGuit.wav", 0, 0, 0 |
| 14 |
|
| 15 |
; window function - used as an amplitude envelope for each grain |
| 16 |
; (first half of a sine wave) |
| 17 |
giWFn ftgen 2, 0, 16384, 9, 0.5, 1, 0 |
| 18 |
|
| 19 |
instr 1 |
| 20 |
kamp = 0.1 |
| 21 |
ktimewarp expon p4,p3,p5 ; amount of time stretch, 1=none 2=double |
| 22 |
kresample line p6,p3,p7 ; pitch change 1=none 2=+1oct |
| 23 |
ifn1 = giSound ; sound file to be granulated |
| 24 |
ifn2 = giWFn ; window shaped used to envelope every grain |
| 25 |
ibeg = 0 |
| 26 |
iwsize = 3000 ; grain size (in sample) |
| 27 |
irandw = 3000 ; randomization of grain size range |
| 28 |
ioverlap = 50 ; density |
| 29 |
itimemode = 0 ; 0=stretch factor 1=pointer |
| 30 |
prints p8 ; print a description |
| 31 |
aSigL,aSigR sndwarpst kamp,ktimewarp,kresample,ifn1,ibeg, \ |
| 32 |
iwsize,irandw,ioverlap,ifn2,itimemode |
| 33 |
outs aSigL,aSigR |
| 34 |
endin |
| 35 |
|
| 36 |
</CsInstruments> |
| 37 |
|
| 38 |
<CsScore> |
| 39 |
;p3 = stretch factor begin / pointer location begin |
| 40 |
;p4 = stretch factor end / pointer location end |
| 41 |
;p5 = resample begin (transposition) |
| 42 |
;p6 = resample end (transposition) |
| 43 |
;p7 = procedure description |
| 44 |
;p8 = description string |
| 45 |
; p1 p2 p3 p4 p5 p6 p7 p8 |
| 46 |
i 1 0 10 1 1 1 1 "No time stretch. No pitch shift." |
| 47 |
i 1 10.5 10 2 2 1 1 "%nTime stretch x 2." |
| 48 |
i 1 21 20 1 20 1 1 \ |
| 49 |
"%nGradually increasing time stretch factor from x 1 to x 20." |
| 50 |
i 1 41.5 10 1 1 2 2 "%nPitch shift x 2 (up 1 octave)." |
| 51 |
i 1 52 10 1 1 0.5 0.5 "%nPitch shift x 0.5 (down 1 octave)." |
| 52 |
i 1 62.5 10 1 1 4 0.25 \ |
| 53 |
"%nPitch shift glides smoothly from 4 (up 2 octaves)\ |
| 54 |
to 0.25 (down 2 octaves)." |
| 55 |
i 1 73 15 4 4 1 1 \ |
| 56 |
"%nA chord containing three transpositions:\ |
| 57 |
unison, +5th, +10th. (x4 time stretch.)" |
| 58 |
i 1 73 15 4 4 [3/2] [3/2] "" |
| 59 |
i 1 73 15 4 4 3 3 "" |
| 60 |
e |
| 61 |
</CsScore> |
| 62 |
</CsoundSynthesizer> |
| 63 |
;example written by Iain McCurdy |