aboutsummaryrefslogtreecommitdiff
path: root/site/app/feedback/feedback.csd
blob: 4a8a7f906fab27f782b03cae3e2093be82251ccc (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 16
nchnls = 2
0dbfs = 2
seed 0


#include "wavetables.udo"
#include "frequency_tools.udo"

gifbm_maxgain = 2

opcode fbm_param, k, Sijjp
	Sname, ichannel, imin, imax, iapplyportamento xin
	Schannel = sprintf("%s_%d", Sname, ichannel)
	krawval chnget Schannel
	if (iapplyportamento == 1) then
		kval port krawval, 0.005
	else
		kval = krawval
	endif
	SmodOnChannel = sprintf("%smodulating", Schannel)
	kmodulating chnget SmodOnChannel
	if (kmodulating == 1) then
		kmodwave = chnget:k(sprintf("%smodwave", Schannel))
		kmodfreq = chnget:k(sprintf("%smodfreq", Schannel))
		kmodamp = chnget:k(sprintf("%smodamp", Schannel))
		kmod = abs:k(oscilikt:k(kmodamp, kmodfreq, giwavetables[kmodwave]))
		kout = kval + (kmod * (imax - imin))
	else
		kout = kval
	endif
/*
	if (imin != -1) then
		chnset imin, Schannel ; safe set channel to minimum
		kout = max:k(kout, imin)
	endif

	if (imax != -1) then
		kout = min:k(kout, imax)
	endif
*/
	xout kout
endop


opcode fbm_fxinsert, a, aii
	asig, ichanindex, insertindex xin
	SchanAppend = sprintf("_%d_%d", ichanindex, insertindex)
	keffect = chnget:k(strcat("insert", SchanAppend))
	if (keffect == 1) then
		asig freqshift1 asig, chnget:k(strcat("fs_freq", SchanAppend))
	elseif (keffect == 2) then
		asig ringmod1 asig, chnget:k(strcat("rm_freq", SchanAppend))
	elseif (keffect == 3) then
		asig nreverb asig, chnget:k(strcat("rv_time", SchanAppend)), 0.5
	elseif (keffect == 4) then

	elseif (keffect == 5) then

	endif
	xout asig
endop


opcode fbm_channel, aaaaa, ai
	asig, ichannel xin
	ieqgainadd = 4
	keqh_gain = fbm_param("eqhighgain", ichannel, 0, gifbm_maxgain)
	keqm_gain = fbm_param("eqmidgain", ichannel, 0, gifbm_maxgain)
	keql_gain = fbm_param("eqlowgain", ichannel, 0, gifbm_maxgain)

	keqh_freq = fbm_param("eqhighfreq", ichannel, 20, 18000)
	keqm_freq = fbm_param("eqmidfreq", ichannel, 20, 18000)
	keql_freq = fbm_param("eqlowfreq", ichannel, 20, 18000)

	keqh_q = fbm_param("eqhighq", ichannel, 0.71, 0.9)
	keqm_q = fbm_param("eqmidq", ichannel, 0.71, 0.9)
	keql_q = fbm_param("eqlowq", ichannel, 0.71, 0.9)

	ksend1 = fbm_param("send1", ichannel, 0, gifbm_maxgain, 0)
	ksend2 = fbm_param("send2", ichannel, 0, gifbm_maxgain, 0)
	ksend3 = fbm_param("send3", ichannel, 0, gifbm_maxgain, 0)
	ksend4 = fbm_param("send4", ichannel, 0, gifbm_maxgain, 0)

	kprefade1 = fbm_param("prefade1", ichannel, 0, 1, 0)
	kprefade2 = fbm_param("prefade2", ichannel, 0, 1, 0)
	kprefade3 = fbm_param("prefade3", ichannel, 0, 1, 0)
	kprefade4 = fbm_param("prefade4", ichannel, 0, 1, 0)

	klowcut = fbm_param("lowcut", ichannel, 0, 1, 0)
	kmute = fbm_param("mute", ichannel, 0, 1, 0)
	kvolume = fbm_param("volume", ichannel, 0, gifbm_maxgain)
	
	asig dcblock asig
	asig += noise(0.01, 0)
	/*
	asig pareq asig, keql_freq, keql_gain * ieqgainadd, keql_q, 1, 1
	asig pareq asig, keqm_freq, keqm_gain * ieqgainadd, keqm_q, 0, 1
	asig pareq asig, keqh_freq, keqh_gain * ieqgainadd, keqh_q, 2, 1
	*/
	asig pareq asig, keql_freq, keql_gain * ieqgainadd, 0.7, 1
	asig pareq asig, keqm_freq, keqm_gain * ieqgainadd, 0.7, 0
	asig pareq asig, keqh_freq, keqh_gain * ieqgainadd, 0.7, 2
	asig pareq asig, keqh_freq, keqh_gain * ieqgainadd, 0.7, 2

	if (klowcut == 1) then
		asig butterhp asig, 75
	endif
	asig butterlp asig, 17000
	asig butterhp asig, 0.1
	
	;asig dam asig, 0.99, 0.9, 0.9, 0.01, 0.01

	kvolume *= (1 - kmute)
	asend1 = tanh(asig * ((kprefade1 == 1) ? ksend1 : ksend1 * kvolume))
	asend2 = tanh(asig * ((kprefade2 == 1) ? ksend2 : ksend2 * kvolume))
	asend3 = tanh(asig * ((kprefade3 == 1) ? ksend3 : ksend3 * kvolume))
	asend4 = tanh(asig * ((kprefade4 == 1) ? ksend4 : ksend4 * kvolume))
	

	asig fbm_fxinsert asig, ichannel, 0
	asig fbm_fxinsert asig, ichannel, 1

	asig tanh asig
	asig *= kvolume
	xout asig, asend1, asend2, asend3, asend4
endop




instr mixer
	a1 init 0
	a2 init 0
	a3 init 0
	a4 init 0

	aout1, a1s1, a1s2, a1s3, a1s4 fbm_channel a1, 0
	aout2, a2s1, a2s2, a2s3, a2s4 fbm_channel a2, 1
	aout3, a3s1, a3s2, a3s3, a3s4 fbm_channel a3, 2
	aout4, a4s1, a4s2, a4s3, a4s4 fbm_channel a4, 3
	a1 = 0
	a2 = 0
	a3 = 0
	a4 = 0

	icrosstalk = 0.0001

	a1 = a1s1 + a2s1 + a3s1 + a4s1
	a2 = a1s2 + a2s2 + a3s2 + a4s2
	a3 = a1s3 + a2s3 + a3s3 + a4s3
	a4 = a1s4 + a2s4 + a3s4 + a4s4
	
	a1 = a1 + (a2 * icrosstalk)
	a2 = a2 + (a1 * icrosstalk) + (a3 * icrosstalk)
	a3 = a3 + (a3 * icrosstalk) + (a4 * icrosstalk)
	a4 = a4 + (a3 * icrosstalk)
	aout = aout1 + aout2 + aout3 + aout4
	aout tanh aout
	aout pareq aout, 18000, 0.4, 0.7
	aout dcblock aout * 0.25
	aout butterlp aout, 17000
	aout limit aout, -1, 1
	outs aout, aout

#ifndef WEB
	chnset 0.01, "eqhighgain_0"
	chnset 10000, "eqhighfreq_0"
	chnset 0.71, "eqhighq_0"

	chnset 3.7, "eqmidgain_0"
	chnset 1100, "eqmidfreq_0"
	chnset 0.71, "eqmidq_0"

	chnset 6.4, "eqlowgain_0"
	chnset 550, "eqlowfreq_0"
	chnset 0.71, "eqlowq_0"

	chnset 1, "prefade1_0"
	chnset 1.1, "send1_0"
	chnset 1.1, "volume_0"
#end
endin

</CsInstruments>
<CsScore>
i"mixer" 0 36000
</CsScore>
</CsoundSynthesizer>