Skip to content

Commit cb37265

Browse files
committed
clean main Faust script (second round)
1 parent dfbe49e commit cb37265

File tree

4 files changed

+42
-34
lines changed

4 files changed

+42
-34
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/build
22
/dist
3+
/faust
34
/plugin.so
45
/plugin.dylib
56
/plugin.dll

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ run: install
4949
src/faust/main-svg/process.svg:
5050
@echo
5151
@echo "Generating Faust diagrams..."
52-
faust2svg --simple-names --simplify-diagrams --fold-complexity 25 src/faust/main.dsp
52+
faust2svg --simple-names --simplify-diagrams --fold-complexity 8 src/faust/main.dsp
5353
@echo "Done."
5454
@echo
5555

autogen.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
class OnWriteHandler(pyinotify.ProcessEvent):
3535
def __init__(self, payload_command):
3636
print()
37-
self.print_current_file('initial run')
37+
print('==> initial run')
38+
print()
3839

3940
# initialise payload command
4041
self.payload_command = payload_command
@@ -69,7 +70,8 @@ def process_IN_CLOSE_WRITE(self, event):
6970
filename = event.path
7071

7172
# print name of changed file
72-
self.print_current_file(filename)
73+
print('==> ' + filename)
74+
print()
7375

7476
# run payload
7577
self.run_payload()
@@ -105,8 +107,7 @@ def exclude_directories(path):
105107

106108
# command to be run on payload. "unbuffer" pretends a TTY, thus
107109
# keeping escape sequences
108-
payload_command = \
109-
'make faust-clean && make faust'
110+
payload_command = 'make faust-clean && make faust'
110111

111112
# create an instance of "pyinotify"
112113
watchmanager = pyinotify.WatchManager()

src/faust/main.dsp

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,56 +43,59 @@ with
4343
vco(i_cv_pitch , btn) = internal_vco
4444
with
4545
{
46-
freq = i_cv_pitch : rack.i_cv_pitch2freq;
46+
freq = i_cv_pitch :
47+
rack.i_cv_pitch2freq;
4748

48-
internal_vco = (freq : os.saw2) , (freq : os.square) , (freq : os.triangle) : ba.selectn(3 , btn);
49+
internal_vco = freq <:
50+
os.saw2 , os.square , os.triangle :
51+
ba.selectn(3 , btn);
4952
};
5053

5154

5255
vcf(i_cv_cutoff , i_cv_resonance , btn , in) = internal_vcf
5356
with
5457
{
55-
cutoff = (i_cv_cutoff * 1.5) - 0.5 : rack.i_cv_pitch2freq;
56-
cutoff_limited = min(cutoff , (ma.SR / 2));
58+
cutoff = i_cv_cutoff * 1.5 - 0.5 :
59+
rack.i_cv_pitch2freq;
60+
cutoff_limited = min(cutoff , ma.SR / 2);
5761
resonance = max(i_cv_resonance * 5 , 0.1);
5862
gain = 1;
5963

60-
internal_vcf = (cutoff_limited , resonance , gain , in : fi.resonhp) ,
61-
(cutoff_limited , resonance , gain , in : fi.resonlp) :
64+
internal_vcf = cutoff_limited , resonance , gain , in <:
65+
fi.resonhp , fi.resonlp :
6266
ba.selectn(2 , btn);
6367
};
6468

6569

