This applet demonstrates a Player loaded with five MusicShapes, each with 3 elements. The Player uses UniformRandomBehavior to play a different MusicShape each time it repeats. We instantiate two SynthNoteAllPortsInstruments, and provide a gui button to swap them back and forth into the Player.
This is also a good opportnuity to present the MusicShape.prefab() method, which conveniently generates random MusicShape data. For dimensions indexed greater than 3, it generates random data between the low and high limits for that dimension.
Note that when the instrument switches from FilteredSawtoothBL to Brass,
the same MusicShape data is interpreted without a problem, even though
the MusicShape initially generated for FilteredSawtoothBL have seven
dimensions, while Brass uses 5. This is the power of DimensionNameSpace
and DimensionNameSpaceTranslator. Each time Player gets an element
from a MusicShape, it checks if the Instrument has a DimensionNameSpace.
If it does, it translates from the DimensionNameSpace of the MusicShape
to the DimensionNameSpace of the Instrument. That way, if a dimension
is named "cutoff", it will be used by FilteredSawtoothBL, and ignored by
View the source for this applet here.
You can set up a Player with custom Instruments and Interpreters three ways:
(C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.