Replies: 3 comments
-
I solved it manually but just setting teh volume 2 0 before playback and then just fade it in via js |
Beta Was this translation helpful? Give feedback.
-
@quynhanhsang you can do this two ways, one using var start = 0;
function fadeIn(time) {
if (!start){
start = time;
}
var progress = time - start;
wavesurfer.setVolume(progress / 5000);
if (progress < 5000) {
window.requestAnimationFrame(fadeIn);
}
}
wavesurfer.on('waveform-ready', function () {
wavesurfer.setVolume(0);
});
wavesurfer.on('play', function () {
window.requestAnimationFrame(fadeIn);
});
wavesurfer.on('finish', function () {
start = 0;
}); |
Beta Was this translation helpful? Give feedback.
-
Are there any downsides to fading-in using const audioContext = new AudioContext()
const mediaNode = audioContext.createMediaElementSource(wavesurfer.media);
const gainNode = audioContext.createGain();
mediaNode.connect(gainNode).connect(audioContext.destination); gainNode.gain.setValueAtTime(0, start);
gainNode.gain.linearRampToValueAtTime(1, start + duration); Using |
Beta Was this translation helpful? Give feedback.
-
Hey, thank you for testing and contributing to wavesurfer.js!
Please make sure you can check all of these points below before opening an issue:
(You don't have to post this section)
Please make sure you provide the following information (if applicable):
Wavesurfer.js version(s):
Browser and operating system version(s):
Code needed to reproduce the issue:
(Please reduce your code as much as possible and only post the minimum code needed to reproduce the issue. A Code pen is an excellent way to share such code)
Use behaviour needed to reproduce the issue:
Beta Was this translation helpful? Give feedback.
All reactions