mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-13 20:39:06 +00:00
using new way to handle offline tests
This commit is contained in:
parent
542e8913c6
commit
6b5daa7d07
18 changed files with 185 additions and 150 deletions
|
@ -11,12 +11,13 @@ interface TonePannerOptions extends ToneAudioNodeOptions {
|
|||
|
||||
/**
|
||||
* Panner is an equal power Left/Right Panner. It is a wrapper around the StereoPannerNode.
|
||||
* @offline 0.5 2
|
||||
* @example
|
||||
* // move the input signal from right to left
|
||||
* const panner = new Tone.Panner(1).toDestination();
|
||||
* panner.pan.rampTo(-1, 0.5);
|
||||
* const osc = new Tone.Oscillator(100).connect(panner).start();
|
||||
* return Tone.Offline(() => {
|
||||
* // move the input signal from right to left
|
||||
* const panner = new Tone.Panner(1).toDestination();
|
||||
* panner.pan.rampTo(-1, 0.5);
|
||||
* const osc = new Tone.Oscillator(100).connect(panner).start();
|
||||
* }, 0.5, 2);
|
||||
* @category Component
|
||||
*/
|
||||
export class Panner extends ToneAudioNode<TonePannerOptions> {
|
||||
|
@ -34,13 +35,14 @@ export class Panner extends ToneAudioNode<TonePannerOptions> {
|
|||
* The pan control. -1 = hard left, 1 = hard right.
|
||||
* @min -1
|
||||
* @max 1
|
||||
* @offline 0.5 2
|
||||
* @example
|
||||
* // pan hard right
|
||||
* const panner = new Tone.Panner(1).toDestination();
|
||||
* // pan hard left
|
||||
* panner.pan.setValueAtTime(-1, 0.25);
|
||||
* const osc = new Tone.Oscillator(50, "triangle").connect(panner).start();
|
||||
* return Tone.Offline(() => {
|
||||
* // pan hard right
|
||||
* const panner = new Tone.Panner(1).toDestination();
|
||||
* // pan hard left
|
||||
* panner.pan.setValueAtTime(-1, 0.25);
|
||||
* const osc = new Tone.Oscillator(50, "triangle").connect(panner).start();
|
||||
* }, 0.5, 2);
|
||||
*/
|
||||
readonly pan: Param<"audioRange">;
|
||||
|
||||
|
|
|
@ -10,18 +10,19 @@ import { Envelope, EnvelopeOptions } from "./Envelope";
|
|||
* of the signal.
|
||||
* Read more about ADSR Envelopes on [Wikipedia](https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope).
|
||||
*
|
||||
* @offline 1.5 1
|
||||
* @example
|
||||
* const ampEnv = new Tone.AmplitudeEnvelope({
|
||||
* attack: 0.1,
|
||||
* decay: 0.2,
|
||||
* sustain: 1.0,
|
||||
* release: 0.8
|
||||
* }).toDestination();
|
||||
* // create an oscillator and connect it
|
||||
* const osc = new Tone.Oscillator().connect(ampEnv).start();
|
||||
* // trigger the envelopes attack and release "8t" apart
|
||||
* ampEnv.triggerAttackRelease("8t");
|
||||
* return Tone.Offline(() => {
|
||||
* const ampEnv = new Tone.AmplitudeEnvelope({
|
||||
* attack: 0.1,
|
||||
* decay: 0.2,
|
||||
* sustain: 1.0,
|
||||
* release: 0.8
|
||||
* }).toDestination();
|
||||
* // create an oscillator and connect it
|
||||
* const osc = new Tone.Oscillator().connect(ampEnv).start();
|
||||
* // trigger the envelopes attack and release "8t" apart
|
||||
* ampEnv.triggerAttackRelease("8t");
|
||||
* }, 1.5, 1);
|
||||
* @category Component
|
||||
*/
|
||||
export class AmplitudeEnvelope extends Envelope {
|
||||
|
|
|
@ -37,15 +37,16 @@ export interface EnvelopeOptions extends ToneAudioNodeOptions {
|
|||
* / \
|
||||
* / \
|
||||
* ```
|
||||
* @offline 1.5 1
|
||||
* @example
|
||||
* const env = new Tone.Envelope({
|
||||
* attack: 0.1,
|
||||
* decay: 0.2,
|
||||
* sustain: 0.5,
|
||||
* release: 0.8,
|
||||
* }).toDestination();
|
||||
* env.triggerAttackRelease(0.5);
|
||||
* return Tone.Offline(() => {
|
||||
* const env = new Tone.Envelope({
|
||||
* attack: 0.1,
|
||||
* decay: 0.2,
|
||||
* sustain: 0.5,
|
||||
* release: 0.8,
|
||||
* }).toDestination();
|
||||
* env.triggerAttackRelease(0.5);
|
||||
* }, 1.5, 1);
|
||||
* @category Component
|
||||
*/
|
||||
export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
||||
|
@ -275,11 +276,12 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
|||
* Can also be an array which describes the curve. Values
|
||||
* in the array are evenly subdivided and linearly
|
||||
* interpolated over the duration of the attack.
|
||||
* @offline 1 1
|
||||
* @example
|
||||
* const env = new Tone.Envelope(0.4).toDestination();
|
||||
* env.attackCurve = "linear";
|
||||
* env.triggerAttack();
|
||||
* return Tone.Offline(() => {
|
||||
* const env = new Tone.Envelope(0.4).toDestination();
|
||||
* env.attackCurve = "linear";
|
||||
* env.triggerAttack();
|
||||
* }, 1, 1);
|
||||
*/
|
||||
get attackCurve(): EnvelopeCurve {
|
||||
return this._getCurve(this._attackCurve, "In");
|
||||
|
@ -290,15 +292,16 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
|||
|
||||
/**
|
||||
* The shape of the release. See the attack curve types.
|
||||
* @offline 1 1
|
||||
* @example
|
||||
* const env = new Tone.Envelope({
|
||||
* release: 0.8
|
||||
* }).toDestination();
|
||||
* env.triggerAttack();
|
||||
* // release curve could also be defined by an array
|
||||
* env.releaseCurve = [1, 0.3, 0.4, 0.2, 0.7, 0];
|
||||
* env.triggerRelease(0.2);
|
||||
* return Tone.Offline(() => {
|
||||
* const env = new Tone.Envelope({
|
||||
* release: 0.8
|
||||
* }).toDestination();
|
||||
* env.triggerAttack();
|
||||
* // release curve could also be defined by an array
|
||||
* env.releaseCurve = [1, 0.3, 0.4, 0.2, 0.7, 0];
|
||||
* env.triggerRelease(0.2);
|
||||
* }, 1, 1);
|
||||
*/
|
||||
get releaseCurve(): EnvelopeCurve {
|
||||
return this._getCurve(this._releaseCurve, "Out");
|
||||
|
@ -309,14 +312,15 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
|||
|
||||
/**
|
||||
* The shape of the decay either "linear" or "exponential"
|
||||
* @offline 1 1
|
||||
* @example
|
||||
* const env = new Tone.Envelope({
|
||||
* sustain: 0.1,
|
||||
* decay: 0.5
|
||||
* }).toDestination();
|
||||
* env.decayCurve = "linear";
|
||||
* env.triggerAttack();
|
||||
* return Tone.Offline(() => {
|
||||
* const env = new Tone.Envelope({
|
||||
* sustain: 0.1,
|
||||
* decay: 0.5
|
||||
* }).toDestination();
|
||||
* env.decayCurve = "linear";
|
||||
* env.triggerAttack();
|
||||
* }, 1, 1);
|
||||
*/
|
||||
get decayCurve(): BasicEnvelopeCurve {
|
||||
return this._decayCurve;
|
||||
|
|
|
@ -9,11 +9,12 @@ export abstract class AbstractParam<TypeName extends UnitName> {
|
|||
* Schedules a parameter value change at the given time.
|
||||
* @param value The value to set the signal.
|
||||
* @param time The time when the change should occur.
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const osc = new Tone.Oscillator(20).toDestination().start();
|
||||
* // set the frequency to 40 at exactly 0.25 seconds
|
||||
* osc.frequency.setValueAtTime(40, 0.25);
|
||||
* return Tone.Offline(() => {
|
||||
* const osc = new Tone.Oscillator(20).toDestination().start();
|
||||
* // set the frequency to 40 at exactly 0.25 seconds
|
||||
* osc.frequency.setValueAtTime(40, 0.25);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
abstract setValueAtTime(value: UnitMap[TypeName], time: Time): this;
|
||||
|
||||
|
@ -52,24 +53,26 @@ export abstract class AbstractParam<TypeName extends UnitName> {
|
|||
/**
|
||||
* Schedules a linear continuous change in parameter value from the
|
||||
* previous scheduled parameter value to the given value.
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const signal = new Tone.Signal(0).toDestination();
|
||||
* // the ramp is starts from the previously scheduled value
|
||||
* signal.setValueAtTime(0, 0.1);
|
||||
* signal.linearRampToValueAtTime(1, 0.4);
|
||||
* return Tone.Offline(() => {
|
||||
* const signal = new Tone.Signal(0).toDestination();
|
||||
* // the ramp is starts from the previously scheduled value
|
||||
* signal.setValueAtTime(0, 0.1);
|
||||
* signal.linearRampToValueAtTime(1, 0.4);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
abstract linearRampToValueAtTime(value: UnitMap[TypeName], time: Time): this;
|
||||
|
||||
/**
|
||||
* Schedules an exponential continuous change in parameter value from
|
||||
* the previous scheduled parameter value to the given value.
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const signal = new Tone.Signal(0).toDestination();
|
||||
* // the ramp is starts from the previously scheduled value
|
||||
* signal.setValueAtTime(0, 0.1);
|
||||
* signal.exponentialRampToValueAtTime(1, 0.4);
|
||||
* return Tone.Offline(() => {
|
||||
* const signal = new Tone.Signal(0).toDestination();
|
||||
* // the ramp is starts from the previously scheduled value
|
||||
* signal.setValueAtTime(0, 0.1);
|
||||
* signal.exponentialRampToValueAtTime(1, 0.4);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
abstract exponentialRampToValueAtTime(value: UnitMap[TypeName], time: Time): this;
|
||||
|
||||
|
@ -100,10 +103,11 @@ export abstract class AbstractParam<TypeName extends UnitName> {
|
|||
* value to ramp from it's current value
|
||||
* @param startTime When the ramp should start.
|
||||
* @returns {Param} this
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const signal = new Tone.Signal(1).toDestination();
|
||||
* signal.linearRampTo(0, 0.3, 0.1);
|
||||
* return Tone.Offline(() => {
|
||||
* const signal = new Tone.Signal(1).toDestination();
|
||||
* signal.linearRampTo(0, 0.3, 0.1);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
abstract linearRampTo(value: UnitMap[TypeName], rampTime: Time, startTime?: Time): this;
|
||||
|
||||
|
@ -116,10 +120,11 @@ export abstract class AbstractParam<TypeName extends UnitName> {
|
|||
* value to ramp from it's current value
|
||||
* @param startTime When the ramp should start.
|
||||
* @example
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const signal = new Tone.Signal(1).toDestination();
|
||||
* signal.targetRampTo(0, 0.3, 0.1);
|
||||
* return Tone.Offline(() => {
|
||||
* const signal = new Tone.Signal(1).toDestination();
|
||||
* signal.targetRampTo(0, 0.3, 0.1);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
abstract targetRampTo(value: UnitMap[TypeName], rampTime: Time, startTime?: Time): this;
|
||||
|
||||
|
@ -155,36 +160,39 @@ export abstract class AbstractParam<TypeName extends UnitName> {
|
|||
* @param startTime
|
||||
* @param duration
|
||||
* @param scaling If the values in the curve should be scaled by some value
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const signal = new Tone.Signal(1).toDestination();
|
||||
* signal.setValueCurveAtTime([1, 0.2, 0.8, 0.1, 0], 0.2, 0.3);
|
||||
* return Tone.Offline(() => {
|
||||
* const signal = new Tone.Signal(1).toDestination();
|
||||
* signal.setValueCurveAtTime([1, 0.2, 0.8, 0.1, 0], 0.2, 0.3);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
abstract setValueCurveAtTime(values: UnitMap[TypeName][], startTime: Time, duration: Time, scaling?: number): this;
|
||||
|
||||
/**
|
||||
* Cancels all scheduled parameter changes with times greater than or
|
||||
* equal to startTime.
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const signal = new Tone.Signal(0).toDestination();
|
||||
* signal.setValueAtTime(0.1, 0.1);
|
||||
* signal.setValueAtTime(0.2, 0.2);
|
||||
* signal.setValueAtTime(0.3, 0.3);
|
||||
* signal.setValueAtTime(0.4, 0.4);
|
||||
* // cancels the last two scheduled changes
|
||||
* signal.cancelScheduledValues(0.3);
|
||||
* return Tone.Offline(() => {
|
||||
* const signal = new Tone.Signal(0).toDestination();
|
||||
* signal.setValueAtTime(0.1, 0.1);
|
||||
* signal.setValueAtTime(0.2, 0.2);
|
||||
* signal.setValueAtTime(0.3, 0.3);
|
||||
* signal.setValueAtTime(0.4, 0.4);
|
||||
* // cancels the last two scheduled changes
|
||||
* signal.cancelScheduledValues(0.3);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
abstract cancelScheduledValues(time: Time): this;
|
||||
|
||||
/**
|
||||
* This is similar to [[cancelScheduledValues]] except
|
||||
* it holds the automated value at time until the next automated event.
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const signal = new Tone.Signal(0).toDestination();
|
||||
* signal.linearRampTo(1, 0.5, 0);
|
||||
* signal.cancelAndHoldAtTime(0.3);
|
||||
* return Tone.Offline(() => {
|
||||
* const signal = new Tone.Signal(0).toDestination();
|
||||
* signal.linearRampTo(1, 0.5, 0);
|
||||
* signal.cancelAndHoldAtTime(0.3);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
abstract cancelAndHoldAtTime(time: Time): this;
|
||||
|
||||
|
|
|
@ -12,13 +12,14 @@ export interface DelayOptions extends ToneAudioNodeOptions {
|
|||
/**
|
||||
* Wrapper around Web Audio's native [DelayNode](http://webaudio.github.io/web-audio-api/#the-delaynode-interface).
|
||||
* @category Core
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const delay = new Tone.Delay(0.1).toDestination();
|
||||
* // connect the signal to both the delay and the destination
|
||||
* const pulse = new Tone.PulseOscillator().connect(delay).toDestination();
|
||||
* // start and stop the pulse
|
||||
* pulse.start(0).stop(0.01);
|
||||
* return Tone.Offline(() => {
|
||||
* const delay = new Tone.Delay(0.1).toDestination();
|
||||
* // connect the signal to both the delay and the destination
|
||||
* const pulse = new Tone.PulseOscillator().connect(delay).toDestination();
|
||||
* // start and stop the pulse
|
||||
* pulse.start(0).stop(0.01);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
export class Delay extends ToneAudioNode<DelayOptions> {
|
||||
|
||||
|
|
|
@ -17,12 +17,13 @@ interface GainOptions<TypeName extends UnitName> extends ToneAudioNodeOptions {
|
|||
* The GainNode is a basic building block of the Web Audio
|
||||
* API and is useful for routing audio and adjusting gains.
|
||||
* @category Core
|
||||
* @offline 0.7 1
|
||||
* @example
|
||||
* const gainNode = new Tone.Gain(0).toDestination();
|
||||
* const osc = new Tone.Oscillator(30).connect(gainNode).start();
|
||||
* gainNode.gain.rampTo(1, 0.1);
|
||||
* gainNode.gain.rampTo(0, 0.4, 0.2);
|
||||
* return Tone.Offline(() => {
|
||||
* const gainNode = new Tone.Gain(0).toDestination();
|
||||
* const osc = new Tone.Oscillator(30).connect(gainNode).start();
|
||||
* gainNode.gain.rampTo(1, 0.1);
|
||||
* gainNode.gain.rampTo(0, 0.4, 0.2);
|
||||
* }, 0.7, 1);
|
||||
*/
|
||||
export class Gain<TypeName extends "gain" | "decibels" | "normalRange" = "gain"> extends ToneAudioNode<GainOptions<TypeName>> {
|
||||
|
||||
|
|
|
@ -5,12 +5,13 @@ import { WaveShaper } from "./WaveShaper";
|
|||
/**
|
||||
* Return the absolute value of an incoming signal.
|
||||
*
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const abs = new Tone.Abs().toDestination();
|
||||
* const signal = new Tone.Signal(1);
|
||||
* signal.rampTo(-1, 0.5);
|
||||
* signal.connect(abs);
|
||||
* return Tone.Offline(() => {
|
||||
* const abs = new Tone.Abs().toDestination();
|
||||
* const signal = new Tone.Signal(1);
|
||||
* signal.rampTo(-1, 0.5);
|
||||
* signal.connect(abs);
|
||||
* }, 0.5, 1);
|
||||
* @category Signal
|
||||
*/
|
||||
export class Abs extends SignalOperator<ToneAudioNodeOptions> {
|
||||
|
|
|
@ -9,14 +9,15 @@ import { Signal, SignalOptions } from "./Signal";
|
|||
* passed into the constructor, Tone.Add will sum input and `addend`
|
||||
* If a value is passed into the constructor, the it will be added to the input.
|
||||
*
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const add = new Tone.Add(2).toDestination();
|
||||
* add.addend.setValueAtTime(1, 0.2);
|
||||
* const signal = new Tone.Signal(2);
|
||||
* // add a signal and a scalar
|
||||
* signal.connect(add);
|
||||
* signal.setValueAtTime(1, 0.1);
|
||||
* return Tone.Offline(() => {
|
||||
* const add = new Tone.Add(2).toDestination();
|
||||
* add.addend.setValueAtTime(1, 0.2);
|
||||
* const signal = new Tone.Signal(2);
|
||||
* // add a signal and a scalar
|
||||
* signal.connect(add);
|
||||
* signal.setValueAtTime(1, 0.1);
|
||||
* }, 0.5, 1);
|
||||
* @category Signal
|
||||
*/
|
||||
export class Add extends Signal {
|
||||
|
|
|
@ -12,10 +12,11 @@ export type GreaterThanOptions = SignalOptions<"number">;
|
|||
* Output 1 if the signal is greater than the value, otherwise outputs 0.
|
||||
* can compare two signals or a signal and a number.
|
||||
*
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const gt = new Tone.GreaterThan(2).toDestination();
|
||||
* const sig = new Tone.Signal(4).connect(gt);
|
||||
* return Tone.Offline(() => {
|
||||
* const gt = new Tone.GreaterThan(2).toDestination();
|
||||
* const sig = new Tone.Signal(4).connect(gt);
|
||||
* }, 0.1, 1);
|
||||
*/
|
||||
export class GreaterThan extends Signal<"number"> {
|
||||
|
||||
|
@ -38,12 +39,13 @@ export class GreaterThan extends Signal<"number"> {
|
|||
|
||||
/**
|
||||
* The signal to compare to the incoming signal against.
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* // change the comparison value
|
||||
* const gt = new Tone.GreaterThan(1.5).toDestination();
|
||||
* const signal = new Tone.Signal(1).connect(gt);
|
||||
* gt.comparator.setValueAtTime(0.5, 0.1);
|
||||
* return Tone.Offline(() => {
|
||||
* // change the comparison value
|
||||
* const gt = new Tone.GreaterThan(1.5).toDestination();
|
||||
* const signal = new Tone.Signal(1).connect(gt);
|
||||
* gt.comparator.setValueAtTime(0.5, 0.1);
|
||||
* }, 0.5, 1);
|
||||
*/
|
||||
readonly comparator: Param<"number">
|
||||
|
||||
|
|
|
@ -8,11 +8,12 @@ export type GreaterThanZeroOptions = SignalOperatorOptions
|
|||
|
||||
/**
|
||||
* GreaterThanZero outputs 1 when the input is strictly greater than zero
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const gt0 = new Tone.GreaterThanZero().toDestination();
|
||||
* const sig = new Tone.Signal(0.5).connect(gt0);
|
||||
* sig.setValueAtTime(-1, 0.05);
|
||||
* return Tone.Offline(() => {
|
||||
* const gt0 = new Tone.GreaterThanZero().toDestination();
|
||||
* const sig = new Tone.Signal(0.5).connect(gt0);
|
||||
* sig.setValueAtTime(-1, 0.05);
|
||||
* }, 0.1, 1);
|
||||
*/
|
||||
export class GreaterThanZero extends SignalOperator<GreaterThanZeroOptions> {
|
||||
|
||||
|
|
|
@ -29,9 +29,10 @@ export { AMOscillatorOptions } from "./OscillatorInterface";
|
|||
* | Modulator Osc +>---+
|
||||
* +---------------+
|
||||
* ```
|
||||
* @offline 0.2 1
|
||||
* @example
|
||||
* const amOsc = new Tone.AMOscillator(30, "sine", "square").toDestination().start();
|
||||
* return Tone.Offline(() => {
|
||||
* const amOsc = new Tone.AMOscillator(30, "sine", "square").toDestination().start();
|
||||
* }, 0.2, 1);
|
||||
* @category Source
|
||||
*/
|
||||
export class AMOscillator extends Source<AMOscillatorOptions> implements ToneOscillatorInterface {
|
||||
|
|
|
@ -26,15 +26,16 @@ export { FMOscillatorOptions } from "./OscillatorInterface";
|
|||
* +-----------------+
|
||||
* ```
|
||||
*
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const fmOsc = new Tone.FMOscillator({
|
||||
* frequency: 200,
|
||||
* type: "square",
|
||||
* modulationType: "triangle",
|
||||
* harmonicity: 0.2,
|
||||
* modulationIndex: 3
|
||||
* }).toDestination().start();
|
||||
* return Tone.Offline(() => {
|
||||
* const fmOsc = new Tone.FMOscillator({
|
||||
* frequency: 200,
|
||||
* type: "square",
|
||||
* modulationType: "triangle",
|
||||
* harmonicity: 0.2,
|
||||
* modulationIndex: 3
|
||||
* }).toDestination().start();
|
||||
* }, 0.1, 1);
|
||||
* @category Source
|
||||
*/
|
||||
export class FMOscillator extends Source<FMOscillatorOptions> implements ToneOscillatorInterface {
|
||||
|
|
|
@ -26,9 +26,10 @@ export interface LFOOptions extends ToneAudioNodeOptions {
|
|||
* which can be attached to an AudioParam or Tone.Signal
|
||||
* in order to modulate that parameter with an oscillator. The LFO can
|
||||
* also be synced to the transport to start/stop and change when the tempo changes.
|
||||
* @offline 0.5 1
|
||||
* @example
|
||||
* const lfo = new Tone.LFO("4n", 400, 4000).start().toDestination();
|
||||
* return Tone.Offline(() => {
|
||||
* const lfo = new Tone.LFO("4n", 400, 4000).start().toDestination();
|
||||
* }, 0.5, 1);
|
||||
* @category Source
|
||||
*/
|
||||
export class LFO extends ToneAudioNode<LFOOptions> {
|
||||
|
|
|
@ -62,9 +62,10 @@ const OmniOscillatorSourceMap: {
|
|||
|
||||
/**
|
||||
* OmniOscillator aggregates all of the oscillator types into one.
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const omniOsc = new Tone.OmniOscillator("C#4", "pwm").toDestination().start();
|
||||
* return Tone.Offline(() => {
|
||||
* const omniOsc = new Tone.OmniOscillator("C#4", "pwm").toDestination().start();
|
||||
* }, 0.1, 1);
|
||||
* @category Source
|
||||
*/
|
||||
export class OmniOscillator<OscType extends AnyOscillator>
|
||||
|
|
|
@ -22,10 +22,11 @@ export interface ToneOscillatorInterface {
|
|||
* The oscillator's type. Also capable of setting the first x number of partials of the oscillator.
|
||||
* For example: "sine4" would set be the first 4 partials of the sine wave and "triangle8" would
|
||||
* set the first 8 partials of the triangle wave.
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const osc = new Tone.Oscillator().toDestination().start();
|
||||
* osc.type = "sine2";
|
||||
* return Tone.Offline(() => {
|
||||
* const osc = new Tone.Oscillator().toDestination().start();
|
||||
* osc.type = "sine2";
|
||||
* }, 0.1, 1);
|
||||
*/
|
||||
type: ExtendedToneOscillatorType;
|
||||
|
||||
|
@ -52,12 +53,13 @@ export interface ToneOscillatorInterface {
|
|||
/**
|
||||
* The phase is the starting position within the oscillator's cycle. For example
|
||||
* a phase of 180 would start halfway through the oscillator's cycle.
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const osc = new Tone.Oscillator({
|
||||
* frequency: 20,
|
||||
* phase: 90
|
||||
* }).toDestination().start();
|
||||
* return Tone.Offline(() => {
|
||||
* const osc = new Tone.Oscillator({
|
||||
* frequency: 20,
|
||||
* phase: 90
|
||||
* }).toDestination().start();
|
||||
* }, 0.1, 1);
|
||||
*/
|
||||
phase: Degrees;
|
||||
|
||||
|
|
|
@ -15,9 +15,10 @@ export { PWMOscillatorOptions } from "./OscillatorInterface";
|
|||
* at the modulationFrequency. This has the effect of continuously
|
||||
* changing the timbre of the oscillator by altering the harmonics
|
||||
* generated.
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const pwm = new Tone.PWMOscillator(60, 0.3).toDestination().start();
|
||||
* return Tone.Offline(() => {
|
||||
* const pwm = new Tone.PWMOscillator(60, 0.3).toDestination().start();
|
||||
* }, 0.1, 1);
|
||||
* @category Source
|
||||
*/
|
||||
export class PWMOscillator extends Source<PWMOscillatorOptions> implements ToneOscillatorInterface {
|
||||
|
@ -56,9 +57,10 @@ export class PWMOscillator extends Source<PWMOscillatorOptions> implements ToneO
|
|||
|
||||
/**
|
||||
* The width modulation rate of the oscillator.
|
||||
* @offline 0.1 example
|
||||
* @example
|
||||
* const osc = new Tone.PWMOscillator(20, 2).toDestination().start();
|
||||
* return Tone.Offline(() => {
|
||||
* const osc = new Tone.PWMOscillator(20, 2).toDestination().start();
|
||||
* }, 0.1, 1);
|
||||
*/
|
||||
readonly modulationFrequency: Signal<"frequency">;
|
||||
|
||||
|
|
|
@ -39,9 +39,10 @@ export { PulseOscillatorOptions } from "./OscillatorInterface";
|
|||
* | | | |
|
||||
* +-----+ +-------+ +-+
|
||||
* ```
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const pulse = new Tone.PulseOscillator(50, 0.4).toDestination().start();
|
||||
* return Tone.Offline(() => {
|
||||
* const pulse = new Tone.PulseOscillator(50, 0.4).toDestination().start();
|
||||
* }, 0.1, 1);
|
||||
* @category Source
|
||||
*/
|
||||
export class PulseOscillator extends Source<PulseOscillatorOptions> implements ToneOscillatorInterface {
|
||||
|
@ -50,9 +51,10 @@ export class PulseOscillator extends Source<PulseOscillatorOptions> implements T
|
|||
|
||||
/**
|
||||
* The width of the pulse.
|
||||
* @offline 0.1 1
|
||||
* @example
|
||||
* const pulse = new Tone.PulseOscillator(20, 0.8).toDestination().start();
|
||||
* return Tone.Offline(() => {
|
||||
* const pulse = new Tone.PulseOscillator(20, 0.8).toDestination().start();
|
||||
* }, 0.1, 1);
|
||||
*/
|
||||
readonly width: Signal<"audioRange">;
|
||||
|
||||
|
|
|
@ -57,7 +57,10 @@ async function testExampleString(str) {
|
|||
// str = str.replace("from \"tone\"", `from "${resolve(__dirname, "../../")}"`);
|
||||
str = `
|
||||
import * as Tone from "${resolve(__dirname, "../../")}"
|
||||
${str}
|
||||
function main(){
|
||||
${str}
|
||||
}
|
||||
main();
|
||||
`;
|
||||
const { path, cleanup } = await file({ postfix: ".ts" });
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue