Use a MIDI controller (such as the Ozone) to control Supercollider.

// A quick refresher on keyDown - very similar to MIDI...
// In some of these cases, you may need to quit and restart SuperCollider in order to make the examples work.

keyDownAction_
(
var doc, txt;
doc = Document.current;
doc.keyDownAction_({arg doc, key, modifiers, num;
	var mykey;
	mykey= num;
	[doc, key, modifiers, num].postln;
	mykey.postln;
	if(mykey == 113, // 113 is 'q'
		{
				"hello".postln;
		},{
				"goodbye".postln;
		});
	});
)

// and turn it off!

(
Document.current.keyDownAction_(nil);
)

(
Document.current.keyDownAction_({arg doc, key, modifiers, num;
	var mykey;
//	[doc, key, modifiers].postln;
	mykey = num;
//	key.postln;
//	mykey.postln;
	if(mykey == 113,{
		{EnvGen.kr(Env.perc([0.05,0.001,1].choose, [0.1,0.2,1].choose, 1, -4), doneAction:2) * SinOsc.ar([600,720,300].choose, 0, 0.5)}.play;
		"bong".postln;
	});
	if(mykey == 119,{
		{EnvGen.kr(Env.perc([0.05,0.001,1].choose, [0.1,0.2,1].choose, 1, -4), doneAction:2) * PinkNoise.ar([0.2,0.4,0.6].choose)}.play;
		"chhhhhh".postln;
	});

})
)

MIDIIn

(
	MIDIIn.connect; 	// init for one port midi interface
// register functions:	
	MIDIIn.noteOff = { arg src, chan, num, vel; 	[chan,num,vel / 127].postln; };
	MIDIIn.noteOn = { arg src, chan, num, vel; 	[chan,num,vel / 127].postln; };
	MIDIIn.polytouch = { arg src, chan, num, vel; 	[chan,num,vel / 127].postln; };
	MIDIIn.control = { arg src, chan, num, val; 	[chan,num,val].postln; };
	MIDIIn.program = { arg src, chan, prog; 		[chan,prog].postln; };
	MIDIIn.touch = { arg src, chan, pressure; 	[chan,pressure].postln; };
	MIDIIn.bend = { arg src, chan, bend; 			[chan,bend - 8192].postln; };
	MIDIIn.sysex = { arg src, sysex; 			sysex.postln; };
	MIDIIn.sysrt = { arg src, chan, val; 			[chan,val].postln; };
	MIDIIn.smpte = { arg src, chan, val; 			[chan,val].postln; };
)

	MIDIIn.connect; 	// init for one port midi interface
	
noteOn_
// NB the values are not "strings" here, unlike in Document....
(
Server.local.boot;
MIDIIn.noteOn_({arg src, chan, num, val;
	num.postln;
	a = num;

	if(a == 78,{
		{EnvGen.kr(Env.perc, doneAction:2) * SinOsc.ar([600,720,300].choose, 0, 0.5)}.play;
		"hello".postln;
	});
	if(a == 79,{
		{EnvGen.kr(Env.perc, doneAction:2) * PinkNoise.ar(0.2)}.play;
	});
})
)

control_
(
Server.local.boot;
MIDIIn.control_({arg src, chan, num, val;
	num.postln;
	val.postln;
	if(val == "17",{
		{EnvGen.kr(Env.perc, doneAction:2) * SinOsc.ar([600,720,300].choose, 0, 0.5)}.play;
		"hello".postln;
	});
	if(val == "23",{
		{EnvGen.kr(Env.perc, doneAction:2) * PinkNoise.ar(0.2)}.play;
	});
})
)

control_
(
Server.local.boot;
MIDIIn.control_({arg src, chan, num, val;
	if(num == 74, {
	{EnvGen.kr(Env.new([0,1, 0.3, 0.8, 0], [0.1, 0.1, 0.1, 0.1],'linear'), doneAction:2) * SinOsc.ar(val*4.0, 0, 0.1)}.play;
	});
		
	if(num == 71,{
		{EnvGen.kr(Env.perc(0.001, val*0.01, 1, -4), doneAction:2) * PinkNoise.ar(0.2)}.play;
	});
})

)

MIDI Controlled Synth

// A nice example from the help file, you'll need to evaluate the synthDef first:
(
MIDIIn.connect;
s = Server.local;
s.boot;
s.latency = 0;

SynthDef("sik-goo", { arg freq=440,formfreq=100,gate=0.0,bwfreq=800;
	var x;
	x = Formant.ar(
			SinOsc.kr(0.02, 0, 10, freq), 
			formfreq,
			bwfreq
			);
	x = EnvGen.kr(Env.adsr, gate,Latch.kr(gate,gate)) * x;
	Out.ar(0, x);
}).send(s);

x = Synth("sik-goo");

//set the action:
MIDIIn.noteOn = {arg src, chan, num, vel;
				x.set(\freq, num.midicps / 4.0);
				x.set(\gate, vel / 200 );
				x.set(\formfreq, vel / 127 * 1000);
			};
MIDIIn.noteOff = { arg src,chan,num,vel;
				x.set(\gate, 0.0);
			};
MIDIIn.bend = { arg src,chan,val;
				//(val * 0.048828125).postln;
				x.set(\bwfreq, val * 0.048828125 );
			};
)

Writing to the Bus rather than Directly to the Synth

