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

Re: [sc-users] guitar synth controlled by midi



Give this code a shot.  You'll probably want to specify the
NoteOnResponder more for your own needs, and in particular, change the
velocity to amplitude function.

(

SynthDef(\guitar,
	{
		arg freq, amp, pan = 0;
		var out, pluck, period, string;
		
	       	pluck = PinkNoise.ar(Decay.kr(Line.kr(1, 0, 0.05), 0.05));
	        period = freq.reciprocal;
                string = CombL.ar(pluck, period, period, 4);
		out = LeakDC.ar(LPF.ar(string, 12000));
		
		DetectSilence.ar(out, 0.005, 1, 2);
		
		Out.ar(0, Pan2.ar(out, pan, amp));
       }
).send(s);

n = NoteOnResponder(
	{
		arg src, chan, note, vel;
		
		Synth(\guitar, [\freq, note.midicps, \amp, (vel/127).sqrt]);
		
	},
	nil,
	nil,
	nil,
	nil
);

)

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/