«Simple noise mixer with GUI» by pHJosef

on 24 Jan'21 20:02 in noisecolorfiltermixereq

a simple noise eq with 10 filter bands and a gui.

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
(
Ndef(\x).clear;
Ndef(\x, {
	|amp1 = 0, amp2 = 0, amp3 = 0, amp4 = 0, amp5 = 0, amp6 = 0,
	amp7 = 0, amp8 = 0, amp9 = 0, amp10 = 0, rq = 0.8|
	var freq1=36, freq2=75, freq3=157, freq4=329, freq5=688, freq6=1440, freq7 = 3013,
	freq8 = 6303, freq9=13184, freq10=18000;

	var sig = [PinkNoise.ar(1), PinkNoise.ar(1)];
	sig = BPeakEQ.ar(sig, freq1, rq, amp1);
	sig = BPeakEQ.ar(sig, freq2, rq, amp2);
	sig = BPeakEQ.ar(sig, freq3, rq, amp3);
	sig = BPeakEQ.ar(sig, freq4, rq, amp4);
	sig = BPeakEQ.ar(sig, freq5, rq, amp5);
	sig = BPeakEQ.ar(sig, freq6, rq, amp6);
	sig = BPeakEQ.ar(sig, freq7, rq, amp7);
	sig = BPeakEQ.ar(sig, freq8, rq, amp8);
	sig = BPeakEQ.ar(sig, freq9, rq, amp9);
	sig = BPeakEQ.ar(sig, freq10, rq, amp10);
	sig = Limiter.ar(sig * 0.1, 1, 0.01);

}).play;

try{~win.close};
~win = Window('noise mixer', Rect(400,400,600,300));
~win.front.alwaysOnTop_(true);
~reset = {
	b.value_(0.31);
	a.do{ |sl| sl.value_(0.5)};
	Ndef(\x).resetNodeMap;
};

a = {Slider(~win, Rect(0, 0, 20, 100)).value_(0.5)} ! 10;
b = Slider(~win, Rect(0, 00, 10, 10)).value_(0.31).action_({ |sl|
	Ndef(\x).set(\rq, sl.value.linlin(0, 1, 0.1, 3).postln)});
c = StaticText().string_("Filter Bands").align_(\center);
d = StaticText().string_("Q Factor").align_(\center);
e = Button().states_([["reset"]]).action_({ ~reset.value});

~win.layout = HLayout(
	VLayout(c, HLayout(*a)),
	VLayout(d, b),
	e
);

a.do{ |ins, c=0| c = c+1; ins.addAction({ |sl|
	~sl = sl.value;
	~low = -24;
	~high = 24;
	switch(c,
		1, {Ndef(\x).set(\amp1, ~sl.linlin(0, 1, ~low, ~high).postln)},
		2, {Ndef(\x).set(\amp2, ~sl.linlin(0, 1, ~low, ~high).postln)},
		3, {Ndef(\x).set(\amp3, ~sl.linlin(0, 1, ~low, ~high).postln)},
		4, {Ndef(\x).set(\amp4, ~sl.linlin(0, 1, ~low, ~high).postln)},
		5, {Ndef(\x).set(\amp5, ~sl.linlin(0, 1, ~low, ~high).postln)},
		6, {Ndef(\x).set(\amp6, ~sl.linlin(0, 1, ~low, ~high).postln)},
		7, {Ndef(\x).set(\amp7, ~sl.linlin(0, 1, ~low, ~high).postln)},
		8, {Ndef(\x).set(\amp8, ~sl.linlin(0, 1, ~low, ~high).postln)},
		9, {Ndef(\x).set(\amp9, ~sl.linlin(0, 1, ~low, ~high).postln)},
		10, {Ndef(\x).set(\amp10, ~sl.linlin(0, 1, ~low, ~high).postln)},

)});
}
)
raw 2229 chars (focus & ctrl+a+c to copy)
reception
comments
alln4tural user 28 Jan'21 16:14

very soothing, thanks!

alln4tural user 28 Jan'21 18:02

(var i = 10.rand, param = (\amp ++ (i + 1)).asSymbol, newval = (Ndef(\x).get(param) + 2.rand2).min(24).max(-24).debug(param), newrq; Ndef(\x).set(param, newval); a[i].value_(newval.linlin(-24, 24, 0, 1)); newrq = (Ndef(\x).get(\rq) + 0.2.rand2).min(4).max(0.05); Ndef(\x).set(\rq, newrq.debug("newrq")); b.value_(newrq.linlin(0.01, 4, 0, 1)))