Giter Club home page Giter Club logo

Comments (5)

miguelmota avatar miguelmota commented on June 16, 2024

That would be a good feature to have. At the moment it is not supported. I'm happy to merge in a PR if you or someone else is able to fork it and add this functionality

from spectrogram.

night1008 avatar night1008 commented on June 16, 2024

@miguelmota Can you give some tips about how to draw at once by reading the full audio file?

from spectrogram.

ilovecomputers avatar ilovecomputers commented on June 16, 2024

I was curious too, so I looked at the wavesurfer's spectrogram example page and set a breakpoint where they grab the audio buffer and calculate the spectrum. When the breakpoint is hit, I follow up the call stack and notice they call a web audio method that spectrogram.js doesn't (disregard that, it is called and I'm idiot who can't read manuals): decodeAudioData. I'll try to see if I can get spectrogram.js to do the same.

from spectrogram.

ilovecomputers avatar ilovecomputers commented on June 16, 2024

I was sorely mistaken. Both wavesurfer and spectrogram.js grab the entire audio buffer, so why is wavesurfer drawing the whole spectrum at once while spectogram only draws one at a time as the audio plays? Waverunner grabs the entire PCM data and does it's own FFT calculation while spectrogram.js uses the built in web audio analyser.

Quickly looking at AnalyserNode, I'm not seeing a way to grab the frequency samples for the entire audio buffer. Oh dear 😅

from spectrogram.

ilovecomputers avatar ilovecomputers commented on June 16, 2024

If you're wondering why Waverunner uses it's own FFT, it's not because AnalyserNode can't sample the entire audio buffer. There is a way to work around that, but it's fraught with error. Waverunner used to use onaudioprocess like spectrogram.js does and that audio process was run in an OfflineAudioContext, which, as the commit notes, has problems on webkit browsers.

Pretty much, if you want to avoid rolling out your own FFT for this use case, we have to wait for AudioWorklets to be supported by both webkit and firefox

from spectrogram.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.