Documentation
    Preparing search index...

    Class BaseContextAbstract

    Emitter gives classes which extend it the ability to listen for and emit events. Inspiration and reference from Jerome Etienne's MicroEvent. MIT (c) 2011 Jerome Etienne.

    Hierarchy (View Summary)

    • Emitter<"statechange" | "tick">
      • BaseContext

    Implements

    Index
    debug: boolean

    Set this debug flag to log all events that happen in this class.

    isOffline: boolean
    latencyHint: number | AudioContextLatencyCategory
    lookAhead: number
    name: string

    The name of the class

    version: string

    The version number semver

    • get currentTime(): number

      The currentTime read-only property of the BaseAudioContext interface returns a double representing an ever-increasing hardware timestamp in seconds that can be used for scheduling audio playback, visualizing timelines, etc.

      MDN Reference

      Returns number

    • get destination(): DestinationClass

      Returns DestinationClass

    • get disposed(): boolean

      Indicates if the instance was disposed. 'Disposing' an instance means that all of the Web Audio nodes that were created for the instance are disconnected and freed for garbage collection.

      Returns boolean

    • get draw(): DrawClass

      Returns DrawClass

    • get listener(): ListenerClass

      Returns ListenerClass

    • get rawContext(): AnyAudioContext

      Returns AnyAudioContext

    • get sampleRate(): number

      The sampleRate property of the BaseAudioContext interface returns a floating point number representing the sample rate, in samples per second, used by all nodes in this audio context.

      MDN Reference

      Returns number

    • get state(): AudioContextState

      The state read-only property of the BaseAudioContext interface returns the current state of the AudioContext.

      MDN Reference

      Returns AudioContextState

    • get transport(): TransportClass

      Returns TransportClass

    • Parameters

      • _url: string

      Returns Promise<void>

    • Parameters

      • _id: number

      Returns this

    • Parameters

      • _id: number

      Returns this

    • The createAnalyser() method of the can be used to expose audio time and frequency data and create data visualizations.

      MDN Reference

      Returns AnalyserNode

    • The createBiquadFilter() method of the BaseAudioContext interface creates a BiquadFilterNode, which represents a second order filter configurable as several different common filter types.

      MDN Reference

      Returns BiquadFilterNode

    • The createBuffer() method of the BaseAudioContext Interface is used to create a new, empty AudioBuffer object, which can then be populated by data, and played via an AudioBufferSourceNode.

      MDN Reference

      Parameters

      • _numberOfChannels: number
      • _length: number
      • _sampleRate: number

      Returns AudioBuffer

    • The createBufferSource() method of the BaseAudioContext Interface is used to create a new AudioBufferSourceNode, which can be used to play audio data contained within an AudioBuffer object.

      MDN Reference

      Returns AudioBufferSourceNode

    • The createChannelMerger() method of the BaseAudioContext interface creates a ChannelMergerNode, which combines channels from multiple audio streams into a single audio stream.

      MDN Reference

      Parameters

      • Optional_numberOfInputs: number

      Returns ChannelMergerNode

    • The createChannelSplitter() method of the BaseAudioContext Interface is used to create a ChannelSplitterNode, which is used to access the individual channels of an audio stream and process them separately.

      MDN Reference

      Parameters

      • Optional_numberOfOutputs: number

      Returns ChannelSplitterNode

    • The createConstantSource() property of the BaseAudioContext interface creates a outputs a monaural (one-channel) sound signal whose samples all have the same value.

      MDN Reference

      Returns ConstantSourceNode

    • The createConvolver() method of the BaseAudioContext interface creates a ConvolverNode, which is commonly used to apply reverb effects to your audio.

      MDN Reference

      Returns ConvolverNode

    • The createDelay() method of the which is used to delay the incoming audio signal by a certain amount of time.

      MDN Reference

      Parameters

      • Optional_maxDelayTime: number

      Returns DelayNode

    • The createGain() method of the BaseAudioContext interface creates a GainNode, which can be used to control the overall gain (or volume) of the audio graph.

      MDN Reference

      Returns GainNode

    • The createIIRFilter() method of the BaseAudioContext interface creates an IIRFilterNode, which represents a general infinite impulse response (IIR) filter which can be configured to serve as various types of filter.

      MDN Reference

      Parameters

      Returns IIRFilterNode

    • The createOscillator() method of the BaseAudioContext interface creates an OscillatorNode, a source representing a periodic waveform.

      MDN Reference

      Returns OscillatorNode

    • The createPanner() method of the BaseAudioContext Interface is used to create a new PannerNode, which is used to spatialize an incoming audio stream in 3D space.

      MDN Reference

      Returns PannerNode

    • The createStereoPanner() method of the BaseAudioContext interface creates a StereoPannerNode, which can be used to apply stereo panning to an audio source.

      MDN Reference

      Returns StereoPannerNode

    • The createWaveShaper() method of the BaseAudioContext interface creates a WaveShaperNode, which represents a non-linear distortion.

      MDN Reference

      Returns WaveShaperNode

    • The decodeAudioData() method of the BaseAudioContext Interface is used to asynchronously decode audio file data contained in an rate, then passed to a callback or promise.

      MDN Reference

      Parameters

      • _audioData: ArrayBuffer

      Returns Promise<AudioBuffer>

    • Clean up

      Returns this

    • Invoke all of the callbacks bound to the event with any arguments passed in.

      Parameters

      • event: "statechange" | "tick"

        The name of the event.

      • ...args: any[]

        The arguments to pass to the functions listening.

      Returns this

    • Returns number

    • Prints the outputs to the console log for debugging purposes. Prints the contents only if either the object has a property called debug set to true, or a variable called TONE_DEBUG_CLASS is set to the name of the class.

      Parameters

      • ...args: any[]

      Returns void

      const osc = new Tone.Oscillator();
      // prints all logs originating from this oscillator
      osc.debug = true;
      // calls to start/stop will print in the console
      osc.start();
    • Returns number

    • Remove the event listener.

      Parameters

      • event: "statechange" | "tick"

        The event to stop listening to.

      • Optionalcallback: (...args: any[]) => void

        The callback which was bound to the event with Emitter.on. If no callback is given, all callbacks events are removed.

      Returns this

    • Bind a callback to a specific event.

      Parameters

      • event: "statechange" | "tick"

        The name of the event to listen for.

      • callback: (...args: any[]) => void

        The callback to invoke when the event is emitted

      Returns this

    • Bind a callback which is only invoked once

      Parameters

      • event: "statechange" | "tick"

        The name of the event to listen for.

      • callback: (...args: any[]) => void

        The callback to invoke when the event is emitted

      Returns this

    • Returns Promise<void>

    • Parameters

      • _fn: (...args: any[]) => void
      • _interval: number

      Returns number

    • Parameters

      • _fn: (...args: any[]) => void
      • _timeout: number

      Returns number

    • Returns Record<string, any>

    • Convert the class to a string

      Returns string

      const osc = new Tone.Oscillator();
      console.log(osc.toString());
    • Add Emitter functions (on/off/emit) to the object

      Parameters

      • constr: any

      Returns void