Created
May 11, 2024 13:33
-
-
Save katspaugh/d5da9feca7995cd70caabe1ce6ec18d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Huge randomized peaks array | |
import WaveSurfer from 'wavesurfer.js' | |
const peaks = Array.from({ length: 1000000 }, (_, i) => Math.sin(i * Math.random() * 0.01)) | |
const wavesurfer = WaveSurfer.create({ | |
container: document.body, | |
waveColor: 'rgb(200, 0, 200)', | |
progressColor: 'rgb(100, 0, 100)', | |
barWidth: 10, | |
barRadius: 10, | |
barGap: 2, | |
url: '/examples/audio/demo.wav', | |
minPxPerSec: 1, | |
peaks, | |
duration: 3 * 60 * 60 * 1000, | |
}) | |
wavesurfer.on('interaction', () => { | |
wavesurfer.play() | |
}) | |
wavesurfer.on('finish', () => { | |
wavesurfer.setTime(0) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment