Package com.softsynth.jmsl.jsyn
Class FreqSynthNoteInstrument
java.lang.Object
com.softsynth.jmsl.InstrumentAdapter
com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
- All Implemented Interfaces:
Instrument
,Namable
,OutputProvider
,Transposable
,UpdatableInstrument
- Direct Known Subclasses:
TunedSynthNoteInstrument
public class FreqSynthNoteInstrument extends InstrumentAdapter implements UpdatableInstrument
Deprecated.
use the pure Java JSyn2 package instead
A JMSL Instrument that plays a JSyn SynthNote.
Optional constructor passes in a BussedVoiceAllocator to make this polyphonic.
double[] passed to play must contain duration, frequency , amplitude, hold
duration and hold (sustain) is in seconds. amplitude is 0..1 update() can be used to change the amplitude of a sustain synthnote. on() and off() are implemented here, giving the user a finer grain of control over the instrument
Optional constructor passes in a BussedVoiceAllocator to make this polyphonic.
double[] passed to play must contain duration, frequency , amplitude, hold
duration and hold (sustain) is in seconds. amplitude is 0..1 update() can be used to change the amplitude of a sustain synthnote. on() and off() are implemented here, giving the user a finer grain of control over the instrument
- Author:
- Nick Didkovsky, Nick.Didkovsky@mail.rockefeller.edu (C) 2000 Nick Didkovsky, all rights reserved.
-
Field Summary
Fields Modifier and Type Field Description static int
insNum
Deprecated. -
Constructor Summary
Constructors Constructor Description FreqSynthNoteInstrument()
Deprecated.Constructor sets MusicDevice to JSynMusicDeviceFreqSynthNoteInstrument(BussedVoiceAllocatorMultiOut allocator)
Deprecated.polyphonic constructorFreqSynthNoteInstrument(com.softsynth.jsyn.SynthNote synthNote)
Deprecated.monophonic constructor -
Method Summary
Modifier and Type Method Description double
close(double time)
Deprecated.close your instrument, this stub does nothing and returns timeBussedVoiceAllocatorMultiOut
getAllocator()
Deprecated.int
getMaxVoices()
Deprecated.java.lang.String
getName()
Deprecated.int
getNumOutputs()
Deprecated.java.lang.Object
getOutput()
Deprecated.get this output (SynthOutput in the case of a JSyn Instrument, for examplejava.lang.Object
getOutput(int partNum)
Deprecated.boolean
getPolyphonic()
Deprecated.int
getUpdateDimension()
Deprecated.Get the dimension to match against when update() is called.static void
main(java.lang.String[] args)
Deprecated.Create a polyphonic, stereo instrument, and play a MusicShape with it.java.lang.Object
off(double playTime, double timeStretch, double[] dar)
Deprecated.Calls SynthNoteOff with the most recent SynthNote which was used to turn on the data in the arrayvoid
off(double playTime, com.softsynth.jsyn.SynthNote sn)
Deprecated.turn off a SynthNote at playTime and call allocator,free() This SynthNote should have been returned from on()java.lang.Object
on(double playTime, double timeStretch, double[] dar)
Deprecated.Allocate a SynthNote and call SynthNote.noteOn()double
open(double time)
Deprecated.open your instrument, this stub does nothing and returns timedouble
play(double playTime, double timeStretch, double[] dar)
Deprecated.Override on() and off() methods for Instrument class to provide custom interpretation of double[].void
setAllocator(BussedVoiceAllocatorMultiOut allocator)
Deprecated.Sets allocator and set polyphonic = truevoid
setMaxVoices(int n)
Deprecated.void
setName(java.lang.String n)
Deprecated.void
setSynthNote(com.softsynth.jsyn.SynthNote sn)
Deprecated.void
setUpdateDimension(int dim)
Deprecated.Set the dimension to match against when update() is called.double
update(double playTime, double timeStretch, double[] dar)
Deprecated.Update amplitude and frequency using (by default) dimension 1 as lookup to retrieve allocated synthnote.Methods inherited from class com.softsynth.jmsl.InstrumentAdapter
getDimensionNameSpace, getInterpreter, getMixerClassName, getMusicDevice, getTransposition, noteOff, noteOn, noteOnFor, setDimensionNameSpace, setInterpreter, setMixerClassName, setMusicDevice, setTransposition, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
insNum
public static int insNumDeprecated.
-
-
Constructor Details
-
FreqSynthNoteInstrument
public FreqSynthNoteInstrument()Deprecated.Constructor sets MusicDevice to JSynMusicDevice -
FreqSynthNoteInstrument
public FreqSynthNoteInstrument(com.softsynth.jsyn.SynthNote synthNote) throws com.softsynth.jsyn.SynthExceptionDeprecated.monophonic constructor- Throws:
com.softsynth.jsyn.SynthException
-
FreqSynthNoteInstrument
public FreqSynthNoteInstrument(BussedVoiceAllocatorMultiOut allocator) throws com.softsynth.jsyn.SynthExceptionDeprecated.polyphonic constructor- Throws:
com.softsynth.jsyn.SynthException
-
-
Method Details
-
setAllocator
Deprecated.Sets allocator and set polyphonic = true -
getAllocator
Deprecated. -
setUpdateDimension
public void setUpdateDimension(int dim)Deprecated.Set the dimension to match against when update() is called. This is used to retrieve the SynthNote which was play()'ed and is currently sounding, and which wants to be updated . Defaults to 1, which is the "pitch" dimension- Specified by:
setUpdateDimension
in interfaceUpdatableInstrument
- Parameters:
dim
-
-
getUpdateDimension
public int getUpdateDimension()Deprecated.Get the dimension to match against when update() is called. This is used to retrieve the SynthNote which was play()'ed and is currently sounding, and which wants to be updated . Defaults to 1, which is the "pitch" dimension- Specified by:
getUpdateDimension
in interfaceUpdatableInstrument
-
getPolyphonic
public boolean getPolyphonic()Deprecated. -
setMaxVoices
public void setMaxVoices(int n)Deprecated. -
getMaxVoices
public int getMaxVoices()Deprecated. -
setSynthNote
public void setSynthNote(com.softsynth.jsyn.SynthNote sn)Deprecated. -
setName
public void setName(java.lang.String n)Deprecated.- Specified by:
setName
in interfaceNamable
- Overrides:
setName
in classInstrumentAdapter
-
getName
public java.lang.String getName()Deprecated.- Specified by:
getName
in interfaceNamable
- Overrides:
getName
in classInstrumentAdapter
-
open
public double open(double time) throws java.lang.InterruptedExceptionDeprecated.open your instrument, this stub does nothing and returns time- Specified by:
open
in interfaceInstrument
- Overrides:
open
in classInstrumentAdapter
- Throws:
java.lang.InterruptedException
-
close
public double close(double time) throws java.lang.InterruptedExceptionDeprecated.close your instrument, this stub does nothing and returns time- Specified by:
close
in interfaceInstrument
- Overrides:
close
in classInstrumentAdapter
- Throws:
java.lang.InterruptedException
-
getOutput
public java.lang.Object getOutput()Deprecated.Description copied from interface:OutputProvider
get this output (SynthOutput in the case of a JSyn Instrument, for example- Specified by:
getOutput
in interfaceOutputProvider
- Overrides:
getOutput
in classInstrumentAdapter
- Returns:
- null
-
getOutput
public java.lang.Object getOutput(int partNum)Deprecated.- Specified by:
getOutput
in interfaceOutputProvider
- Overrides:
getOutput
in classInstrumentAdapter
- Returns:
- null
-
getNumOutputs
public int getNumOutputs()Deprecated.- Specified by:
getNumOutputs
in interfaceOutputProvider
- Overrides:
getNumOutputs
in classInstrumentAdapter
- Returns:
- 0
-
on
public java.lang.Object on(double playTime, double timeStretch, double[] dar)Deprecated.Allocate a SynthNote and call SynthNote.noteOn()double frequency = dar[1]; double amp = dar[2]; // 0..1
- Specified by:
on
in interfaceInstrument
- Overrides:
on
in classInstrumentAdapter
- Returns:
- allocated Synthnote. play() refers to this returned object directly and calls synthNoteOff()
- See Also:
Instrument.on(double, double, double[])
-
off
public java.lang.Object off(double playTime, double timeStretch, double[] dar)Deprecated.Calls SynthNoteOff with the most recent SynthNote which was used to turn on the data in the array- Specified by:
off
in interfaceInstrument
- Overrides:
off
in classInstrumentAdapter
- Returns:
- null
- See Also:
com.softsynth.jmsl.Instrument#off(double, Object)
-
off
public void off(double playTime, com.softsynth.jsyn.SynthNote sn)Deprecated.turn off a SynthNote at playTime and call allocator,free() This SynthNote should have been returned from on() -
play
public double play(double playTime, double timeStretch, double[] dar)Deprecated.Override on() and off() methods for Instrument class to provide custom interpretation of double[]. play() callsdouble duration = dar[0]; double hold = dar[3]; double offtime = playTime + hold * timeStretch; Object allocatedSynthNote = on(playTime, timeStretch, dar); synthNoteOff(offtime, (SynthNote) allocatedSynthNote); return playTime + duration * timeStretch;
Interpretation of data:double dur = dar[0]; double frequency = dar[1]; double amp = dar[2]; // 0..1 double hold = dar[3];
- Specified by:
play
in interfaceInstrument
- Overrides:
play
in classInstrumentAdapter
-
update
public double update(double playTime, double timeStretch, double[] dar)Deprecated.Update amplitude and frequency using (by default) dimension 1 as lookup to retrieve allocated synthnote. You may change this with setUpdateDimension()- Specified by:
update
in interfaceInstrument
- Overrides:
update
in classInstrumentAdapter
-
main
public static void main(java.lang.String[] args)Deprecated.Create a polyphonic, stereo instrument, and play a MusicShape with it. Specify frequencies
-