Debian Codegraph @

src/Examples/FLOSS Manual Examples/01 Basics/01D12_humanising.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 2
9 0dbfs = 1
10 seed 0
11
12 giWave ftgen 0, 0, 2^10, 10, 1,0,1/4,0,1/16,0,1/64,0,1/256,0,1/1024
13
14 instr 1 ; an instrument with no 'humanising'
15 inote = p4
16 aEnv linen 0.1,0.01,p3,0.01
17 aSig poscil aEnv,cpsmidinn(inote),giWave
18 outs aSig,aSig
19 endin
20
21 instr 2 ; an instrument with 'humanising'
22 inote = p4
23
24 ; generate some i-time 'static' random paramters
25 iRndAmp random -3,3 ; amp. will be offset by a random number of decibels
26 iRndNte random -5,5 ; note will be offset by a random number of cents
27
28 ; generate some k-rate random functions
29 kAmpWob rspline -1,1,1,10 ; amplitude 'wobble' (in decibels)
30 kNteWob rspline -5,5,0.3,10 ; note 'wobble' (in cents)
31
32 ; calculate final note function (in CPS)
33 kcps = cpsmidinn(inote+(iRndNte*0.01)+(kNteWob*0.01))
34
35 ; amplitude envelope (randomisation of attack time)
36 aEnv linen 0.1*ampdb(iRndAmp+kAmpWob),0.01+rnd(0.03),p3,0.01
37 aSig poscil aEnv,kcps,giWave
38 outs aSig,aSig
39 endin
40
41 </CsInstruments>
42 <CsScore>
43 t 0 80
44 \#define SCORE(i) \#
45 i $i 0 1 60
46 i . + 2.5 69
47 i . + 0.5 67
48 i . + 0.5 65
49 i . + 0.5 64
50 i . + 3 62
51 i . + 1 62
52 i . + 2.5 70
53 i . + 0.5 69
54 i . + 0.5 67
55 i . + 0.5 65
56 i . + 3 64 \#
57 $$SCORE(1) ; play melody without humanising
58 b 17
59 $$SCORE(2) ; play melody with humanising
60 e
61 </CsScore>
62 </CsoundSynthesizer>
63 ;example by Iain McCurdy