wavesurfer-channel-selecter-plugin
v1.0.5
Published
Desibel meter plugin for wavesurfer.js
Downloads
12
Readme
WaveSurfer Channel Selecter Plugin
WaveSurfer.js Channel Selecter Plugin
NOTE This plugin works for WebAudio backend only for now.
Usage
import ChannelSelecterPlugin from "wavesurfer-channel-selecter-plugin";
const wavesurfer = WaveSurfer.create({
container: document.getElementById("wavesurfer"),
backend: "WebAudio", // Just WebAudio for now..
...
plugins: [
...
ChannelSelecterPlugin.create(),
...
],
});
document.getElementById('some-button').onclick = () => {
wavesurfer.setActiveChannel(1);
// wavesurfer.setActiveChannel(1, 2);
// wavesurfer.setActiveChannel([1, 2, 3]);
}
// Reset wavesurfer and show all channels.
document.getElementById('reset-button').onclick = () => {
wavesurfer.showAllChannels();
}
wavesurfer.on("channel-selected", (selectedChannels) => {
console.log(selectedChannels) // [1]
});
Installation
$ npm i wavesurfer-channel-selecter-plugin
Methods
setActiveChannel
- Draw selected channels.showAllChannels
- Reset to waveform.
Events
channel-selected
- Trigger when selected channels are updated. Selected channels will pass as first argument.
Screens
Initial View
3th, 4th and 5th channels selected view
Todos
- Support for MediaElement backend.
- Tests
License
MIT
Free Software, Hell Yeah!