Class audioBlock
audioBlock
Defined in: audioBlock.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Audio asset object.
|
Field Attributes | Field Name and Description |
---|---|
Total number of bytes that this audioBlock consists of.
|
|
Number of samples within this entire waveform.
|
|
The base panning that should be used during playback.
|
|
The base volume of the sample that should be used during playback.
|
Method Attributes | Method Name and Description |
---|---|
appendBlock(block)
Adds the given audioBlock at the end of this audioBlock
|
|
define(data)
Clears the current data store of the AudioBlock and
replaces it with the given data.
|
|
getSampleFromSeconds(seconds)
Returns the exact sample that corresponds to the given time in seconds.
|
|
getSecondsFromSample(sample)
Returns the exact time in seconds that corresponds to the given sample.
|
|
getSubBlock(start, end)
Creates a new audioblock that is a snippet of this audioBlock.
|
|
insertBlock(position, block)
Inserts the data of the given audioBlock at the sample given
within this audioBlock.
|
|
read()
Retrieves the raw data of the waveform.
|
|
removeBlock(start, end)
Removes the portion of the audioBlock specified
|
Class Detail
audioBlock()
Audio asset object.
An audio waveform is defined in sandboxe as a stream of samples,
where samples are 2 channels of
information representing the amplitude of the
waveform at that point. More specifically,
samples are 16-bit signed integers.
Though, it is important to note that AudioBlocks represent stereo
waveforms, where per sample, there exist two datum values, one for each channel.
As such, data for the waveform is
interleaved to qualify both channels, where the subsequent sample
corresponds to the channel opposite of the current one.
Field Detail
numBytes
Total number of bytes that this audioBlock consists of.
numSamples
Number of samples within this entire waveform. Writing to this value has no effect.
panning
The base panning that should be used during playback. Default value: .5
volume
The base volume of the sample that should be used during playback.
Default value: 1.0
Method Detail
appendBlock(block)
Adds the given audioBlock at the end of this audioBlock
- Parameters:
- {audioBlock} block
- The audioBlock to append to this block
define(data)
Clears the current data store of the AudioBlock and
replaces it with the given data.
- Parameters:
- {Array} data
- The audio samples that the AudioBlock will now consist of. Audio samples ere are pairs of implitudes interpreted as uin16 values.
getSampleFromSeconds(seconds)
Returns the exact sample that corresponds to the given time in seconds.
- Parameters:
- {Number} seconds
- The seconds to query.
getSecondsFromSample(sample)
Returns the exact time in seconds that corresponds to the given sample.
- Parameters:
- {Number} sample
- The sample to query.
{audioBlock}
getSubBlock(start, end)
Creates a new audioblock that is a snippet of this audioBlock.
- Parameters:
- {Number} start
- The sample that the subblock should start at
- {Number} end
- The sample that the sublock should end at
- Returns:
- {audioBlock} The new audioBlock
insertBlock(position, block)
Inserts the data of the given audioBlock at the sample given
within this audioBlock.
- Parameters:
- {Number} position
- The position to insert the block
- {audioBlock} block
- The audioBlock to insert
{Array}
read()
Retrieves the raw data of the waveform.
- Returns:
- {Array} An array of audio samples representing the wave form, where audio samples are pairs of uint16 values.
removeBlock(start, end)
Removes the portion of the audioBlock specified
- Parameters:
- {Number} start
- Where to start removing from in samples
- {Number} end
- Where to end removing from in samples