JMSL Tutorial: Instruments and Interpreters

Here, we've declared a subclass of Instrument called PrintingInstrument, which overrides play() as described in the previous tutorial. We've also built a four dimensional MusicShape and plugged one of these PrintingInstruments into the MusicShape's Instrument. Here's how:
        
        myMusicShape.setInstrument(new PrintingInstrument());
The results are shown in the screenshot below. Note that the duration between printed lines is the first element in the array (ie. 1 sec, 1 sec, 0.5 sec, etc).
JMSL instrument printing elements of a MusicShape
View the complete source for this example here.
 

  (C) Phil Burk and Nick Didkovsky, All Rights Reserved
  JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.