You can create an instance of the Music object when you need it like this:
music = app.CreateMusic()
Methods:
Create synth.
A thin wrapper around the Native Web Audio GainNode. The GainNode is a basic building block of the Web Audio API and is useful for routing audio and adjusting gains.
Synth Example With Gain
function OnStart()
{
music = app.CreateMusic()
synth = music.CreateSynth("Synth", null, true)
synth.Connect(music.Gain(0.5))
synth.PlayStopTone("C4", "8n")
}
Phaser is a phaser effect. Phasers work by changing the phase of different frequency components of an incoming signal.
Synth Example With Phaser
function OnStart()
{
music = app.CreateMusic()
synth = music.CreateSynth("Synth", null, true)
synth.Connect(music.Phaser())
synth.PlayStopTone("C4", "8n")
}
A simple distortion effect.
Synth Example With Distortion
function OnStart()
{
music = app.CreateMusic()
synth = music.CreateSynth("Synth", null, true)
synth.Connect(music.Distortion(0.5))
synth.PlayStopTone("C4", "8n")
}
FeedbackDelay is a DelayNode in which part of output signal is fed back into the delay.
Synth Example With FeedbackDelay
function OnStart()
{
music = app.CreateMusic()
synth = music.CreateSynth("Synth", null, true)
synth.Connect(music.FeedbackDelay(0.125, 0.5))
synth.PlayStopTone("C4", "8n")
}
Filter is a filter which allows for all of the same native methods as the BiquadFilterNode. Tone.Filter has the added ability to set the filter rolloff at -12 (default), -24 and -48.
Synth Example With Filter
function OnStart()
{
music = app.CreateMusic()
synth = music.CreateSynth("Synth", null, true)
synth.Connect(music.Filter(500, "lowpass"))
synth.PlayStopTone("C4", "8n")
}
music.Now()
The current audio context time of the global context.
Callback which resolves when all of the loading promises are resolved.
Start the transport and all sources synced to the transport.
music.StopTransport(
time)
Stop the transport and all sources synced to the transport.
Ramps to the given value over the duration of the rampTime. Automatically selects the best ramp type (exponential or linear) depending on the units of the signal
Schedule a repeated event along the timeline. The event will fire at the interval starting at the startTime and for the specified duration.
music._tone
Return Tone class from Tonejs
A number greater than or equal to 0.
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.