Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Spectrum (Analysis)  (Read 5436 times)

0 Members and 1 Guest are viewing this topic.

Mind Calamity

  • Newbie
  • *
  • Posts: 10
    • View Profile
Spectrum (Analysis)
« on: November 20, 2011, 04:29:43 pm »
So, I've been trying to make an application that needs spectrum analysis, and not paying $200+ (or 6000 in the case of FMOD), so after a bit of researching I concluded that SFML will probably be the best choice for me, so now the problem is: How ?

I have no idea how to do it, all I know is I need to implement the FFT algorithm and use it with the sound buffer samples, or so I read in a thread similar to mine, to be precise it said:

 
Quote
1. Get playing offset
2. Get small amount of samples starting from that offset
3. Use FFT on those samples
4. Visualize


Does anyone have any idea how to do that ?

I've been thinking of using FFTW for FFT, but it's C, which I don't really like, and it seems like it's pretty tricky to compile with VS, I also found FFTReal, which is C++, but I still have no idea how to use it, as it has no tutorials, nor documentation, so yeah...

I'm open to suggestions, also if anyone is going to suggest another library, I need it to be free for commercial use.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Spectrum (Analysis)
« Reply #1 on: November 20, 2011, 04:54:39 pm »
What have you already tried? What don't you understand exactly? We're not going to write the full code for you ;)

FFTW is the most popular library for FFT. What's the problem with C? I think it's ok for low-level libraries that provide very precise functionality. It's not as if we were talking about a full game framework ;)
Laurent Gomila - SFML developer

Mind Calamity

  • Newbie
  • *
  • Posts: 10
    • View Profile
Spectrum (Analysis)
« Reply #2 on: November 20, 2011, 05:08:39 pm »
Quote from: "Laurent"
What have you already tried?

As I have no idea where to start, I haven't tried anything, I'm currently searching for an "easy" way to use FFTW, by easy I mean under 300-500 lines properly written/formatted/understandable code, after that I'm planning to actually try to compile FFTW, as it's primary platform seems to be GCC and Linux, it's not that straight-forward to compile it on Windows.
(Everyone should start using CMake IMO)

Quote
FFTW is the most popular library for FFT. What's the problem with C? I think it's ok for low-level libraries that provide very precise functionality. It's not as if we were talking about a full game framework ;)


The problem with C is, it's not C++ (which I'm used to, and am probably too lazy to drop my habits).

Quote from: "Laurent"
What don't you understand exactly? We're not going to write the full code for you ;)


That's obvious, so I wasn't expecting it. ;)
As for what I don't understand, I haven't tried much, yet, but I'm going to give FFTW a try now, if I encounter any trouble on my way of using the both libraries together, or actually succeed in it, I'm going to report back with code and a detailed explanation on the problem/solution.

In the mean time, if anyone has some code from their previous/current project, feel free to donate, if you feel like it.

Whoops, I failed to notice that FFTW was GPL, so it's out of the question, FFTReal remains, and is under the WTFPL, and I think it will suffice, once I figure out how to use it.

Update: FFTReal is used in the Qt spectrum demo, time to try and adapt it to SFML.

kobilica

  • Newbie
  • *
  • Posts: 15
    • View Profile
Spectrum (Analysis)
« Reply #3 on: January 17, 2012, 04:34:47 pm »
C compiles in C++. Make a class, which utilizes FFT library. What is the problem?

kobilica

  • Newbie
  • *
  • Posts: 15
    • View Profile
Spectrum (Analysis)
« Reply #4 on: January 17, 2012, 05:23:06 pm »
Also look at CLAM C++ library.

 

anything