JMSL Tutorial: JSyn and JMSL, playing a SynthNote

Any JSyn circuit can be scheduled and controlled by JMSL.  There are special JMSL support classes for SynthNote, which is a subcass of SynthCircuit with frequency and amplitude ports defined.  You do not have to design SynthNotes in order to control them with JMSL, but there are some convenient tools that do much of the work for you if you do.

From whence the SynthNote? You may get it any number of ways:
1) Use a pre-built SynthNote that ships with JSyn (like com.softsynth.jsyn.circuits.FilteredSawtoothBL)
2) Design a SynthNote in Wire (JSyn's graphical patch editor), then export and compile the Java source for that patch
3) Write one from scratch.

We'll start with #1 here, using com.softsynth.jsyn.circuits.FilteredSawtoothBL which ships with JSyn.

The easiest way to play JSyn with JMSL is to use JMSL's JSynInsFromClassName which is in the package com.softsynth.jmsl.score.jsyn
JSynInsFromClassName's constructor takes the class name of a SynthNote and the maximum polyphony you want.  It rolls this into a JMSL Instrument that plays the SynthNote.

JSynInsFromClassName will play its synthnote with a 4 dimensional DimensionNameSpace ( duration, pitch, amplitude, hold ).  So a simple way to perform it is with a 4-dimensional MusicShape as shown in the applet below.

The most important code is shown here.
 

        // play FilteredSawtoothBL with a max polyphony of 8 voices.

        ins = new JSynInsFromClassName(8, "com.softsynth.jsyn.circuits.FilteredSawtoothBL");
            // connect the instrument to a JMSLMixerContainer
            mixer.addInstrument(ins);
            // hand the instrument to the MusicShape
            myShape.setInstrument( ins );

You need a Java-enabled browser to view this applet.

See complete applet source here
 
 
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.