Java Music Specification Language


DEVELOPERS' NOTES

APPLETS

JMSL Applets require jmsl.jar in codebase. JMSL Applets that use JMSL's "score" notation package also require jscore.jar to be located in the codebase
JMSL v1.035 uses a new licensing scheme which no longer requires the deployment of special JMSL jars for your applets. You may upload your copies of jmsl.jar and jscore.jar to the codebase of your applets. Do not upload your license file (JMSL.lic)!!! Applets run in fully functional unlicensed mode when online. Do not upload your license file.

Including jar files
Put jmsl.jar in your codebase. If you are using JMSL's notation package, also include jscore.jar. Typical applet tag might look like this:

< applet code = "mypackage.MyClass.class"
    codebase="classes" 
    archive="jmsl.jar,jscore.jar" 
    width="800" 
    HEIGHT="600" >

Deploying a JMSL Score (music notation file) on the www
IMPORTANT! Read "Redistribution of jmsl.jar and jscore.jar" above!

JMSL Scores can be loaded into an applet and played back. Using JSyn instruments, your listeners will hear the piece exactly as it was composed.

You need to write no code at all. The utility class com.softsynth.jmsl.score.util.JMSLScoreApplet does what you need.

Save your score as a zip file (use the Save menu item, and in the File Dialog, type in a filename ending in ".zip" (no quotes). This will ensure a fast download.

Your Score must be located in your online "classes" directory (ie, the codebase of the applet). Pass the applet tag the parameter "URL" that points to your score.
 < applet code = "com.softsynth.jmsl.score.util.JMSLScoreApplet.class"
    codebase="classes" 
    archive="jmsl.jar, jscore.jar" 
    width="600" 
    HEIGHT="129" >
< param name = "URL" value ="JMSLScores/JSyn_piece_1.xml" >
 
 optional parameters:
 zoom  - a number 0..1 for score zoom.  Defaults 0.5
 advancetime - some number of seconds for JMSL advance time.  Defaults to 1.0 sec
 wrap - true or false, turns system wrap on/off. Defaults to false (no wrap)
 < /applet >
 
 
start() and stop()
Your Applet's start() and stop() methods are responsible for initialization and cleanup. Don't start MusicDevices or build MusicDevice dependent objects in init().

  • start() should include JMSL.setIsApplet(true); This prevents various support classes from making choices available that would violate applet security (like the record button on a JSyn mixer).

  • JMSL codebase Some support classes, like the JSyn sample loader, use JMSL.getCodeBase(). So include the following in start() if you need this support:
    	JMSL.setCodeBase(getCodeBase());
    
    For example, com.softsynth.jmsl.jsyn.SimpleSamplePlayingInstrument checks JMSL.getIsApplet(), and if true, loads sound files from a URL using JMSL.getCodeBase(), else loads from disk.

  • If you are using the EventScheduler, applet.start() needs to do the following:
    	JMSL.scheduler = new EventScheduler();
    	JMSL.scheduler.start();
    
    ... and applet.stop() needs to:
    	JMSL.scheduler.stop();
    
  • More on applet start() and stop()
    Timed events in Applet.stop() can overlap with timed events in Applet.start() (true in all browsers, especially so in Safari/OSX). This can cause problems when a page is refreshed. Your applet's stop() method may politely wait for a piece to finish before it closes its MusicDevices (a good idea!) and then stops the Event Scheduler. But with this wait comes the risk of start() colliding with the code executed in stop().
    Solution: Synchronize the body of your applet's stop() and start() methods to ensure that all of stop() executes before start() executes. This will prevent the termination code of JMSL's EventScheduler from colliding with the instantiation of a new one, for example. It will also prevent the closing of JMSL's MusicDevices to collide with opening them in start().
    For example:
     public void start() {
            synchronized (JMSL.class) {
                // IMPORTANT! Start with a new scheduler!
                JMSL.scheduler = new EventScheduler();
                JMSL.scheduler.start();
    			// other start code, open MusicDevices etc
                }
        }
        
         public void stop() {
            synchronized (JMSL.class) {
                myComposable.finishAll();
                try {
                    myComposable.waitForDone();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                JMSL.scheduler.stop();
                JMSL.closeMusicDevices();
            }
        }
        
  • MusicDevices
    You should always call JMSL.closeMusicDevices() in stop()


  • JScore
    If you are working with JMSL's score package, assuming you have opened a Score in a ScoreFrame, your applet.stop() method should do the following:
    scoreFrame.setVisible(false);
    scoreFrame.dispose();
    Score.deleteCanvas();
    SelectionBuffer.disposeEditFrame();
    
    For example:
        public void stop() {
            synchronized (JMSL.class) {
                removeAll();
                scoreFrame.setVisible(false);
                scoreFrame.dispose();
                Score.deleteCanvas();
                SelectionBuffer.disposeEditFrame();
                JMSL.scheduler.stop();
                JMSL.closeMusicDevices();
            }
        }
     

  • MusicClock
    Unless you open a JSynMusicDevice in your applet (which creates and sets a new JMSL.clock), you should set JMSL.clock = new DefaultMusicClock() in applet.start() so that when the page is revisited, the applet will start with a fresh clock.



  • JMSL PLUGINS

    JMSL v103 introduced jmsl plugins. These are classes that are located in the installation directory's jmsl_plugins subdirectory. jmsl_plugins is included in the classpath of JScore when a user launches it with custom script created by JMSLScriptMaker.jar (see the top of the general installation notes). This directory is scanned for:
  • com.softsynth.jsyn.SynthNote
  • Signal Processing com.softsynth.jsyn.SynthNote (ie SynthNotes with a public "input" SynthInput port
  • UnaryCopyBufferTransforms [com.softsynth.jmsl.score.UnaryCopyBufferTransform]
  • BinaryCopyBufferTransforms [com.softsynth.jmsl.score.BinaryCopyBufferTransform]
  • Note Properties Transforms [com.softsynth.jmsl.score.NotePropertiesTransform]
  • Score Operators [com.softsynth.jmsl.score.ScoreOperator]
  • Instruments [com.softsynth.jmsl.Instrument]

    You can develop any of the above, drag the class files into jmsl_plugins (maintaining directory == package name identities), and they will be scanned at startup. Hierarchical menus will be automatically created for your plugins

    JMSL Home
    (C) 1997 - 2004 Nick Didkovsky (didkovn@mail.rockefeller.edu) and Phil Burk, All Rights Reserved
    JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.