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

instr twst_tf_freqshift1
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kshift = twst_param:k("shift")
	if (ileft == 1 && iright == 1) then
		aL, aR freqshift1 aL, aR, kshift
	elseif (ileft == 1) then
		aL freqshift1 aL, kshift
	elseif (iright == 1) then
		aR freqshift1 aR, kshift
	endif
	outs aL, aR
endin

instr twst_tf_freqshift2
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kshift = twst_param:k("shift")
	if (ileft == 1 && iright == 1) then
		aL, aR freqshift2 aL, aR, kshift
	elseif (ileft == 1) then
		aL freqshift2 aL, kshift
	elseif (iright == 1) then
		aR freqshift2 aR, kshift
	endif
	outs aL, aR
endin

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

instr twst_tf_exciter
	$TWST_TRANSFORM
	aL, aR, ileft, iright twst_getinput
	kfreqlow = twst_tf_freq_custom("low")
	kfreqhigh = twst_tf_freq_custom("high")
	kharmonics = twst_param:k("harmonics")
	kblend = twst_param:k("blend")

	if (kfreqhigh < kfreqlow) then
		kfreqhigh = kfreqlow
	endif

	if (ileft == 1) then
		aL exciter aL, kfreqlow, kfreqhigh, kharmonics, kblend
	endif
	if (iright == 1) then
		aR exciter aR, kfreqlow, kfreqhigh, kharmonics, kblend
	endif
	outs aL, aR
endin