-
Notifications
You must be signed in to change notification settings - Fork 280
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
Error of time conversion #552
Comments
I'm not sure... Would you mind sharing an example, to help me investigate? |
Hi @chrisn , I found that the root cause of this problem is that when I use the following method to crop the zoomview, it will not be able to perfectly cut to the time interval I want. Therefore, when I use pixelOffsetToTime(), there will be an error in the calculation of time. Is my cutting method wrong? Thanks! |
The waveform is computed based on a number of audio samples per pixel. This is what you set in the When you call
and because As an example, let's say This gives Now, 0.4 * 48000 = 19200 samples. At 38 samples per pixel, this gives a waveform length of 506 pixels. This is just to illustrate the approximation, and this tends to be worse for short durations, as you've found. I'd like to fix this, to make it more accurate, but it's non-trivial. Related: bbc/audiowaveform#114 (comment) |
Hi @chrisn ,
I try to draw some custom canvases outside peaks, so I need to know how peaks convert position into time. I found two functions (timeToPixelOffset() and pixelOffsetToTime()).
When the zoomview time is greater than about 3 seconds, the conversion using these two methods is accurate, but as long as the zoomview duration is 1 second or even lower, they will have increasing errors.
Is this the current expected situation?
The text was updated successfully, but these errors were encountered: