Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Synth.activity/synth.csd
blob: 0794b6ed495b2d133507604f107d36bdae1dcac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<CsoundSynthesizer>
<CsOptions>
-odac -iadc -d -m0 -b2048 -B4096 -+rtaudio=alsa -+rtmidi=alsa
</CsOptions>
<CsInstruments>
/* add -M0 if you have MIDI (possibly -+rtmidi=virtual) */ 
sr=44100
ksmps=64
nchnls=2

gamix init 0 
gkchk init 0
gkfun init 400
massign 1, 11


instr 11

gkchk = 1  /* activates MIDI input */
gkfun cpsmidib /* gets the key freq */

endin

/* oscillator 1 */
instr 1


kon init 1  /* initially ON */
if gkchk == 1 then /* if MIDI is present, checks for key press */
kon active 11      /* checks for  key press to control amp */
endif

iamp = p4
kamp init 0

kp chnget "pitch1"

kfun tonek gkfun*kp, 10

if kon == 0 then   
kamp = 0       /* amp = 0 if not ON */
else
kamp chnget "vol1"       /* otherwise amp comes from mixer */
endif
kamp tonek kamp, 10

asig  oscili  p4, kfun, 1
gamix = gamix +  asig*ampdb(kamp-100)

endin

instr 2

kon init 1
if gkchk == 1 then
kon active 11
endif

iamp = p4
kamp init 0

kp chnget "pitch2"

kfun tonek gkfun*kp, 10

if kon == 0 then
kamp = 0
else
kamp chnget "vol2"
endif
kamp tonek kamp, 10

asig   buzz  p4, kfun, sr/(2*kfun), 2
gamix = gamix +  asig*ampdb(kamp-100)
    
endin

instr 10

kon init 1  /* initially ON */
if gkchk == 1 then /* if MIDI is present, checks for key press */
kon active 11      /* checks for  key press to control amp */
endif

if kon == 0 then   
k1 = 0       /* fr = 0 if not ON */
else
k1 chnget "frequency"       /* otherwise amp comes from mixer */
endif

ain1,ain2   ins
ain = (ain1+ain2)/2
anoi  rand  16000

;k1  chnget "frequency"
kcf  port k1, 0.05
k2 chnget  "resonance"
kres tonek k2, 10
k3 chnget "noise"
knoi  tonek k3, 10
k4 chnget "mic"
kin   tonek k4, 10
asig = gamix + anoi*ampdb(knoi-100) + ain*ampdb(kin-100)
afil moogvcf2  asig, kcf, kres
      outs   afil*10,afil*10

gamix = 0
endin

instr 100
k1 init 1
kb1 chnget "osc1"

if kb1 == 1 then
if k1 == 1 then
event "i", 1, 0, -1, 16000
k1=0
endif
else 
if k1 == 0 then
event "i", -1, 0, -1, 16000
k1=1
endif
endif
k2 init 1
kb2 chnget "osc2"

if kb2 == 1 then
if k2 == 1 then
event "i", 2, 0, -1, 16000
k2=0
endif
else 
if k2 == 0 then
event "i", -2, 0, -1, 16000
k2=1
endif
endif

endin

</CsInstruments>
<CsScore>
f1 0 16384 10 1 .5 .4 .3 .2 .1 .05 .04 .03 .02 .01 .01 .01 .01
f2 0 16384 10 1

i10  0 60000
i100 0 60000

</CsScore>
</CsoundSynthesizer>