Back

PolySynth

PolySynth handles voice creation and allocation for any instruments passed in as the second paramter. PolySynth is not a synthesizer by itself, it merely manages voices of one of the other types of synths, allowing any of the monophonic synthesizers to be polyphonic.

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

 poly = music.CreatePolySynth(type, options, noDestination)


Example


function OnStart()
{
  music = app.CreateMusic()

  // type auto filled: Synth
  poly = music.CreatePolySynth()
  poly.Set({detune: -1200})

  poly.PlayStopTone(["C4", "E4", "A4"], 1)
}

  Copy   Copy All    Run   


Methods:

 poly.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.


 poly.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.


 poly.StopTone(time)

Stop the note portion of the envelope.

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


 poly.StopAll(time)

Trigger the release portion of all the currently active voices immediately. Useful for silencing the synth.


 poly.SetVolume(decibels)

The volume of the output in decibels.


 poly.Set(options)

Set multiple properties at once with an object.


 poly.Connect(...nodes)

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


 poly.GetName()

Return poly synth name.


 poly.Get()

Get the object's attributes.


 poly.Dispose()

Clean up.


 poly._synth

Return Tone.PolySynth class from Tonejs


Synth, AM, FM, Membrane, Metal, Duo, Pluck, Mono, Noise
{
  maxPolyphony: NUMBER,
  volume: DECIBELS
}
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
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.