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
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 JSynMusicDevice
    FreqSynthNoteInstrument​(BussedVoiceAllocatorMultiOut allocator)
    Deprecated.
    polyphonic constructor
    FreqSynthNoteInstrument​(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 time
    BussedVoiceAllocatorMultiOut 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 example
    java.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 array
    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()
    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 time
    double 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 = true
    void 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 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • insNum

      public static int insNum
      Deprecated.
  • Constructor Details

    • FreqSynthNoteInstrument

      public FreqSynthNoteInstrument()
      Deprecated.
      Constructor sets MusicDevice to JSynMusicDevice
    • FreqSynthNoteInstrument

      public FreqSynthNoteInstrument​(com.softsynth.jsyn.SynthNote synthNote) throws com.softsynth.jsyn.SynthException
      Deprecated.
      monophonic constructor
      Throws:
      com.softsynth.jsyn.SynthException
    • FreqSynthNoteInstrument

      public FreqSynthNoteInstrument​(BussedVoiceAllocatorMultiOut allocator) throws com.softsynth.jsyn.SynthException
      Deprecated.
      polyphonic constructor
      Throws:
      com.softsynth.jsyn.SynthException
  • Method Details

    • setAllocator

      public void setAllocator​(BussedVoiceAllocatorMultiOut allocator)
      Deprecated.
      Sets allocator and set polyphonic = true
    • getAllocator

      public BussedVoiceAllocatorMultiOut 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 interface UpdatableInstrument
      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 interface UpdatableInstrument
    • 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 interface Namable
      Overrides:
      setName in class InstrumentAdapter
    • getName

      public java.lang.String getName()
      Deprecated.
      Specified by:
      getName in interface Namable
      Overrides:
      getName in class InstrumentAdapter
    • open

      public double open​(double time) throws java.lang.InterruptedException
      Deprecated.
      open your instrument, this stub does nothing and returns time
      Specified by:
      open in interface Instrument
      Overrides:
      open in class InstrumentAdapter
      Throws:
      java.lang.InterruptedException
    • close

      public double close​(double time) throws java.lang.InterruptedException
      Deprecated.
      close your instrument, this stub does nothing and returns time
      Specified by:
      close in interface Instrument
      Overrides:
      close in class InstrumentAdapter
      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 interface OutputProvider
      Overrides:
      getOutput in class InstrumentAdapter
      Returns:
      null
    • getOutput

      public java.lang.Object getOutput​(int partNum)
      Deprecated.
      Specified by:
      getOutput in interface OutputProvider
      Overrides:
      getOutput in class InstrumentAdapter
      Returns:
      null
    • getNumOutputs

      public int getNumOutputs()
      Deprecated.
      Specified by:
      getNumOutputs in interface OutputProvider
      Overrides:
      getNumOutputs in class InstrumentAdapter
      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 interface Instrument
      Overrides:
      on in class InstrumentAdapter
      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 interface Instrument
      Overrides:
      off in class InstrumentAdapter
      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() calls
       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];
       
       
       
       
       
       
      Specified by:
      play in interface Instrument
      Overrides:
      play in class InstrumentAdapter
    • 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 interface Instrument
      Overrides:
      update in class InstrumentAdapter
    • main

      public static void main​(java.lang.String[] args)
      Deprecated.
      Create a polyphonic, stereo instrument, and play a MusicShape with it. Specify frequencies