JMSL Tutorial: MusicJob

Let's get a MusicJob to print a text message repeatedly.
We subclass MusicJob and override repeat() to do so.
We supply the full source of this class below, as this is the first complete JMSL example in the tutorial.

package jmsltutorial;

import com.softsynth.jmsl.*;

public class HardCodedMusicJob extends MusicJob {

/** Override repeat() to provide your own functionality */
 public double repeat(double playTime) {
     System.out.println("I am a MusicJob");
     return playTime;  // return completion time

 public static void main(String args[]) {
    HardCodedMusicJob myHardCodedMusicJob = new HardCodedMusicJob();    // build an instance of our class
    myHardCodedMusicJob.setRepeats(10);        // repeat 10 times
    myHardCodedMusicJob.setRepeatPause(1.5);   // wait 1.5 seconds between repeats
    myHardCodedMusicJob.launch(;    // fire away

Every instance of this subclass of MusicJob will print the same message. Next, we'll make the subclass more flexible.

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