getWaveformRange
getWaveformRange(
audioBuffer,startTime,endTime,options?):object
Defined in: packages/pleco-xa/src/scripts/analysis/WaveformData.ts:256
Generates waveform data for a specific time range
Parameters
Section titled “Parameters”audioBuffer
Section titled “audioBuffer”any
Web Audio API AudioBuffer
startTime
Section titled “startTime”any
Start time in seconds
endTime
Section titled “endTime”any
End time in seconds
options?
Section titled “options?”Extraction options
Returns
Section titled “Returns”object
Waveform data for the specified range
data:
Float32Array<any>
duration
Section titled “duration”duration:
any=audioBuffer.duration
length
Section titled “length”length:
any=data.length
metadata
Section titled “metadata”metadata:
object
metadata.method
Section titled “metadata.method”method:
string=opts.type
metadata.originalLength
Section titled “metadata.originalLength”originalLength:
any=channelData.length
metadata.samplesPerPeak
Section titled “metadata.samplesPerPeak”samplesPerPeak:
number
peaks:
Float32Array<any>
sampleRate
Section titled “sampleRate”sampleRate:
any=audioBuffer.sampleRate
Example
Section titled “Example”import { getWaveformRange } from './analysis/WaveformData.ts';
// Get waveform for seconds 10-20const rangeWaveform = getWaveformRange(audioBuffer, 10, 20, { width: 500, type: 'rms'});