JMSL Tutorial: JSyn and JMSL, JSynUnitVoiceInstrument
The easiest way to play JSyn with JMSL is to use JMSL's JSynUnitVoiceInstrument which is in the package com.softsynth.jmsl.jsyn2
JSynUnitVoiceInstrument's constructor takes the maximum polyphony and the class name of a JSyn Circuit which implements UnitVoice:
JSynUnitVoiceInstrument ins = new JSynUnitVoiceInstrument(8, com.jsyn.instruments.SubtractiveSynthVoice.class.getName());
It rolls this into a JMSL Instrument that automatically allocates voices and plays this JSyn Circuit.
JSynUnitVoiceInstrument will create a DimensionNameSpace from the inputs of the Circuit. We will see how to control all of these inputs in a moment but first, let's perform it is with a simple 4-dimensional MusicShape (duration, pitch, amplitude, hold). Note that pitch is "midi-style" 0..127, and fractional pitches like 60.5 are OK. Amplitude is 0..1
The most important code is shown here.
MusicShape myShape = new MusicShape(4); // simple 4 dims
myShape.useStandardDimensionNameSpace();
JMSLMixerContainer mixer = new JMSLMixerContainer();
mixer.start()
ins = new JSynUnitVoiceInstrument(8, com.jsyn.instruments.SubtractiveSynthVoice.class.getName());
mixer.addInstrument(ins);
myShape.setInstrument( ins );
(C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved
JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.