Created
April 10, 2024 07:05
-
-
Save katspaugh/064352f48990781f8e5328ed18f4301b 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
// Regions plugin | |
import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7.7.6/dist/wavesurfer.esm.js' | |
import RegionsPlugin from 'https://unpkg.com/wavesurfer.js@7.7.6/dist/plugins/regions.esm.js' | |
// Create an instance of WaveSurfer | |
const ws = WaveSurfer.create({ | |
container: '#waveform', | |
waveColor: 'rgb(200, 0, 200)', | |
progressColor: 'rgb(100, 0, 100)', | |
url: '/examples/audio/audio.wav', | |
}) | |
// Initialize the Regions plugin | |
const wsRegions = ws.registerPlugin(RegionsPlugin.create()) | |
wsRegions.enableDragSelection({ | |
color: 'rgba(255, 0, 0, 0.1)', | |
}) | |
/* | |
<html> | |
<div id="waveform"></div> | |
</html> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment