«The mysteries of quantization» by simoncornaz

on 27 Aug'15 11:22 in quantization

GUI to play with quantization

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
(

var quant=0.5, tol=0.5, strenght=0.5;

Window.closeAll;
w=Window.new.alwaysOnTop_(true).front;

f={
	b.value=a.value.collect(_.quantize(quant, tol, strenght))
};

w.layout_(
	VLayout([
		HLayout(
			StaticText().string_("quantum"),
			Slider().value_(quant).action_({arg self; quant=self.value.postln; f.()}),
			StaticText().string_("tolerance"),
			Slider().value_(tol).action_({arg self; tol=self.value.postln; f.()}),
			StaticText().string_("strength"),
			Slider().value_(strenght).action_({arg self; strenght=self.value.postln; f.()})
		),stretch:1],
		[VLayout(
			HLayout(
				a=MultiSliderView()
				.elasticMode_(true)
				.value_((0..100)/100)
				.action_(f),
				Button().action_({
					a.value=(0..100)/100;
					f.();
				})
			),
			b=MultiSliderView()
			.editable_(false)
			.elasticMode_(true)
			.value_(a.value)
		),stretch:1]
	)
);
)
raw 898 chars (focus & ctrl+a+c to copy)
reception
comments
wondersluyter user 06 Oct'15 23:53

Cool!