Really enjoying getting into openFrameworks.
Am trying to use ofSoundGetSpectrum to give me a spectrum from the live input as accessed via audioReceived() / audioRequested().
It doesn’t seem to work. Have I missed something?
So I’m guessing that ofSoundGetSpectrum only gives you the spectrum of sounds that are being played via soundPlayer?
So I’m guessing that ofSoundGetSpectrum only gives you the spectrum of sounds that are being played via soundPlayer?[/quote]
you are right. you have to use fftw or something similar.
OK Cool. Thanks!
Yes I thought of using fftw.
Before I do that, I wondered about writing a small block of audio to disk and loading it back to soundPlayer.
Is there any way to stream audio to disk within openFrameworks at the moment? This would be fine for fft frames as they are in pretty large blocks.
If there isn’t currently an easy oF method for this, Is there a generic IO data read/write-to-disk utility in C++ that’s easy to implement? Would be useful for all sorts of things…
don’t do that! the audio (at least on my mac but i changed the audio system so it might be wrong for untweaked OF) runs in a different thread. you’ll get all sorts of heavy problems.
fftw is not that hard to use.
there is some live audio input to FFT code here, within this package:
which features dave bollinger’s fft octana ported to cpp:
that does binning on the FFT, like an equalizer. the code is a bit complex, but the result is a really clean fft.
That’s great. Thanks!
edit: dave bollinger’s fft code - really super clean. Wow.
Hi, i have some code to do that, its a simple wrapper of an FFT class that was posted here in the forum a long time ago by Grimus (i think…, i tried searching but i can’t seem to find the thread), anyway i can send that to you if you still want, pm me.
I would be interested in any code relating to FFT spectrum code. Really trying to get into writing music visuals.
I started on an ofxEQVisualizer add-on that uses a float* (returned by ofSoundGetSpectrum) to point to the array of spectrum values. If anyone is interested in this one, please PM me and I will send it. It’s got a couple basic implementations including a bargraph and a waveform, and then a couple variations on the waveform (like one where it caches the previous spectrum values and does a bit of animation fading them out). It also includes functions to flip or mirror horizontal and vertical so you can create symmetrical displays of the spectrum. The goal of this add-on is to centralize any code that acts/draws with the raw spectrum values, and as a result make creating new visuals as easy as overriding a single method. Using composites (ie. layering) of several more basic visuals is an easy way to create more interesting visuals - I plan to write a wrapper to handle compositing them together (so your testApp isn’t cluttered with several updates() and draws()).