Giter VIP home page Giter VIP logo

Comments (6)

calebj0seph avatar calebj0seph commented on May 25, 2024 1

@gokgozf Sorry for the late reply, haven't really touched any of my Github projects since COVID all started. Now that I'm getting back into things, I'm hoping to make Spectro into a reusable library with an npm package while also keeping this repository maintained. I've started by upgrading all of the dependencies, next I'm going to be refactoring the codebase into a library while putting the current demo in a separate directory that uses the new library. No ETA yet as I haven't worked with the code in a year, but hopefully not too long!

from spectro.

Elvincth avatar Elvincth commented on May 25, 2024

Really looking forward to this !

from spectro.

gokgozf avatar gokgozf commented on May 25, 2024

Hi @calebj0seph
I was looking at the possible libraries around, and I saw your demo, it looks quite good.
I have two questions about making the library issue?

  1. do you have a plan to release on npm?
  2. do you plan to maintain the repository and accept pull requests?

from spectro.

rechmbrs avatar rechmbrs commented on May 25, 2024

@calebj0seph

Please have a look at these websites:
https://stackoverflow.com/questions/6663222/doing-fft-in-realtime
https://www.dsprelated.com/showarticle/776.php

They refer to what is called Sliding Window Fourier Transform which is a much faster way to compute the spectrogram. The FFT cost is nLogn where as the SWFT is n.

Using the SWFT should reduce the lag between the sound and the display of the spectrogram.

I'm looking for a Javascript version I had and will send it up if I can find it.

RONC

from spectro.

calebj0seph avatar calebj0seph commented on May 25, 2024

@rechmbrs Thanks for the links!

From what I understand a sliding DFT is used when you want to compute the DFT for windows which are only 1 sample apart. In this case, yes it makes much more sense to use an O(N) algorithm each window rather than an O(N*log(N)) algorithm since you're computing it every sample.

For a spectrogram though, we don't need to compute the DFT every sample. In Spectro, we only do this every 1024 samples with a window size of 4096 samples. If we do some quick calculations, we end up with (samples / 1024) * (4096 * log(4096)) operations. If we were to replace this with a sliding DFT, instead calculating the DFT for a window every sample, we end up with samples * 4096 operations. This might seem simpler at first, but if you do the math the sliding DFT ends up being orders of magnitude slower since we have to compute it every sample instead of every 1024 samples.

Unless I'm misunderstanding something, it doesn't look like this would help performance at all.

from spectro.

rechmbrs avatar rechmbrs commented on May 25, 2024

@calebj0seph
the sliding DFT can be used to drop m samples and pickup p samples. Most often m = p = 1.

Please contact me at rechmbrs [at] gmail [dot] com to follow on with this. I have a number of other parts to discuss. We can then bring results back here for others.

RONC

from spectro.

Related Issues (6)

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.