-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPanoramix.dsp
executable file
·142 lines (96 loc) · 4.09 KB
/
Panoramix.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
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
declare name "Panoramix";
declare version "1.1";
declare author "Vincent Rateau";
declare license "GPL v3";
declare reference "www.sonejo.net";
declare description "Stereo Panorama/Balance and Volume Automation Tool.";
//Panoramix
import("stdfaust.lib");
process = bypassstereo : panoramix,_,_ :> _, _ : balancemeter : clipmeter ;
// main
panoramix = _*(inverter - oscil), _*(inverter2 - oscil)*(-volmode@avdelay) : balance : makeupgain : autovolstereo ;
// short break preventing clics for balance/volumemode
autovolstereo = _ * autovol, _ * autovol ;
autovol = (volmode==-1) - ((volmode==1)@avdelay) : an.amp_follower_ud(0.1, 0.1) ;
avdelay = 22050 ;
//osc inverter and volume mode
inverter = (volmode==1)@avdelay - invertbox * volmode@avdelay;
inverter2 = invertbox ;
invertbox = gui_invertbox : si.smooth(0.999);
volmode = gui_volmode , 1, -1 : select2 ;
// bpm to bps tools
bps = hgroup("[02]", bpm_slider : _/60 : multiplier : divider)
with{
bpm_slider = gui_bpm_slider ;
divider = _ / gui_devider ;
multiplier = _ * gui_multiplier;
};
// oscillator for balance/volume
oscil = autopanner : hgroup("[08]", bandwidth : smoothness) : _*(1-bypassbox) : gui_oscillator
with{
// for testing only
autopanner_test = sinuslive ;
sinuslive = (os.osc(bps) + 1) / 2 ;
//lfo choice
autopanner = synthchoice <: (_==0) * sinus, (_==1) * triangle, (_==2) * saw, (_==3) * square, (_==4) * random :> _ ;
synthchoice = gui_synthchoice ;
//lfos
sinus = (os.oscsin(bps) + 1) / 2 ;
saw = (os.lf_sawpos(bps)) ;
triangle = os.lf_trianglepos(bps) ;
square = os.lf_squarewavepos(bps) ;
random = no.lfnoise0(bps);
bandwidth = (_ - 0.5) * gui_bandwidth : _ + 0.5 : si.smooth(0.999) ;
smoothness = an.amp_follower_ud(smoothness_slider,smoothness_slider) ;
smoothness_slider = gui_smoothness : si.smooth(0.999) ;
};
//bypass
bypassstereo = bypassmono, bypassmono : myroute
with{
bypassmono = _ <: _ , _ : _*(1-bypassbox), _*bypassbox ;
myroute(a,b,c,d) = a,c,b,d ;
};
//this is outside the bypass function because of osc-bargraph * bypass-checkbox
bypassbox = gui_bypassbox : si.smooth(0.999);
// balance
//balance(a, b) = (a*(1-bal)), (b*(bal));
balance(a, b) = (a*(1-bal:sqrt)), (b*(bal:sqrt));
bal = gui_bal : si.smooth(0.999);
// output clip led
clipmeter = hgroup("[30]", outputclipL, outputclipR) ;
outputclipL = _ <: _, (an.amp_follower(1) <: _*(_>0.99) : hbargraph("L Clip",0,1)) : attach ;
outputclipR = _ <: _, (an.amp_follower(1) <: _*(_>0.99) : hbargraph("R Clip",0,1)) : attach ;
// extragain
makeupgain = _ *gainslider, _ *gainslider ;
gainslider = gui_gainslider : si.smooth(0.999);
// stereo balance meter
balancemeter = _,_ <: (_, _, stereometer) : (_ , _ , _) : (_, attach)
with{
//stereometer
stereometer = ampfollowers <: ratiou, ratiod : ranges : gui_stereometer ;
// amp follower for l and r
ampfollowers = an.amp_follower_ud(0.1,0.1), an.amp_follower_ud(0.1,0.1) ;
// ratio l/r
ratiou(l,r) = l / r : _*(-1) : _+(1);
// ratio r/l
ratiod(l,r) = r / l : _*(-1) : _+(2) : 1-_;
// use u if val >= 0, d if val < 0
ranges(u,d) = u * (u >= 0) + d * (d < 0);
};
// GUI
///////////////////////////
gui_bypassbox = checkbox("[00]Bypass") ;
gui_volmode = checkbox("[01]Balance/Volume Mode") ;
gui_bpm_slider = hslider("[03]Bpm[style:knob]",120,0,240,0.01) ;
gui_devider = nentry("[04]Beat/Period", 2,1,256,1) ;
gui_multiplier = nentry("[05]Speed Multiplier", 1,1,128,1) ;
gui_synthchoice = vslider("[06]LFO Type[style:menu{'sin':0 ; 'triangle':1 ; 'saw':2 ; 'square':3 ; 'random':4}]", 0,0,4,1) ;
gui_bandwidth = hslider("[07]Bandwidth[style:knob]",1,0.001,1,0.001) ;
gui_smoothness = hslider("[08]Smoothness[style:knob]",0,0,0.5,0.001) ;
gui_oscillator = hbargraph("[09]LFO",0 ,1) ;
gui_invertbox = checkbox("[10]Invert LFO") ;
gui_gainslider = hslider("[11]Make Up Gain", 1.5, 0, 3, 0.01);
gui_bal = hslider("[12]Balance",0.5,0,1,0.01) ;
gui_stereometer = hbargraph("[13]Stereo Balance Meter",-1,1) ;
// for testing only
synthtest = os.osc(440) <: _*0.9, _*0.9;