[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] new list member - with a ribbon controller



On Oct 23, 2007, at 5:52 PM, Tibor Páli wrote:

What would be the minimum code with BendResponder to get the incoming pitch bend ranging from 0-16383 to the frequency (of three octaves) of an oscillator and TouchResponder to convert 0-127 range for level of the osc? I think I only need these two and NoteOffResponder. Any documentation or example would be welcome. Anyway, I have to learn SC :-)

I think this is about as minimal as it gets. Kind of fun to use aftertouch as a volume control :)  I'll have to use that in a piece someday.

MIDIClient.init(3, 3);
MIDIClient.sources.do({ |src, i| MIDIIn.connect(i, src) });

SynthDef(\sine, { |freq, amp|
Out.ar(0, SinOsc.ar(freq, 0, amp) ! 2);
}).send(s);

~fbus = Bus.control(s, 1).set(440);
~ampbus = Bus.control(s, 1).set(0.5);

~fspec = ControlSpec(48.midicps, 84.midicps, \exp);
~ampspec = ControlSpec(0, 1, \amp);

~bendR = BendResponder({ |src, chan, value| ~fbus.set(~fspec.map(value / 16383)) });
~touchR = TouchResponder({ |src, chan, value| ~ampbus.set(~ampspec.map(value / 127).postln) });


~synth = Synth(\sine, [\freq, ~fbus.asMap, \amp, ~ampbus.asMap]);

~synth.free;

[~fbus, ~ampbus].do(_.free);
[~bendR, ~touchR].do(_.remove);


Nice sound on your site btw. I quite like Mahboonkrong encounter.

Thanks! It isn't SC, but I'm proud of that piece too.

hjh


: H. James Harkins

: jamshark70@xxxxxxxxxxxxxxxxx

: http://www.dewdrop-world.net

.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:


"Come said the Muse,

Sing me a song no poet has yet chanted,

Sing me the universal."  -- Whitman