SY(\symbol) -- SYnth -- automatic creation


Where Fact and VC keep a voicer together with resources needed for synthesis, Fact and SY do the same thing for a plain synthdef. In the Factory, the make function must return the synthdef's name.


If you are allocating your own output bus and target group, store the bus in ~out and the target in ~target.


If you are using a MixerChannel for the target, you need only assign the MixerChannel object to ~target. ~out may remain empty.


You may use SY with any of the sequencing processes that normally use a voicer; the only requirement is that you must change the event key in the event for the process to be \synthNote rather than \voicerNote.



(make: {

~target = MixerChannel(\synthTest, s, 2, 2);

// if needed you may also create buffers and other resources here

// if you send a SynthDef, use .memStore instead of .send

// make function must return the synthdef name

\default

}, free: { ~target.free }) => Fact(\defaultSynth);


Fact(\defaultSynth) => SY(\default);


// something simple to play

b = MIDIRecBuf(\cmaj, [

#[60, 62, 64, 65, 67, 69, 71, 72],

0.25, 0.2, 0.5

].asNotes);


// most basic melody player, plays raw MIDI data with no extra processing

PR(\mel1) => BP(\test);

b => BP(\test); // give it the buffer

BP(\test) => SY(\default); // use the SY created above

BP(\test).event.eventKey = \synthNote; // must override \voicerNote here


BP(\test).play;


BP(\test).stop;


BP(\test).free;


SY(\default).free;