-
Notifications
You must be signed in to change notification settings - Fork 1
/
dj-channel.dsp
91 lines (75 loc) · 2.21 KB
/
dj-channel.dsp
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
import("stdfaust.lib");
/* Inverts a boolean value. Makes a 0 out of a one and a one out of zero. */
invertBool = _ : _ - 1;
low_cut = nentry("[0]low cut", 300, 1, 20000, 1) : si.smoo;
low_q = nentry("[1]low q", 6, 1, 16, 2);
mid_cut = nentry("[2]mid cut", 1500, 1, 20000, 1) : si.smoo;
high_q = nentry("[3]high q", 4, 1, 16, 1);
low_gain = hslider("[4]low_gain", 1, 0, 2, 0.001) : si.smoo;
low_kill = checkbox("[5]low_kill") : invertBool : si.smoo;
mid_gain = hslider("[6]mid_gain", 1, 0, 2, 0.001) : si.smoo;
mid_kill = checkbox("[7]mid_kill") : invertBool : si.smoo;
high_gain = hslider("[8]high_gain", 1, 0, 2, 0.001) : si.smoo;
high_kill = checkbox("[9]high_kill") : invertBool : si.smoo;
general_gain = hslider("gain", 1, 0, 10, 0.001) : si.smoo;
volume = vslider("volume", 1, 0, 1, 0.001) : si.smoo;
cue_a = checkbox("cue_a") : si.smoo;
cue_b = checkbox("cue_b") : si.smoo;
/* Splits a single signal into two signals at a given frequency (freq) with
* order of q
*/
splitMono(freq, q) = _ <:
fi.lowpass(q, freq),
fi.highpass(q, freq) :
_,_;
/* Same as splitMono but for a stereo signal */
split(freq,q) = _,_ :
splitMono(freq, q),
splitMono(freq, q):
_,_,_,_ <:
ba.selector(0, 4),
ba.selector(2, 4),
ba.selector(1, 4),
ba.selector(3, 4);
/* Splits a stereo signal into 6 signals, where the 1 & 2 signal are the low
* frequencies (everything below low_cut), the 3 & 4 are everything below mid_cut
* and 5 & 6 are the remaining high frequencies.
*/
ThreeBandSplitter = _,_ :
split((low_cut,mid_cut:min), 2) :
_,
_,
split((low_cut,mid_cut: max), 5) :
_,
_,
_,
_,
_,
_;
equalizer = _,_ :
ThreeBandSplitter :
gain(low_gain*low_kill),
gain(mid_gain*mid_kill),
gain(high_gain*high_kill) :>
_,
_;
/* Boost a mono signal */
gainMono(gain) = _ :
_ * gain :
_;
/* Boost a stereo signal */
gain(gain) = _,_ :
gainMono(gain),
gainMono(gain) :
_,
_;
/* This function enables or disables the signal for the cue channel.
* Internally the same as gain() but for the ease of readability.
*/
cue(activated) = gain(activated);
process = _,_ :
gain(general_gain) :
equalizer <:
gain(volume),
cue(cue_a),
cue(cue_b);