// title: Using MultiSliderView to control the harmonics of a wavetable // author: zecraum // description: // example by James McCartney extracted from the mailing list: https://listarc.cal.bham.ac.uk/lists/sc-users-2003/msg05160.html // code: // 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)}); )