aboutsummaryrefslogtreecommitdiff
path: root/site/udo/twist/transforms/filter.udo
blob: 38fad6978726a264892f24ea3d8dedc3e2398ffb (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
#include "/twist/transform_api.udo"

instr twst_tf_lpf
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("frequency")
	if (ileft == 1) then
		aL butterlp aL, kfreq
	endif
	if (iright == 1) then
		aR butterlp aR, kfreq
	endif
	outs aL, aR
endin

instr twst_tf_hpf
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("frequency")
	if (ileft == 1) then
		aL butterhp aL, kfreq
	endif
	if (iright == 1) then
		aR butterhp aR, kfreq
	endif
	outs aL, aR
endin

instr twst_tf_bpf
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("frequency")
	kbw = twst_param:k("bandwidth")
	if (ileft == 1) then
		aL butterbp aL, kfreq, kbw
	endif
	if (iright == 1) then
		aR butterbp aR, kfreq, kbw
	endif
	outs aL, aR
endin

instr twst_tf_pareq
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("frequency")
	kgain = twst_param:k("gain")
	kq = twst_param:k("q")
	if (ileft == 1) then
		aL pareq aL, kfreq, kgain, kq
	endif
	if (iright == 1) then
		aR pareq aR, kfreq, kgain, kq
	endif
	outs aL, aR
endin

instr twst_tf_dcblock
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	if (ileft == 1) then
		aL dcblock2 aL
	endif
	if (iright = 1) then
		aR dcblock2 aR
	endif
	outs aL, aR
endin

/* not in WASM
{
	name: "Non-linear filter",
	instr: "twst_tf_nlfilter",
	parameters: [
		{name: "Parameter a", channel: "pa", min: 0, max: 1, dfault: 0.3},
		{name: "Parameter b", channel: "pb", min: -1, max: 1, dfault: 0.1},
		{name: "Parameter d", channel: "pd", min: 0, max: 1, dfault: 0.7},
		{name: "Parameter C", channel: "pC", min: 0, max: 1, dfault: 0.12},
		{name: "Parameter L", channel: "pL", min: 1, max: 220, dfault: 20},
		{preset: "applymode"}
	]
},

instr twst_tf_nlfilter
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kpa = twst_param:k("pa")
	kpb = twst_param:k("pb")
	kpd = twst_param:k("pd")
	kpC = twst_param:k("pC")
	kpL = twst_param:k("pL")
	nfilt
	if (ileft == 1) then
		aL nfilt2 aL, kpa, kpb, kpd, kpC, kpL
	endif
	if (iright == 1) then
		aR nfilt2 aR, kpa, kpb, kpd, kpC, kpL
	endif
	outs aL, aR
endin
*/

instr twst_tf_mooghpf
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("freq")
	if (ileft == 1) then
		aL mvchpf aL, kfreq
	endif
	if (iright == 1) then
		aR mvchpf aR, kfreq
	endif
	outs aL, aR
endin

instr twst_tf_mooglpf
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("freq")
	kres = twst_param:k("resonance")
	kmode = twst_param:k("mode")
	if (ileft == 1) then
		if (kmode == 0) then
			aL mvclpf1 aL, kfreq, kres
		elseif (kmode == 1) then
			aL mvclpf2 aL, kfreq, kres
		elseif (kmode == 2) then
			aL mvclpf3 aL, kfreq, kres
		endif
	endif
	if (iright == 1) then
		if (kmode == 0) then
			aR mvclpf1 aR, kfreq, kres
		elseif (kmode == 1) then
			aR mvclpf2 aR, kfreq, kres
		elseif (kmode == 2) then
			aR mvclpf3 aR, kfreq, kres
		endif
	endif
	outs aL, aR
endin

instr twst_tf_waveguide1
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("freq")
	kcutoff = twst_param:k("cutoff")
	kfeedback = twst_param:k("feedback")
	if (ileft == 1) then
		aL wguide1 aL, kfreq, kcutoff, kfeedback
	endif
	if (iright == 1) then
		aR wguide1 aR, kfreq, kcutoff, kfeedback
	endif
	outs aL, aR
endin

instr twst_tf_tbvcf
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("freq")
	kres = twst_param:k("resonance")
	kdist = twst_param:k("dist")
	kasym = twst_param:k("asym")
	if (ileft == 1) then
		aL tbvcf aL, kfreq, kres, kdist, kasym
	endif
	if (iright == 1) then
		aR tbvcf aR, kfreq, kres, kdist, kasym
	endif
	outs aL, aR
endin