Oscillator supports a number of features including phase rotation, multiple oscillator types.
You can an instance of the music object when you need it like this:
Example
function OnStart()
{
music = app.CreateMusic()
osc = music.CreateOscillator(440, "sine")
osc.Play()
}
Methods:
Start the source at the specified time. If no time is given, start the source now.
Stop the source at the specified time. If no time is given, stop the source now.
Restart the source.
The volume of the output in decibels.
The volume of the output in decibels.
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.
Connect the output of this node to the rest of the nodes in series.
osc.GetName()
Return oscillator name.
osc.Dispose()
Clean up.
osc._oscillator
Return Tone.Oscillator class from Tonejs
Synth, AM, FM, Membrane, Metal, Duo, Pluck, Mono, Noise
{volume: DECIBELS,
portamento: SECONDS}
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.
- Numbers, which will be taken literally as the time (in seconds).
- Notation, ("4n", "8t") describes time in BPM and time signature relative values.
- TransportTime, ("4:3:2") will also provide tempo and time signature relative times in the form BARS:QUARTERS:SIXTEENTHS.
- Frequency, ("8hz") is converted to the length of the cycle in seconds.
- Now-Relative, ("+1") prefix any of the above with "+" and it will be interpreted as "the current time plus whatever expression follows".
- Object, ({"4n" : 3, "8t" : -1}). The resulting time is equal to the sum of all of the keys multiplied by the values in the object.
- No Argument, for methods which accept time, no argument will be interpreted as "now" (i.e. the currentTime).
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.