«Using MultiSliderView to control the harmonics of a wavetable» by zecraum

on 25 May'23 02:00 in guiwavetableharmonic seriessinusoid

example by James McCartney extracted from the mailing list: https://listarc.cal.bham.ac.uk/lists/sc-users-2003/msg05160.html

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
// Using MultiSliderView to control the harmonics of a wavetable

// example by James McCartney extracted from the mailing list
// https://listarc.cal.bham.ac.uk/lists/sc-users-2003/msg05160.html

(
var s, b, x, bufsize, secperbuf;
var w, ms, slid, cspec;
var changed, harmonics;

bufsize=128;

s = Server.local;

b=Buffer.alloc(s, bufsize, 1);

x = { arg rate=440;
        Osc.ar(b.bufnum, rate, 0, 0.2)
}.play;

harmonics=10;

w = Window("uiosc", Rect(200, 450, 20*harmonics+50,
150));
ms = MultiSliderView(w, Rect(0, 0, 20*harmonics,
100));

ms.value_(Array.fill(harmonics,0.0));
ms.isFilled_(true);
ms.valueThumbSize_(1.0);
ms.indexThumbSize_(10.0);
ms.gap_(10);

slid=Slider(w,Rect(20*harmonics+10, 0, 20, 100));
cspec= ControlSpec(70,1000, 'exponential', 10, 440);
slid.action_({x.set(\rate, cspec.map(slid.value)); });

slid.value_(0.3); slid.action.value;

w.front;

changed=false;

ms.action_({b.sine1(ms.value, false, true, true)});

)
raw 990 chars (focus & ctrl+a+c to copy)
reception
comments
zecraum user 25 May'23 14:00

I missed some reference, the original code is by the username nikolai collinsky and the modified version by james mccartney