Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getPeaks() returns an empty array

See original GitHub issue

Issue Description

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;
        this.player.wavesurfer().surfer.backend.getPeaks(length, start, end)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

DManujayacommented, Sep 2, 2021

@thijstriemstra Is there any update?

thijstriemstracommented, Nov 27, 2021

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;
        player.wavesurfer().surfer.backend.getPeaks(length, start, end)

And I see the peaks data:

Screenshot 2021-11-28 at 00 28 18
Read more comments on GitHub >

github_iconTop Results From Across the Web

wavesurfer.backend.getPeaks is returning an empty array #1891
below is my code where i was returning the audio peaks in an interval, 3 days ago it was working normally, until yesterday...
Read more >
wavesurfer getPeaks is returning an empty array
It works if you remove this line from the config: backend: 'MediaElement',. Working example: $(document).ready(function() { var wavesurfer ...
Read more >
p5.js | getPeak() Function - GeeksforGeeks
This function is used to return the array of amplitude peaks in a p5.soundfile that can be used to draw a static waveform....
Read more >
Find local maxima - MATLAB findpeaks - MathWorks
This MATLAB function returns a vector with the local maxima (peaks) of the input signal vector, data. ... Create a datetime array using...
Read more >
Array.Empty<T> Method (System) - Microsoft Learn
Returns an empty array.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found