66-
voices(i_cv_pitch , i_cv_cutoff , i_cv_resonance) = internal_voices
70+
voice(i_cv_pitch , volume, knob_coarse , knob_fine, btn_waveform) = internal_voice
6771
with
6872
{
69-
i_cv_pitch_coarse_1 = int((knob_1 * 48) - 12) / 60 : si.smooth(1e-3);
70-
i_cv_pitch_fine_1 = (knob_2 - 0.5) / 30 : si.smooth(1e-3);
71-
72-
i_cv_pitch_coarse_2 = int((knob_3 * 48) - 12) / 60 : si.smooth(1e-3);
73-
i_cv_pitch_fine_2 = (knob_4 - 0.5) / 30 : si.smooth(1e-3);
73+
i_cv_pitch_coarse = int(knob_coarse * 48 - 12) / 60;
74+
i_cv_pitch_fine = (knob_fine - 0.5) / 30;
75+
i_cv_pitch_final = i_cv_pitch + (i_cv_pitch_coarse + i_cv_pitch_fine : si.smooth(1e-3));
7476

75-
i_cv_pitch_coarse_3 = int((knob_5 * 48) - 12) / 60 : si.smooth(1e-3);
76-
i_cv_pitch_fine_3 = (knob_6 - 0.5) / 30 : si.smooth(1e-3);
77+
internal_voice = i_cv_pitch_final , btn_waveform :
78+
volume , vco :
79+
vca;
80+
};
7781

78-
i_cv_pitch_final_1 = i_cv_pitch + i_cv_pitch_coarse_1 + i_cv_pitch_fine_1;
79-
i_cv_pitch_final_2 = i_cv_pitch + i_cv_pitch_coarse_2 + i_cv_pitch_fine_2;
80-
i_cv_pitch_final_3 = i_cv_pitch + i_cv_pitch_coarse_3 + i_cv_pitch_fine_3;
8182

82-
i_cv_cutoff_knob = knob_7 : si.smooth(1e-3);
83-
i_cv_cutoff_final = i_cv_cutoff + i_cv_cutoff_knob;
83+
voices(i_cv_pitch , i_cv_cutoff , i_cv_resonance) = internal_voices
84+
with
85+
{
86+
volume = -18 : ba.db2linear;
8487

85-
i_cv_resonance_knob = knob_8 : si.smooth(1e-3);
86-
i_cv_resonance_final = i_cv_resonance + i_cv_resonance_knob;
88+
voice_1 = voice(i_cv_pitch , volume , knob_1 , knob_2 , button_1 * 2);
89+
voice_2 = voice(i_cv_pitch , volume , knob_3 , knob_4 , button_2 * 2);
90+
voice_3 = voice(i_cv_pitch , volume , knob_5 , knob_6 , button_3 * 2 + 1);
8791

88-
voice(i_cv_pitch , btn) = i_cv_pitch , btn : (-18 : ba.db2linear) , vco : vca;
89-
mix(a1 , a2 , a3) = a1 + a2 + a3;
92+
i_cv_cutoff_final = i_cv_cutoff + (knob_7 : si.smooth(1e-3));
93+
i_cv_resonance_final = i_cv_resonance + (knob_8 : si.smooth(1e-3));
9094

91-
internal_voices = (i_cv_pitch_final_1 , (button_1 , 2 : *) : voice),
92-
(i_cv_pitch_final_2 , (button_2 , 2 : *) : voice) ,
93-
(i_cv_pitch_final_3 , (button_3 , 2 : * , 1 : +) : voice) : mix :
94-
i_cv_cutoff_final , i_cv_resonance_final , (button_4 , 2 : *) , _ : vcf :
95-
0.3 , 0.1 , _ : ef.cubicnl : fi.dcblocker;
95+
internal_voices = voice_1 + voice_2 + voice_3 :
96+
i_cv_cutoff_final , i_cv_resonance_final , button_4 * 2 , _ : vcf :
97+
0.3 , 0.1 , _ : ef.cubicnl :
98+
fi.dcblocker;
9699
};
97100

98101

@@ -154,5 +157,8 @@ with
154157
attach(_ , 0 : led_8_b) :
155158
_;
156159

157-
internal_processor = (in1 : gui_attacher) , in2 , in3 : voices : _ , in2 , in3 , in4 , in5 , in6 , in7 , in8 : si.bus(8);
160+
internal_processor = (in1 : gui_attacher) , in2 , in3 :
161+
voices :
162+
_ , in2 , in3 , in4 , in5 , in6 , in7 , in8 :
163+
si.bus(8);
158164
};

0 commit comments

Comments
 (0)