Documentation
    Preparing search index...

    Interface OfflineAudioContext

    The OfflineAudioContext interface is an AudioContext interface representing an audio-processing graph built from linked together AudioNodes.

    MDN Reference

    interface OfflineAudioContext {
        audioWorklet: AudioWorklet;
        currentTime: number;
        destination: AudioDestinationNode;
        length: number;
        listener: AudioListener;
        oncomplete:
            | ((this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any)
            | null;
        onstatechange: ((this: BaseAudioContext, ev: Event) => any) | null;
        sampleRate: number;
        state: AudioContextState;
        addEventListener<K extends keyof OfflineAudioContextEventMap>(
            type: K,
            listener: (
                this: OfflineAudioContext,
                ev: OfflineAudioContextEventMap[K],
            ) => any,
            options?: boolean | AddEventListenerOptions,
        ): void;
        addEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | AddEventListenerOptions,
        ): void;
        createAnalyser(): AnalyserNode;
        createBiquadFilter(): BiquadFilterNode;
        createBuffer(
            numberOfChannels: number,
            length: number,
            sampleRate: number,
        ): AudioBuffer;
        createBufferSource(): AudioBufferSourceNode;
        createChannelMerger(numberOfInputs?: number): ChannelMergerNode;
        createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;
        createConstantSource(): ConstantSourceNode;
        createConvolver(): ConvolverNode;
        createDelay(maxDelayTime?: number): DelayNode;
        createDynamicsCompressor(): DynamicsCompressorNode;
        createGain(): GainNode;
        createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode;
        createIIRFilter(
            feedforward: Iterable<number>,
            feedback: Iterable<number>,
        ): IIRFilterNode;
        createOscillator(): OscillatorNode;
        createPanner(): PannerNode;
        createPeriodicWave(
            real: number[] | Float32Array<ArrayBufferLike>,
            imag: number[] | Float32Array<ArrayBufferLike>,
            constraints?: PeriodicWaveConstraints,
        ): PeriodicWave;
        createPeriodicWave(
            real: Iterable<number>,
            imag: Iterable<number>,
            constraints?: PeriodicWaveConstraints,
        ): PeriodicWave;
        createScriptProcessor(
            bufferSize?: number,
            numberOfInputChannels?: number,
            numberOfOutputChannels?: number,
        ): ScriptProcessorNode;
        createStereoPanner(): StereoPannerNode;
        createWaveShaper(): WaveShaperNode;
        decodeAudioData(
            audioData: ArrayBuffer,
            successCallback?: DecodeSuccessCallback | null,
            errorCallback?: DecodeErrorCallback | null,
        ): Promise<AudioBuffer>;
        dispatchEvent(event: Event): boolean;
        removeEventListener<K extends keyof OfflineAudioContextEventMap>(
            type: K,
            listener: (
                this: OfflineAudioContext,
                ev: OfflineAudioContextEventMap[K],
            ) => any,
            options?: boolean | EventListenerOptions,
        ): void;
        removeEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | EventListenerOptions,
        ): void;
        resume(): Promise<void>;
        startRendering(): Promise<AudioBuffer>;
        suspend(suspendTime: number): Promise<void>;
    }

    Hierarchy

    • BaseAudioContext
      • OfflineAudioContext
    Index
    audioWorklet: AudioWorklet

    The audioWorklet read-only property of the processing. Available only in secure contexts.

    MDN Reference

    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

    The destination property of the BaseAudioContext interface returns an AudioDestinationNode representing the final destination of all audio in the context.

    MDN Reference

    length: number

    The length property of the the buffer in sample-frames.

    MDN Reference

    listener: AudioListener

    The listener property of the BaseAudioContext interface returns an AudioListener object that can then be used for implementing 3D audio spatialization.

    MDN Reference

    oncomplete:
        | ((this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any)
        | null
    onstatechange: ((this: BaseAudioContext, ev: Event) => any) | null
    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

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

    MDN Reference

    • 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

      • OptionalnumberOfInputs: 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

      • OptionalnumberOfOutputs: 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

      • OptionalmaxDelayTime: number

      Returns DelayNode

    • The createDynamicsCompressor() method of the BaseAudioContext Interface is used to create a DynamicsCompressorNode, which can be used to apply compression to an audio signal.

      MDN Reference

      Returns DynamicsCompressorNode

    • 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

      • feedforward: number[]
      • feedback: number[]

      Returns IIRFilterNode

    • 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 createScriptProcessor() method of the BaseAudioContext interface creates a ScriptProcessorNode used for direct audio processing.

      Parameters

      • OptionalbufferSize: number
      • OptionalnumberOfInputChannels: number
      • OptionalnumberOfOutputChannels: number

      Returns ScriptProcessorNode

      MDN Reference

    • 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

      Returns Promise<AudioBuffer>

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • The resume() method of the context that has been suspended.

      MDN Reference

      Returns Promise<void>

    • The startRendering() method of the OfflineAudioContext Interface starts rendering the audio graph, taking into account the current connections and the current scheduled changes.

      MDN Reference

      Returns Promise<AudioBuffer>

    • The suspend() method of the OfflineAudioContext interface schedules a suspension of the time progression in the audio context at the specified time and returns a promise.

      MDN Reference

      Parameters

      • suspendTime: number

      Returns Promise<void>