peaks.js
peaks.js copied to clipboard
feature request: latency offset in options
I noticed that the audio and cursor are substantially out of sync (especially if you zoom in) due to some audio latency issues. Somewhere between 200 ms and 1000 ms. I haven't measured it yet. If this can't be resolved automatically by peaks, it would be great to enter a positive or negative offset in the options to bring them "in sync".
In other words: what you see doesn't align with what you hear.
thanks!
Apart from a known issue with variable bitrate mp3 (#221, #239), the sync should be pretty good. Can you share an example audio file with me to take a look at?
Chris, I've recorded a video on my iphone in slo-mo. In our app we have a peak/rms meter connected to WebAudio.
We always use .wav files, encoded as PCM 24-bit. Sampling rates can be 44.1, 48, 88 and 96kHz on our platform.
Looking at the video, you can see that peaks (waveform) is approx 20-25 ms ahead of the meter.
In the world of audio 25 ms is a lot! :) Humans in general notice a shift of +-1ms, especially with music.
Here is the link for the little video I shot: https://www.youtube.com/watch?v=-rMzo_1sydQ
First you see 44.1kHz, then the same in slo-mo, then everything again for 96kHz. Sampling rate doesn't seem to change the latency, Both have about 20-25ms.
Here are the two short wav files to test: https://www.dropbox.com/s/9et6grqnkllbz7t/441kHz.wav?dl=0 https://www.dropbox.com/s/mh69lrd74s0o5p9/96kHz.wav?dl=0
best,
Steve
Ah, ok, your original issue said 200 to 1000 milliseconds, I'd be concerned if sync was that far off. As it is, 20-25ms is more in the range of what's achievable.
Thanks for creating the video, that's really helpful. Please don't take the files down straight away, it may take a while for me to investigate a solution.
Yes, I'm sorry for the misleading initial numbers. I think it "felt" a lot more before I actually could measure the values. :)
I'll leave the files up. No problem.
Hi Chris, do you think there is a chance for an offset value in ms for the playhead? A range of +/ 100 ms would be great.
This way one could align the audio to the visuals. Another problem is that some people use audio over Bluetooth, which even increases the lag.
cheers
Steve
I'm hoping that this feature is as simple as adding an offset here - that's the animation loop where the playhead position is updated.
Would you mind doing an experiment to see if that works? If so, I'd be happy to take a pull request.