JMSL Tutorial: PlayLurkers
PlayLurkers are notified of children being played

PlayLurker is a JMSL interface which allows a class to be notified of children as they are being enumerated and played by a MusicJob or its subclasses. PlayLurkers implement the following method:
 public void notifyPlayLurker(double playTime, MusicJob list, int index)

The following classes support PlayLurker:
  • MusicList
  • MusicShape
  • ParallelCollection
  • SequentialCollection
  • QueueCollection

    These classes notify all their PlayLurkers every time they play a child, by calling notifyPlayLurker() . The PlayLurker can do what it wishes with this information. A PlayLurker could, for example, extract the pitch data from a MusicShape's element and arpeggiate it or harmonize it.
     public void notifyPlayLurker(double playTime, MusicJob list, int index) {
    	double[] data = ((MusicShape) list).get(index);
    	double pitch = data[1];
    	// do something with pitch
    	...
     }
    


    Examples:
    MusicShapeEditor makes use of this interface, using it to draw the vertical tracker line as a MusicShape is played.
    Score uses PlayLurker as well, to be notified of a Note when it is played so it can draw the "flashing" notehead.

    This applet demonstrates a PlayLurker and a MusicShape. The MusicShape performs a melody. The PlayLurker receives notification of each element as it is played. With some probability, the PlayLurker chooses to double the pitch with its instrument. The result is a ghostly sustained echoing of the melody.

    This tutorial is based on my realization of "Sabbath Bride". Sabbath Bride is a composition for Javanese gamelan by Jody Diamond, based on the traditional Jewish prayer, L'cha Dodi. A self-modifying score of this piece is at Punos Music.

    In ths version you can use the scrollbar to adjust the probability the PlayLurker uses to choose whether or not it doubles an element.

    Java must be enabled for this browser

    Source

    Previous Tutorial Index Tutorial Contents Next

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