getStereoWaveformPeaks
getStereoWaveformPeaks(
audioBuffer,options?):object
Defined in: packages/pleco-xa/src/scripts/analysis/WaveformData.ts:142
Extracts stereo waveform data for left and right channels
Parameters
Section titled “Parameters”audioBuffer
Section titled “audioBuffer”any
Web Audio API AudioBuffer
options?
Section titled “options?”Extraction options
Returns
Section titled “Returns”object
Stereo waveform data with left and right channels
isMono
Section titled “isMono”isMono:
boolean=true
left:
object=mono
left.data
Section titled “left.data”data:
Float32Array<any>
left.duration
Section titled “left.duration”duration:
any=audioBuffer.duration
left.length
Section titled “left.length”length:
any=data.length
left.metadata
Section titled “left.metadata”metadata:
object
left.metadata.method
Section titled “left.metadata.method”method:
string=opts.type
left.metadata.originalLength
Section titled “left.metadata.originalLength”originalLength:
any=channelData.length
left.metadata.samplesPerPeak
Section titled “left.metadata.samplesPerPeak”samplesPerPeak:
number
left.peaks
Section titled “left.peaks”peaks:
Float32Array<any>
left.sampleRate
Section titled “left.sampleRate”sampleRate:
any=audioBuffer.sampleRate
right:
object=mono
right.data
Section titled “right.data”data:
Float32Array<any>
right.duration
Section titled “right.duration”duration:
any=audioBuffer.duration
right.length
Section titled “right.length”length:
any=data.length
right.metadata
Section titled “right.metadata”metadata:
object
right.metadata.method
Section titled “right.metadata.method”method:
string=opts.type
right.metadata.originalLength
Section titled “right.metadata.originalLength”originalLength:
any=channelData.length
right.metadata.samplesPerPeak
Section titled “right.metadata.samplesPerPeak”samplesPerPeak:
number
right.peaks
Section titled “right.peaks”peaks:
Float32Array<any>
right.sampleRate
Section titled “right.sampleRate”sampleRate:
any=audioBuffer.sampleRate
Example
Section titled “Example”import { getStereoWaveformPeaks } from './analysis/WaveformData.ts';
const stereo = getStereoWaveformPeaks(audioBuffer, { width: 800 });console.log('Left channel:', stereo.left.data);console.log('Right channel:', stereo.right.data);