Skip to content

Commit

Permalink
Handling multi channel peaks (#3312)
Browse files Browse the repository at this point in the history
Co-authored-by: Mounir Abid <[email protected]>
  • Loading branch information
mounirabid and Mounir Abid authored Nov 6, 2023
1 parent be854c6 commit 9d112dd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugins/minimap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,18 @@ class MinimapPlugin extends BasePlugin<MinimapPluginEvents, MinimapPluginOptions
const media = this.wavesurfer.getMediaElement()
if (!data || !media) return

const peaks = [];
for (let i = 0; i < data.numberOfChannels; i++) {
peaks.push(data.getChannelData(i));
}

this.miniWavesurfer = WaveSurfer.create({
...this.options,
container: this.minimapWrapper,
minPxPerSec: 0,
fillParent: true,
media,
peaks: [data.getChannelData(0)],
peaks,
duration: data.duration,
})

Expand Down

0 comments on commit 9d112dd

Please sign in to comment.