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

instr twst_tf_resony
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq twst_tf_freq 
	kbw = twst_param:k("bandwidth")
	inum = twst_parami("num")
	ksep = twst_param:k("separation")
	isepmode = twst_parami("sepmode")
	ibalance = twst_parami("balance")

	if (ileft == 1) then
		aLr resony aL, kfreq, kbw, inum, ksep, isepmode
		if (ibalance == 1) then
			aL balance aLr, aL
		else
			aL = aLr
		endif
	endif
	if (iright == 1) then
		aRr resony aR, kfreq, kbw, inum, ksep, isepmode
		if (ibalance == 1) then
			aR balance aRr, aR
		else
			aR = aRr
		endif
	endif
	outs aL, aR
endin

instr twst_tf_resonx
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq twst_tf_freq 
	kbw = twst_param:k("bandwidth")
	inum = twst_parami("num")
	ibalance = twst_parami("balance")

	if (ileft == 1) then
		aLr resonx aL, kfreq, kbw, inum
		if (ibalance == 1) then
			aL balance aLr, aL
		else
			aL = aLr
		endif
	endif
	if (iright == 1) then
		aRr resonx aR, kfreq, kbw, inum
		if (ibalance == 1) then
			aR balance aRr, aR
		else
			aR = aRr
		endif
	endif
	outs aL, aR
endin

instr twst_tf_streson
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq twst_tf_freq 
	kfeedback = twst_param:k("feedback")
	if (ileft == 1) then
		aL streson aL, kfreq, kfeedback
	endif
	if (iright == 1) then
		aR streson aR, kfreq, kfeedback
	endif
	outs aL, aR
endin

instr twst_tf_mvmfilter
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreq = twst_param:k("freq")
	kdecay = twst_param:k("decay")
	kbalance = twst_param:k("balance")
	if (ileft == 1) then
		aLf mvmfilter aL, kfreq, kdecay
		if (kbalance == 1) then
			aL balance aLf, aL
		else
			aL = aLf
		endif
	endif
	if (iright == 1) then
		aRf mvmfilter aR, kfreq, kdecay
		if (kbalance == 1) then
			aL balance aRf, aR
		else
			aR = aRf
		endif
	endif
	outs aL, aR
endin

instr twst_tf_harmon
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kestfreq = twst_param:k("estfreq")
	kmaxvar = twst_param:k("maxvar")
	kgenfreq1 = twst_param:k("genfreq1")
	kgenfreq2 = twst_param:k("genfreq2")
	iminfreq = twst_parami("minfreq")
	ianalysistime = twst_parami("analysistime")
	if (ileft == 1) then
		aL harmon aL, kestfreq, kmaxvar, kgenfreq1, kgenfreq2, 0, iminfreq, ianalysistime
	endif
	if (iright == 1) then
		aR harmon aR, kestfreq, kmaxvar, kgenfreq1, kgenfreq2, 0, iminfreq, ianalysistime
	endif
	outs aL, aR
endin

instr twst_tf_formantharmon
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kgenfreq1 = twst_param:k("genfreq1")
	kgenfreq2 = twst_param:k("genfreq2")
	kgenfreq3 = twst_param:k("genfreq3")
	kgenfreq4 = twst_param:k("genfreq4")
	iminfreq = octcps:i(twst_parami("minfreq"))
	ipolarity = twst_parami("polarity")

	ipupdate = twst_parami("pupdate")
	iplow = octcps:i(twst_parami("plowfreq"))
	iphigh = octcps:i(twst_parami("phighfreq"))
	ipthresh = dbamp:i(twst_parami("pthresh"))
	ipfrqs = twst_parami("pfrqs")
	ipconfirm = twst_parami("pconfirms")
	
	if (ileft == 1) then
		koct, kamp pitch aL, ipupdate, iplow, iphigh, ipthresh, ipfrqs, ipconfirm
		aL harmon4 aL, koct, kgenfreq1, kgenfreq2, kgenfreq3, kgenfreq4, 0, iminfreq, ipolarity
	endif
	if (iright == 1) then
		koct, kamp pitch aR, ipupdate, iplow, iphigh, ipthresh, ipfrqs, ipconfirm
		aR harmon4 aR, koct, kgenfreq1, kgenfreq2, kgenfreq3, kgenfreq4, 0, iminfreq, ipolarity
	endif
	outs aL, aR
endin