JMSL Tutorial: MusicShape

Let's see how we can build our own MusicShape with data of our choice.

Each element in a MusicShape is actually an array of double. To add an element to a MusicShape you can call MusicShape's add() method with code like:

    MusicShape myMusicShape = new MusicShape(4);  // declare number of dimensions in constructor
    double dar[] = { 1.0, 65.0, 120.0, 0.75};
    myMusicShape.add( dar );
To save you time, MusicShape has a few conveniently overloaded add() methods that take variable numbers of parameters. So the above could also be accomplished this way:
    MusicShape myMusicShape = new MusicShape(4);  // declare number of dimensions in constructor
    myMusicShape.add(1.0, 65.0, 120.0, 0.75);
MusicShape's add() method supports up to ten parameters. For MusicShapes of more than 10 dimensions, you must use the first technique shown above (ie build an array of double and add() that).
 

Next we will build a MusicShape with random numbers and view it in JMSL's MusicShapeEditor.
 
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.