How to achieve both exact timestamps and pitch preservation when changing playback speed in web audio?

I’m working on a web app where I need to load audio with two key requirements:

1.  Exact timestamp alignment: I need precise control over timestamps for synchronization and tracking purposes.
2.  Pitch preservation when changing playback speed: When adjusting the playback speed, I want the pitch to stay the same as the original.

I’ve found that the Web Audio API provides precise timestamps, but the HTML5 element preserves pitch when the speed changes.

Is there any way to combine the advantages of both approaches? I need to ensure the audio sounds natural when speeding up or slowing down, while still maintaining exact timestamps.

Any guidance or suggestions would be greatly appreciated!

I’ve tried using Howler.js and WaveSurfer.js for this, but I’ve encountered the same limitations in both. If I load using HTML 5 it acts like HTML5 Audio element, and the same is true if load it as WebAudio Api.