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

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



I don't get anything going to the post window when I use the synth in
a Pbind.  There's nothing in there that sends anything to the post
window -- I don't know what's going on there.  I'm new to
SuperCollider (started learning it about two months ago), so I'm also
not sure what you mean by "139" the server.  The issue I see with your
MIDI code (which may not be the issue you're currently experiencing)
is that a noteOff might be trying to set a synth parameter for a synth
that isn't there.  The synth I gave you frees itself automatically
when it detects silence.  There may be a better way, but to do what
you want, I'd remove the DetectSilence UGen from the SynthDef and
write something like this:

a = Array.fill(128, { nil; });

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

m = NoteOffResponder(
	{
		arg src, chan, note, vel;
		a[note].free;
		a[note] = nil;
	},
	nil, nil, nil, nil
);

This should free the server resources automatically.  When you're done
using the Responders, just do:

n.remove;
m.remove;

I'm currently away from home, and have no MIDI controllers available
to me, so I can't test the MIDI code that I send you.  I'll try to
help where I can, though.

--Andrew

_______________________________________________
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/