-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I get the playhead position of a Wad object? #140
Comments
There isn't a single property that provides this information currently, but you can compute the current position like this: const audioClip = new Wad({source: '/audio/song.wav'})
audioClip.play()
let playheadPosition = Wad.audioContext.currentTime - audioClip.lastPlayedTime I hope that helps. Cheers! |
Kind of, this only works when you have a fixed playback rate, the position in samples will mismatch with the position in seconds calculated this way when playback with a variable rate. |
Yeah, my solution won't work if you need to adjust the playback rate dynamically, but it's the best solution I can offer you. This is a known issue in the Web Audio API. There's a proposal to add a |
I'm trying to make a simple music player with Wad, and here is how I used Wad:
The text was updated successfully, but these errors were encountered: