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

Use analyzer with existing FFT stream #3

Open
averas opened this issue May 1, 2020 · 4 comments
Open

Use analyzer with existing FFT stream #3

averas opened this issue May 1, 2020 · 4 comments

Comments

@averas
Copy link

averas commented May 1, 2020

Would it be practically possible to use the analyzer/visualization with an already existing FFT stream, which by the way is not necessarily audio, but other spectrum data.

It seems like the AudioConcext and the build in FFT is an integral part of the library.

@hvianna
Copy link
Owner

hvianna commented May 8, 2020

It would require some rework, as the project heavily relies on WebAudio API built-in functionalities.

Basically, you'd have to replace getByteFrequencyData() here to read from your stream and then adjust references to AudioContext and Analyser parameters, like fftSize and sampleRate (here and here) and frequencyBinCount here.

@popfendi
Copy link

I am also interested in using this library with an external FTT stream, but i see your previous comments point to an older version. Is this still a possibility, and could you advise on where to focus? I'm currently trying to hack my stream in by setting AudioMotionAnalyzer._fftData but having little luck getting anything drawn on the canvas.

@hvianna
Copy link
Owner

hvianna commented Dec 27, 2023

@averas @popfendi The current version of audioMotion-analyzer gets FFT data from getFloatFrequencyData() - values representing decibels are stored in a Float32Array array. I suppose different FFT implementations may use other data formats.

I can add an option for a user callback where you could provide your own data, but I need to better understand what people are using so I can try and build a flexible solution.

Can you provide more info about the FFT you're using, and/or share some code that generates your data stream?

@popfendi
Copy link

Hi @hvianna, In my case I have a IoT device producing an FFT stream as a float64 array. The aim was to consume the stream on the client and use audioMotion analyser to visualise it.

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

3 participants