A powerful subclass of JSynInsFromClassName, called SynthNoteAllPortsInstrument gives you this control. You may want to review the tutorial on DimensionNameSpace before proceeding.
When SynthNoteAllPortsInstrument is handed a SynthNote, it "sniffs out" all its input ports and builds a DimensionNameSpace, keeping dimensions 0..3 the standard duration, pitch, amplitude, hold, and assigning dimensions higher than 3 to these custom input ports. Our TutSquare had one extra input port called rate, so we will see that in Dimension 4.
DimensionNameSpace built by SynthNoteAllPortsInstrument for tutorial.TutSquare
0 | duration |
1 | pitch |
2 | amplitude |
3 | hold |
4 | rate |
Note that besides the four common names "duration", "pitch", "amplitude",
and "hold", that one additional dimension name show up as well (in bold
above). This is unique to TutSquare and was discovered by SynthNoteAllPortsInstrument.
Now any MusicShape that has rate values in dimension 4 can use this instrument
to control this parameter. You could add these values by hand like
so...
// add an event with 5 second duration, pitch 60, amp = 0.5, hold = 4.8 sec, rate = 2.0 (fast attack)
myShape.add(5.0, 60, 0.5, 4.8, 2.0);
The applet below plays a hand-coded MusicShape with
a SynthNoteAllPortsInstrument that uses TutSquare
The essential code follows:
ins = new SynthNoteAllPortsInstrument(8, "jmsltutorial.TutSquare"); // construct a new MusicShape with the same DimensionNameSpace as the instrument myShape = new MusicShape(ins.getDimensionNameSpace()); myShape.add(5.0, 60, 0.5, 4.8, 2.0); // fast attack rate = 2.0
myShape.add(5.0, 70, 0.5, 4.8, 0.1); // slow attack rate = 0.1
myShape.setInstrument(ins);
View complete source
Previous | Tutorial Index | Tutorial Contents | Next |
(C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.