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

getPeaks() returns an empty array #149

Closed
DManujaya opened this issue Sep 1, 2021 · 6 comments
Closed

getPeaks() returns an empty array #149

DManujaya opened this issue Sep 1, 2021 · 6 comments

Comments

@DManujaya
Copy link

I'm trying to get the peak data of a WAV file so that I can cluster the silences in the audio but the getPeaks() method returns an empty array.
Any help would be really appreciated.

This is what I have tried so far:

this.player.on("waveReady", (event) => {
      var length = this.player.wavesurfer().surfer.getDuration();
      var start = 0;
      var end = length;
      console.log(
        this.player.wavesurfer().surfer.backend.getPeaks(length, start, end)
      );
    });
@thijstriemstra
Copy link
Member

thijstriemstra commented Sep 1, 2021

you should include the videojs(-wavesurfer) configuration and version ors. It's part of ticket guidelines!!

@DManujaya
Copy link
Author

DManujaya commented Sep 1, 2021

Sorry about that!
react: 17.0.2,
videojs-wavesurfer: 3.8.0

image

@DManujaya
Copy link
Author

@thijstriemstra Is there any update?

@thijstriemstra
Copy link
Member

im on a holiday. do you see any updates? you know it's very rude to demand an answer from me?

@DManujaya
Copy link
Author

@thijstriemstra Really sorry about that. Didn't mean to come off as aggressive. Enjoy your holiday.
Once again I apologize

@thijstriemstra
Copy link
Member

You shouldn't check it in the waveReady event. Trying your example and pasting this in the console:

var length = player.wavesurfer().surfer.getDuration();
      var start = 0;
      var end = length;
      console.log(
        player.wavesurfer().surfer.backend.getPeaks(length, start, end)
      );

And I see the peaks data:

Screenshot 2021-11-28 at 00 28 18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants