Package com.softsynth.jmsl
Interface Instrument
- All Superinterfaces:
Namable
,OutputProvider
,Transposable
- All Known Subinterfaces:
SignalProcessingInstrument
- All Known Implementing Classes:
BackgroundColorInstrument
,Brass
,FreqSynthNoteInstrument
,InstrumentAdapter
,JSynInsFromClassName
,JSynSimpleUnitVoiceInstrument
,JSynUnitVoiceInstrument
,LineInInstrument
,MaxInstrument
,MidiInstrument
,MidiScoreInstrument
,PitchBendInstrument
,QuietPlayLurkingInstrument
,RingMod
,SamplePlayingInstrument
,SimpleSamplePlayingInstrument
,SimpleSamplePlayingInstrumentWithAmplitudeMap
,SimpleSamplePlayingInstrumentWithLoops
,SineInstrument
,SuperNoiseSwoop
,SupoveVox
,SynthNoteAllPortsInstrument
,SynthNoteAllPortsInstrumentSP
,SynthNoteInstrument
,TransposingSamplePlayingInstrument
,TransposingSamplePlayingInstrumentWithAmplitudeMap
,TransposingSampleSustainingInstrument
,TunedSynthNoteInstrument
public interface Instrument extends Namable, OutputProvider, Transposable
Instrument interface.
Instruments are responsible for interpreting data in some way, in their play() method. A time stamp and an array of data is passed in to play(). The instrument does something (anything) with this data and returns an updated timestamp, corresponding to the duration of that event. For example, when launched, MusicShape iterates through each of its elements, handing each to its intrument's play() method. play() returns an updated timestamp to the MusicShape. The MusicShape sleeps until this time, then proceeds to the next element. In this way, MusicShape uses its Instrument to sonify multidimensional data.
You may alternatively call on(), update() [as many times as you like] and off() if your music does not fall into the play() model.
MusicJob and all subclasses have an Instrument. MusicShape uses it automatically when it iterates through its elements.
You will probably not need to implement this interface and instead extend InstrumentAdapter which implements it. Or most likely, you will use Instruments that come with JMSL like MidiInstrument if you are using MIDI, or of you are using JSyn, use JSynUnitVoiceInstrument or SamplePlayingInstrument.
Instruments are responsible for interpreting data in some way, in their play() method. A time stamp and an array of data is passed in to play(). The instrument does something (anything) with this data and returns an updated timestamp, corresponding to the duration of that event. For example, when launched, MusicShape iterates through each of its elements, handing each to its intrument's play() method. play() returns an updated timestamp to the MusicShape. The MusicShape sleeps until this time, then proceeds to the next element. In this way, MusicShape uses its Instrument to sonify multidimensional data.
You may alternatively call on(), update() [as many times as you like] and off() if your music does not fall into the play() model.
MusicJob and all subclasses have an Instrument. MusicShape uses it automatically when it iterates through its elements.
You will probably not need to implement this interface and instead extend InstrumentAdapter which implements it. Or most likely, you will use Instruments that come with JMSL like MidiInstrument if you are using MIDI, or of you are using JSyn, use JSynUnitVoiceInstrument or SamplePlayingInstrument.
- Author:
- Phil Burk and Nick Didkovsky (C) 2000-2017 Phil Burk and Nick Didkovsky, All Rights Reserved JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.
-
Method Summary
Modifier and Type Method Description double
close(double playTime)
DimensionNameSpace
getDimensionNameSpace()
Interpreter
getInterpreter()
java.lang.String
getMixerClassName()
get the preferred Mixer classname (if any) for this instrument.MusicDevice
getMusicDevice()
Get the MusicDevice associated with this Instrumentjava.lang.Object
off(double playTime, double timeStretch, double[] dar)
java.lang.Object
on(double playTime, double timeStretch, double[] dar)
turn an event on.double
open(double playTime)
double
play(double playTime, double timeStretch, double[] dar)
void
setDimensionNameSpace(DimensionNameSpace d)
void
setInterpreter(Interpreter interp)
void
setMixerClassName(java.lang.String mixerClassName)
set the preferred mixer classname (if any) for this instrumentvoid
setMusicDevice(MusicDevice dev)
Set the MusicDevice associated with this Instrumentdouble
update(double playTime, double timeStretch, double[] dar)
Methods inherited from interface com.softsynth.jmsl.OutputProvider
getNumOutputs, getOutput, getOutput
Methods inherited from interface com.softsynth.jmsl.Transposable
getTransposition, setTransposition
-
Method Details
-
setInterpreter
-
getInterpreter
Interpreter getInterpreter() -
open
double open(double playTime) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
close
double close(double playTime) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
on
java.lang.Object on(double playTime, double timeStretch, double[] dar)turn an event on. return an object associated with this (an allocated voice for example ) -
off
java.lang.Object off(double playTime, double timeStretch, double[] dar) -
play
double play(double playTime, double timeStretch, double[] dar) -
update
double update(double playTime, double timeStretch, double[] dar) -
setDimensionNameSpace
-
getDimensionNameSpace
DimensionNameSpace getDimensionNameSpace() -
setMusicDevice
Set the MusicDevice associated with this Instrument -
getMusicDevice
MusicDevice getMusicDevice()Get the MusicDevice associated with this Instrument -
getMixerClassName
java.lang.String getMixerClassName()get the preferred Mixer classname (if any) for this instrument. JSyn instruments, for example, would return "com.softsynth.jmsl.jsyn.JSynMixer" -
setMixerClassName
void setMixerClassName(java.lang.String mixerClassName)set the preferred mixer classname (if any) for this instrument
-