Back

AMSynth

AMSynth uses the output of one Synth to modulate the amplitude of another Synth.

You can an instance of the music object when you need it like this:

 synth = music.CreateSynth(AM, options, noDestination)


Example


function OnStart()
{
  music = app._381()
  synth = music.CreateSynth("AM")

  synth.PlayStopTone("C4", "4n")
}

  Copy   Copy All    Run   


Methods:

 synth.PlayTone(notes, time, velocity)

Trigger the play of the note. Velocity optional default 1

note: The note to play.

time: When the note should be play.

velocity: The velocity scaler determines how "loud" the note will be played.


 synth.PlayStopTone(note, duration, time, velocity)

Trigger the play of the note after stop.

note: The note to play.

duration: How long the note should be held for before play the stop. This value must be greater than 0.

time: When the note should be play.

velocity: The velocity the note should be play at.


 synth.StopTone(time)

Stop the note portion of the envelope.

time: If no time is given, the stop happens immediatly.


 synth.SetOscillator(oscillatorType)

The oscillator.


 synth.SetAttack(number)

When PlayTone is called, the attack time is the amount of time it takes for the envelope to reach it's maximum value.


 synth.SetRelease(number)

After StopTone is called, the envelope's value will fall to it's miminum value over the duration of the release time.


 synth.SetDecay(number)

After the attack portion of the envelope, the value will fall over the duration of the decay time to it's sustain value.


 synth.SetSustain(number)

The sustain value is the value which the envelope rests at after triggerAttack is called, but before triggerRelease is invoked.


 synth.SetVolume(decibels)

The volume of the output in decibels.


 synth.Set(options)

Set multiple properties at once with an object.


 synth.Connect(...nodes)

Connect the output of this node to the rest of the nodes in series.


 synth.GetName()

Return synth name.


 synth.Get()

Get the object's attributes.


 synth.Dispose()

Clean up.


 synth._synth

Return Tone.Synth class from Tonejs


{
  volume: DECIBELS,
  portamento: SECONDS,
  harmonicity: POSITIVE,
  oscillator: TYPE,
  envelope: ENVELOPE,
  detune: CENTS
}
Frequency can be described similar to time, except ultimately the values are converted to frequency instead of seconds. A number is taken literally as the value in hertz. Additionally any of the Time encodings can be used. Note names in the form of NOTE OCTAVE (i.e. C4) are also accepted and converted to their frequency value.
Time can be described in a number of ways. Read more Time.
true or false
music.Gain, music.Phaser or other Tonejs effects.
Range: 0..1
Range: 0..2
Range: 0..5
Sine, Square, Triangle, Sawtooth
Decibels are a logarithmic unit of measurement which is useful for volume because of the logarithmic way that we perceive loudness. 0 decibels means no change in volume. -10db is approximately half as loud and 10db is twice is loud.