Is it possible to also change pitch when using setPlaybackRate()? #2673
-
When I use setAudioRate it changes the tempo and maintains the same pitch. I'm currently using backend: MediaElement and for fast loading I think I need to stick with this as it's part of a player on my website for previewing mp3s. Thanks, Tom |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
No. But there are ways to make it possible with workarounds. |
Beta Was this translation helpful? Give feedback.
-
@tombburnell you can set your own webaudio filter to achieve this. I'll create a sample soon, but here is something to get started with: var pitchFilter = wavesurfer.backend.ac.createBiquadFilter();
filter.type = "peaking";
filter.frequency.value = 1000;
filter.Q.value = 1;
filter.gain.value = 10;
wavesurfer.backend.setFilter(pitchFilter); |
Beta Was this translation helpful? Give feedback.
-
@tombburnell that's due to how modern browsers deal with the playback speed. From MDN:
See https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playbackRate You can see in this example, I've disabled |
Beta Was this translation helpful? Give feedback.
@tombburnell that's due to how modern browsers deal with the playback speed. From MDN:
See https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playbackRate
You can see in this example, I've disabled
preservePitch
, and it produces a comical chipmunk voice when you press "octave up": https://codepen.io/katspaugh/pen/xxaYLRa