s = Server.local;
s.boot;

(
s.latency = 0;
SynthDef("moto-rev", { arg ffreq=100;
	var x;
	x = RLPF.ar(LFPulse.ar(SinOsc.kr(0.2, 0, 10, 21), [0,0.1], 0.1),
			 ffreq, 0.1)
			 .clip2(0.4);
	Out.ar(0, x);
}).send(s);

b = Bus.control(s);

x = Synth("moto-rev");

// map the synth's first input (ffreq) to read
// from the bus' output index
x.map(0,b.index);

MIDIIn.connect;
//set the action:
MIDIIn.noteOn = {arg src, chan, num, vel;
				b.value = num.midicps.postln;
			};

MIDIIn.control = {arg src, chan, num, val;
				[chan,num,val].postln;
			};
MIDIIn.bend = {arg src, chan, val;
				val.postln;
			};
)

// cleanup
x.free;
b.free;

Keyboard Split for two voices
pbend to cutoff, mod to rez, 7 to amp
// - matrix6k@somahq.com
prepare
s.boot;
(
SynthDef("funk",{ arg freq = 700, amp = 0.2, gate = 1, cutoff = 20000, rez = 1, lfospeed=0;
     var e,x,env,range,filterfreq;
	e = Env.new([0, 0.1, 0.1, 0], [0, 0.1, 0.1], 'linear', 2);
	env=Env.adsr(0.3,1,1,1);
	range = cutoff -1;
	filterfreq = SinOsc.kr(lfospeed,0, range, cutoff).abs;
	x = RLPF.ar(Mix.ar([
			Mix.arFill(2, {Saw.ar(freq *2 + 0.2.rand2, amp)}),
			Mix.arFill(2, {Saw.ar(freq *4+ 0.2.rand2, amp)})
			]),
			EnvGen.kr(env,gate)*filterfreq,
			rez);
     Out.ar([0,1],x * EnvGen.kr(e, gate, doneAction: 2))

}).send(s);

SynthDef("strings",{ arg freq = 700, amp = 0.2, gate = 1;
     var x,enve;
	enve = Env.new([0, 0.1, 0.1, 0], [2, 0.1, 1], 'linear', 2);
	x = RLPF.ar(Mix.ar([
					Mix.arFill(2, {Saw.ar(freq +2.rand2,0.6)}),
					Mix.arFill(2, {Saw.ar(freq *0.5 + 2.rand2,0.6)})
			]),
			6000,1);
     Out.ar([0,1],x * EnvGen.kr(enve, gate, doneAction: 2))

}).send(s);

)
then...
(
var keys, cutspec, cutbus, rezspec, rezbus, lfospec, lfobus;
keys = Array.newClear(128);

MIDIClient.init;
MIDIIn.connect(0, MIDIClient.sources.at(0));

g = Group.new;

cutspec = ControlSpec(100,10000,\linear,0.001);
cutbus = Bus.new(\control,1,1,s);
cutbus.value = 10000;

rezspec = ControlSpec(1,0,\linear,0.001);
rezbus = Bus.new(\control,2,1,s);
rezbus.value = 1.0;

lfospec = ControlSpec(0,50,\linear,0.001);
lfobus = Bus.new(\control,3,1,s);

MIDIIn.control = {arg src, chan, num, val;
			if(num == 1,{
				rezbus.value = rezspec.map(val/127.0);
			});
			if(num == 7,{
				lfobus.value = lfospec.map(val/127.0).postln;
			});
			};
MIDIIn.bend = {arg src, chan, val;
			cutbus.value = cutspec.map(val/16383.0);
			};

MIDIIn.noteOn = {arg src, chan, num, vel;
	var node;
	if(num < 60, {
		node = Synth.tail(g, "funk", [\freq, num.midicps, \amp, vel/255]);
		node.map("cutoff",1,"rez",2,"lfospeed",3);
//		node = Synth.basicNew("funk",s);
//		s.sendBundle(nil,
//			node.addToTailMsg(g,[\freq, num.midicps, \amp, vel/255]),
//			node.mapMsg("cutoff",1,"rez",2,"lfospeed",3)
//		);
		keys.put(num, node)
	},{ 
		node = Synth.tail(g, "strings", [\freq, num.midicps, \amp, vel/255]);
		keys.put(num, node)
	});
};

MIDIIn.noteOff = {arg src, chan, num, vel;
    var node;
    node = keys.at(num);
    if (node.notNil, {
        keys.put(num, nil);
        s.sendMsg("/n_set", node.nodeID, "gate", 0);
        // or node.release
        // then free it ... or get the NodeWatcher to do it
    });
};

)

mouseDownAction_
(

//add a mouse action to this document: 
//example: easy button:
//when you click in front of a 17 a SinOsc will start up;
Server.local.boot;
Document.current.mouseDownAction_({arg doc;
	var char;
	char = doc.rangeText(doc.selectionStart, 2);
	char.postln;
	if(char == "17",{
		{EnvGen.kr(Env.perc, doneAction:2) * SinOsc.ar([600,720,300].choose, 0, 0.5)}.play;
	});
	if(char == "23",{
		{EnvGen.kr(Env.perc, doneAction:2) * PinkNoise.ar(0.2)}.play;
	});
})

)
test here and click in front of the number:
		17
		23

Document.current.mouseDownAction_(nil);