|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softsynth.jmsl.InstrumentAdapter com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
public class FreqSynthNoteInstrument
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
Field Summary | |
---|---|
static int |
insNum
|
Constructor Summary | |
---|---|
FreqSynthNoteInstrument()
Constructor sets MusicDevice to JSynMusicDevice |
|
FreqSynthNoteInstrument(BussedVoiceAllocatorMultiOut allocator)
polyphonic constructor |
|
FreqSynthNoteInstrument(com.softsynth.jsyn.SynthNote synthNote)
monophonic constructor |
Method Summary | |
---|---|
double |
close(double time)
close your instrument, this stub does nothing and returns time |
BussedVoiceAllocatorMultiOut |
getAllocator()
|
int |
getMaxVoices()
|
java.lang.String |
getName()
|
int |
getNumOutputs()
|
java.lang.Object |
getOutput()
get this output (SynthOutput in the case of a JSyn Instrument, for example |
java.lang.Object |
getOutput(int partNum)
|
boolean |
getPolyphonic()
|
int |
getUpdateDimension()
Get the dimension to match against when update() is called. |
static void |
main(java.lang.String[] args)
Create a polyphonic, stereo instrument, and play a MusicShape with it. |
java.lang.Object |
off(double playTime,
double timeStretch,
double[] dar)
Calls SynthNoteOff with the most recent SynthNote which was used to turn on the data in the array |
void |
off(double playTime,
com.softsynth.jsyn.SynthNote sn)
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)
Allocate a SynthNote and call SynthNote.noteOn() |
double |
open(double time)
open your instrument, this stub does nothing and returns time |
double |
play(double playTime,
double timeStretch,
double[] dar)
Override on() and off() methods for Instrument class to provide custom interpretation of double[]. |
void |
setAllocator(BussedVoiceAllocatorMultiOut allocator)
Sets allocator and set polyphonic = true |
void |
setMaxVoices(int n)
|
void |
setName(java.lang.String n)
|
void |
setSynthNote(com.softsynth.jsyn.SynthNote sn)
|
void |
setUpdateDimension(int dim)
Set the dimension to match against when update() is called. |
double |
update(double playTime,
double timeStretch,
double[] dar)
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 Detail |
---|
public static int insNum
Constructor Detail |
---|
public FreqSynthNoteInstrument()
public FreqSynthNoteInstrument(com.softsynth.jsyn.SynthNote synthNote) throws com.softsynth.jsyn.SynthException
com.softsynth.jsyn.SynthException
public FreqSynthNoteInstrument(BussedVoiceAllocatorMultiOut allocator) throws com.softsynth.jsyn.SynthException
com.softsynth.jsyn.SynthException
Method Detail |
---|
public void setAllocator(BussedVoiceAllocatorMultiOut allocator)
public BussedVoiceAllocatorMultiOut getAllocator()
public void setUpdateDimension(int dim)
dim
- public int getUpdateDimension()
public boolean getPolyphonic()
public void setMaxVoices(int n)
public int getMaxVoices()
public void setSynthNote(com.softsynth.jsyn.SynthNote sn)
public void setName(java.lang.String n)
setName
in interface Namable
setName
in class InstrumentAdapter
public java.lang.String getName()
getName
in interface Namable
getName
in class InstrumentAdapter
public double open(double time) throws java.lang.InterruptedException
open
in interface Instrument
open
in class InstrumentAdapter
java.lang.InterruptedException
public double close(double time) throws java.lang.InterruptedException
close
in interface Instrument
close
in class InstrumentAdapter
java.lang.InterruptedException
public java.lang.Object getOutput()
OutputProvider
getOutput
in interface OutputProvider
getOutput
in class InstrumentAdapter
public java.lang.Object getOutput(int partNum)
getOutput
in interface OutputProvider
getOutput
in class InstrumentAdapter
public int getNumOutputs()
getNumOutputs
in interface OutputProvider
getNumOutputs
in class InstrumentAdapter
public java.lang.Object on(double playTime, double timeStretch, double[] dar)
double frequency = dar[1];double amp = dar[2]; // 0..1
on
in interface Instrument
on
in class InstrumentAdapter
Instrument.on(double, double, double[])
public java.lang.Object off(double playTime, double timeStretch, double[] dar)
off
in interface Instrument
off
in class InstrumentAdapter
com.softsynth.jmsl.Instrument#off(double, Object)
public void off(double playTime, com.softsynth.jsyn.SynthNote sn)
public double play(double playTime, double timeStretch, double[] dar)
double 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];
play
in interface Instrument
play
in class InstrumentAdapter
public double update(double playTime, double timeStretch, double[] dar)
update
in interface Instrument
update
in class InstrumentAdapter
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |