Package jmslexamples.jsyn2.unitvoices
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.UnitInputPortamplitudecom.jsyn.ports.UnitInputPortfrequencystatic intPRESET_BELLstatic intPRESET_BRASSstatic intPRESET_CLARINETstatic intPRESET_WOODDRUMFields 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
-
Method Summary
Modifier and Type Method Description voidbellPreset()Bell, Fc:Fm ratio 5:7, IMAX = 10, DUR 15 sec (Dodge/Jerse p.voidbrassPreset()Brass, Fc:Fm ratio 1:1, IMAX = 5, DUR variable so we use sustain loop (Dodge/Jerse p.voidclarinetPreset()Clarinet, Fc:Fm ratio 3:2, IMIN = 2, IMAX = 4, DUR variable so we use sustain loop (Dodge/Jerse p.doublegetFcfmRatio()doublegetModIndex()com.jsyn.ports.UnitOutputPortgetOutput()static voidmain(java.lang.String[] args)voidnoteOff(com.softsynth.shared.time.TimeStamp ts)voidnoteOn(double frequency, double amplitude, com.softsynth.shared.time.TimeStamp ts)voidsetEnvelopes(double[] carAmpData, int carSusBegin, int carSusEnd, double[] modAmpData, int modSusBegin, int modSusEnd)Specify envelopes to use and the sustain portion of each.voidsetFcfmRatio(double fcfmRatio)voidsetModIndex(double modIndex)voidsetTimbre(double numerFc, double denomFm, double modIndex)voidusePreset(int presetIndex)Pass in FMVoice.PRESET_BELL, FMVoice.PRESET_CLARINET, FMVoice.PRESET_BRASS, or FMVoice.PRESET_WOODDRUM Overridden from UnitVoice interfacevoidwoodDrumPreset()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, setSynthesisEngineMethods 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, stopMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getOutputin interfacecom.jsyn.unitgen.UnitSource
-
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:
usePresetin interfacecom.jsyn.unitgen.UnitVoice- Overrides:
usePresetin classcom.jsyn.unitgen.Circuit
-
main
public static void main(java.lang.String[] args)
-