Type in the classname: Assuming the SynthNote is in the CLASSPATH that launched JMSL Score, you can import the SynthNote by name as we did earlier with FilteredSawtoothBL (see Building your own JScore instrument, part 3).
Plugin approach (shows up in menu): You can alternatively put it in the jmsl_plugins folder. When ScoreFrame launches, it scans jmsl_plugins for SynthNotes and generates hierarchical menus for those it finds. IMPORTANT: If your YourSynthNote.class is in a package called patches, be sure to put the patches folder in the jmsl_plugins folder. That is, jmsl_plugins contains folder patches which contains YourSynthNote.class
The advantage to the Plugin approach is that once this SynthNote
class is in jmsl_plugins, it will be available as a menu item everytime
you run ScoreFrame.
Hard coding your instruments into a JMSL Score application
Recall that JScore has a powerful and simple API, so let's see how you could code instruments directly into a JScore application. We'll instantiate one of our new instruments and one FilteredSawtoothBL instrument, and build a JSyn Orchestra directly in Java code.
The essential code fragment is excerpted below, and the complete applet source is available as well.
JSynOrchestra orch = new JSynOrchestra(); orch.addInstrument(new JSynInsFromClassName(8, "jmsltutorial.SineSynthNote"), "Our Sine SynthNote"); orch.addInstrument(new JSynInsFromClassName(8, "com.softsynth.jsyn.circuits.FilteredSawtoothBL"), "Filtered Saw"); orch.buildMixerPanel(); ... score.setOrchestra(orch);Note that Orchestra's addInstrument() method takes a JMSLScoreInstrument and a friendly name as arguments. We create a JMSLScoreInstrument on the fly by using JScore's JSynInsFromClassName class, whose constructor takes the name of a SynthNote and its max polyphony. So with one line of code, you can import any SynthNote class directly into JScore, at the API level. Nice!
Next we will dig deeper into instrument design, and discover how to
gain more control over the timbre of your instruments.
(C) 2000 Nick Didkovsky and Phil Burk, All Rights Reserved JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.