Class FMVoice

java.lang.Object
com.jsyn.unitgen.UnitGenerator
com.jsyn.unitgen.Circuit
jmslexamples.jsyn2.unitvoices.FMVoice
All Implemented Interfaces:
com.jsyn.unitgen.UnitSource, com.jsyn.unitgen.UnitVoice

public class FMVoice
extends com.jsyn.unitgen.Circuit
implements com.jsyn.unitgen.UnitVoice, com.jsyn.unitgen.UnitSource
  • Field Summary

    Fields
    Modifier and Type Field Description
    com.jsyn.ports.UnitInputPort amplitude  
    com.jsyn.ports.UnitInputPort frequency  
    static int PRESET_BELL  
    static int PRESET_BRASS  
    static int PRESET_CLARINET  
    static int PRESET_WOODDRUM  

    Fields inherited from class com.jsyn.unitgen.UnitGenerator

    FALSE, PORT_NAME_AMPLITUDE, PORT_NAME_CUTOFF, PORT_NAME_FREQUENCY, PORT_NAME_FREQUENCY_SCALER, PORT_NAME_INPUT, PORT_NAME_OUTPUT, PORT_NAME_PAN, PORT_NAME_PHASE, PORT_NAME_PRESSURE, PORT_NAME_TIMBRE, PORT_NAME_TIME, TRUE
  • Constructor Summary

    Constructors
    Constructor Description
    FMVoice()
    Construct a default brass like FMVoice
    FMVoice​(double numerFc, double denomFm, double modIndex)
    Construct a FMVoice that maintains numer/denom Fc:Fm ratio, with specified Modulation index
  • Method Summary

    Modifier and Type Method Description
    void bellPreset()
    Bell, Fc:Fm ratio 5:7, IMAX = 10, DUR 15 sec (Dodge/Jerse p.
    void brassPreset()
    Brass, Fc:Fm ratio 1:1, IMAX = 5, DUR variable so we use sustain loop (Dodge/Jerse p.
    void clarinetPreset()
    Clarinet, Fc:Fm ratio 3:2, IMIN = 2, IMAX = 4, DUR variable so we use sustain loop (Dodge/Jerse p.
    double getFcfmRatio()  
    double getModIndex()  
    com.jsyn.ports.UnitOutputPort getOutput()  
    static void main​(java.lang.String[] args)  
    void noteOff​(com.softsynth.shared.time.TimeStamp ts)  
    void noteOn​(double frequency, double amplitude, com.softsynth.shared.time.TimeStamp ts)  
    void setEnvelopes​(double[] carAmpData, int carSusBegin, int carSusEnd, double[] modAmpData, int modSusBegin, int modSusEnd)
    Specify envelopes to use and the sustain portion of each.
    void setFcfmRatio​(double fcfmRatio)  
    void setModIndex​(double modIndex)  
    void setTimbre​(double numerFc, double denomFm, double modIndex)  
    void usePreset​(int presetIndex)
    Pass in FMVoice.PRESET_BELL, FMVoice.PRESET_CLARINET, FMVoice.PRESET_BRASS, or FMVoice.PRESET_WOODDRUM Overridden from UnitVoice interface
    void woodDrumPreset()
    Wood Drum, Fc:Fm ratio 80:55, IMAX = 10, DUR 0.2 sec (Dodge/Jerse p.

    Methods inherited from class com.jsyn.unitgen.Circuit

    add, addPortAlias, flattenOutputs, generate, getPortByName, setEnabled, setFrameRate, setSynthesisEngine

    Methods inherited from class com.jsyn.unitgen.UnitGenerator

    addPort, addPort, convertHalfLifeToMultiplier, generate, getCircuit, getFramePeriod, getFrameRate, getId, getPorts, getSynthesisEngine, getSynthesizer, getTopUnit, getUnitGenerator, isEnabled, isStartRequired, printConnections, printConnections, printConnections, pullData, setCircuit, setPort, start, start, start, stop, stop, stop

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.jsyn.unitgen.UnitVoice

    getUnitGenerator, setPort
  • Field Details

    • amplitude

      public com.jsyn.ports.UnitInputPort amplitude
    • frequency

      public com.jsyn.ports.UnitInputPort frequency
    • PRESET_BRASS

      public static final int PRESET_BRASS
      See Also:
      Constant Field Values
    • PRESET_WOODDRUM

      public static final int PRESET_WOODDRUM
      See Also:
      Constant Field Values
    • PRESET_BELL

      public static final int PRESET_BELL
      See Also:
      Constant Field Values
    • PRESET_CLARINET

      public static final int PRESET_CLARINET
      See Also:
      Constant Field Values
  • Constructor Details

    • FMVoice

      public FMVoice()
      Construct a default brass like FMVoice
    • FMVoice

      public FMVoice​(double numerFc, double denomFm, double modIndex)
      Construct a FMVoice that maintains numer/denom Fc:Fm ratio, with specified Modulation index
  • Method Details

    • setTimbre

      public void setTimbre​(double numerFc, double denomFm, double modIndex)
    • getModIndex

      public double getModIndex()
      Returns:
      the modIndex
    • setModIndex

      public void setModIndex​(double modIndex)
      Parameters:
      modIndex - the modIndex to set
    • getFcfmRatio

      public double getFcfmRatio()
      Returns:
      the fcfmRatio
    • setFcfmRatio

      public void setFcfmRatio​(double fcfmRatio)
      Parameters:
      fcfmRatio - the fcfmRatio to set
    • setEnvelopes

      public void setEnvelopes​(double[] carAmpData, int carSusBegin, int carSusEnd, double[] modAmpData, int modSusBegin, int modSusEnd)
      Specify envelopes to use and the sustain portion of each. Note that end frame is one greater than the one you want it to finish before looping
    • getOutput

      public com.jsyn.ports.UnitOutputPort getOutput()
      Specified by:
      getOutput in interface com.jsyn.unitgen.UnitSource
    • noteOff

      public void noteOff​(com.softsynth.shared.time.TimeStamp ts)
      Specified by:
      noteOff in interface com.jsyn.unitgen.UnitVoice
    • noteOn

      public void noteOn​(double frequency, double amplitude, com.softsynth.shared.time.TimeStamp ts)
      Specified by:
      noteOn in interface com.jsyn.unitgen.UnitVoice
    • woodDrumPreset

      public void woodDrumPreset()
      Wood Drum, Fc:Fm ratio 80:55, IMAX = 10, DUR 0.2 sec (Dodge/Jerse p. 113)
    • bellPreset

      public void bellPreset()
      Bell, Fc:Fm ratio 5:7, IMAX = 10, DUR 15 sec (Dodge/Jerse p. 113)
    • brassPreset

      public void brassPreset()
      Brass, Fc:Fm ratio 1:1, IMAX = 5, DUR variable so we use sustain loop (Dodge/Jerse p. 113)
    • clarinetPreset

      public void clarinetPreset()
      Clarinet, Fc:Fm ratio 3:2, IMIN = 2, IMAX = 4, DUR variable so we use sustain loop (Dodge/Jerse p. 113)
    • usePreset

      public void usePreset​(int presetIndex)
      Pass in FMVoice.PRESET_BELL, FMVoice.PRESET_CLARINET, FMVoice.PRESET_BRASS, or FMVoice.PRESET_WOODDRUM Overridden from UnitVoice interface
      Specified by:
      usePreset in interface com.jsyn.unitgen.UnitVoice
      Overrides:
      usePreset in class com.jsyn.unitgen.Circuit
    • main

      public static void main​(java.lang.String[] args)