The easiest way to do DSP synthesis is to
use one of the MKSynthPatches in the
MKSynthPatch Library. These are general and
implement standard synthesis techniques.
MKOrchestra uses the same protocol as
MKMidi: (open, run,
stop, close, abort). First, you create and open the
MKOrchestra.
Then you create a MKSynthInstrument and
set its MKSynthPatch class (and, optionally,
synthPatchCount). Finally, you start the performance and run the
MKOrchestra:
MKSynthInstrument *synthIns; MKOrchestra *orch = [MKOrchestra newOnDSP: 0]; synthIns = [[MKSynthInstrument alloc] init]; [orch open]; [synthIns setSynthPatchClass: [Pluck class]]; [orch run]; [MKConductor startPerformance]; |
You can then send MKNotes (as explained
last class), from your user interface,
MKMidi, or a
MKPerformer. E.g.:
MKNote *aNote = [[MKNote alloc] init]; [aNote setDur: 1.0]; [MKConductor lockPerformance]; [[synthIns noteReceiver] receiveNote: aNote]; [MKConductor unlockPerformance]; |