Author Message

<  beginners  ~  ofSoundGetSpectrum on liveinput

PostPosted: Wed Apr 08, 2009 1:33 am
Joined: Wed Apr 08, 2009 1:27 amPosts: 3
Hi Everyone,

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?


Offline Profile
PostPosted: Wed Apr 08, 2009 8:19 am
User avatarJoined: Fri May 04, 2007 11:43 amPosts: 157
noF wrote:
So I'm guessing that ofSoundGetSpectrum only gives you the spectrum of sounds that are being played via soundPlayer?


you are right. you have to use fftw or something similar.

best
joerg



_________________
---

http://joerg.piringer.net
Offline Profile
PostPosted: Wed Apr 08, 2009 9:57 am
Joined: Wed Apr 08, 2009 1:27 amPosts: 3
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...


Offline Profile
PostPosted: Wed Apr 08, 2009 10:03 am
User avatarJoined: Fri May 04, 2007 11:43 amPosts: 157
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.

best
joerg



_________________
---

http://joerg.piringer.net
Offline Profile
PostPosted: Wed Apr 08, 2009 10:44 am
User avatarSite AdminJoined: Mon Feb 05, 2007 9:31 pmPosts: 1806Location: brooklyn
there is some live audio input to FFT code here, within this package:

http://visiblevisible.org/teaching/avsys/blog/?p=48

which features dave bollinger's fft octana ported to cpp:

http://www.davebollinger.com/works/p5/fftoctana/

that does binning on the FFT, like an equalizer. the code is a bit complex, but the result is a really clean fft.

take care!
zach


Offline Profile
PostPosted: Wed Apr 08, 2009 10:50 am
Joined: Wed Apr 08, 2009 1:27 amPosts: 3
That's great. Thanks!

edit: dave bollinger's fft code - really super clean. Wow.


Last edited by noF on Wed Apr 08, 2009 1:40 pm, edited 1 time in total.

Offline Profile
PostPosted: Wed Apr 08, 2009 1:30 pm
Joined: Sat Mar 29, 2008 1:05 pmPosts: 261Location: Lisbon, Portugal
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.



_________________
www.ruim.pt
Online Profile
PostPosted: Wed Apr 08, 2009 4:55 pm
Joined: Mon Dec 01, 2008 12:28 amPosts: 268Location: Vancouver, BC, Canada
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()).



_________________
http://twitter.com/plong0
Offline Profile

Display posts from previous:  Sort by:

All times are UTC
Page 1 of 1
8 posts
Users browsing this forum: No registered users and 1 guest
Search for:
Post new topic  Reply to topic
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron