wavesurfer pan code example
Example: wavesurfer pan
var wavesurfer = WaveSurfer.create({
container: document.querySelector('#wave'),
backend: 'MediaElementWebAudio'
});
// You have to use the same methods of MediaElement backend to load the audio file, passing peaks
wavesurfer.load('big_audio.mp3', normalizedPeaks, 11625);
// Example for StereoPanner node
wavesurfer.panner = wavesurfer.backend.ac.createStereoPanner();
let sliderPanner = document.querySelector('[data-action="pan"]');
sliderPanner.addEventListener('input', () => {
wavesurfer.panner.pan.value = Number(sliderPanner.value);
});
wavesurfer.backend.setFilter(wavesurfer.panner)