API Docs for: 2.7.1
Show:

SPAudioBuffer Class

Module: Core

Wrapper around AudioBuffer to support audio source caching and allowing clipping of audiobuffers to various lengths.

Constructor

SPAudioBuffer

(
  • audioContext
  • URL
  • startPoint
  • endPoint
  • [AudioBuffer]
)

Parameters:

  • audioContext AudioContext

    WebAudio Context.

  • URL String/AudioBuffer/File

    The source URL or File object or an AudioBuffer to encapsulate.

  • startPoint Number

    The startPoint of the AudioBuffer in seconds.

  • endPoint Number

    The endPoint of the AudioBuffer in seconds.

  • [AudioBuffer] Object optional

    audioBuffer An AudioBuffer object incase the URL has already been downloaded and decoded.

Methods

getChannelData

(
  • channel
)

Returns the Float32Array representing the PCM audio data for the specific channel.

Parameters:

  • channel Number

    This parameter is an index representing the particular channel to get data for. An index value of 0 represents the first channel.

Properties

buffer

AudioBuffer

The actual AudioBuffer that this SPAudioBuffer object is wrapping around. The getter of this property returns a clipped AudioBuffer based on the startPoint and endPoint properties.

Default: null

endPoint

Number

The ending point of the buffer in seconds. This, along with the startPoint property, decides which part of the original buffer is clipped and returned by the getter of the buffer property.

Default: null

numberOfChannels

Number

The number of discrete audio channels.

sampleRate

Number

The sample-rate for the PCM audio data in samples per second.

sourceURL

String/File

URL or File object that is the source of the sound in the buffer. This property can be used for indexing and caching decoded sound buffers.

Default: null

startPoint

Number

The starting point of the buffer in seconds. This, along with the endPoint property, decides which part of the original buffer is clipped and returned by the getter of the buffer property.

Default: null