Skip to content
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

Exported peaks out of range (greater than 1) break drawing #4015

Open
akjcon opened this issue Jan 30, 2025 · 0 comments
Open

Exported peaks out of range (greater than 1) break drawing #4015

akjcon opened this issue Jan 30, 2025 · 0 comments
Labels

Comments

@akjcon
Copy link

akjcon commented Jan 30, 2025

Bug description

When exporting peaks using exportPeaks(), if the audio is too loud at any points, it will very occasionally return a value that is larger than 1. This is a bug in and of itself, but the real bug is that when using those calculated peaks to draw the waveform, if there is even a single point larger than 1, the entire drawing will break and not display anything. The canvas is still created, but no waveforms are drawn. The only indicator that the peaks were incorrect was the getDecodedData() function would never return true.

Environment

  • Browser: Chrome

Minimal code snippet

<WavesurferPlayer
url={assetUrl}
height={0}
onReady={handleReady}
onError={(error) => {
console.error([${assetId}] WaveSurfer onError callback, error);
}}
/>

// handleReady function...
const peaks = instance.exportPeaks({
channels: 1,
maxLength: 1000,
precision: 10000,
});

You can use this file to test it, this produces out of range values most of the time: https://backendstack-infobotpublicmediabucket54fa782c-v7uucaracfsr.s3.us-west-1.amazonaws.com/assets/sounds/music/luxury%20electronic%20pulsating%20deep%20atmospheric.mp3

Expected result

I would expect either an error to be thrown, or a waveform to be drawn with a missing peak where the out of bounds values are

Obtained result

No peaks drawn at all, and no error message.

Screenshots

@akjcon akjcon added the bug label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant