I'm new to Juce and I'm trying to figure out how it works. I created a new Audio application with Introjucer. I would like to perform af FFT on the input audio and display it. I have been looking for some examples but I didn't find anything. My main doubts are how to include the necessary libraries and how to manage the getNextAudioBlock() function. Can you help me?
There's actually a FFT example included with JUCE. If you're getting JUCE from the GitHub repository (which you should), you'll find it in the examples folder. I haven't really had any time to really look at it, but I'm sure it'll help you. The demo/example apps are probably one of the best ways to learn JUCE.
Here's where the example is in the GitHub repository:
Hi, thank you very much for your answer. I didn't get JUCE from GitHub so I didn't see that example. It clarifies my doubts a lot, but when I try to build it I got some errors:
error C2146: syntax error : missing ';' before identifier 'forwardFFT'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2614: 'SpectrogramComponent' : illegal member initialization: 'forwardFFT' is not a base or member
error C2065: 'forwardFFT' : undeclared identifier
error C2228: left of '.performFrequencyOnlyForwardTransform' must have class/struct/union
type is 'unknown-type'
error C3861: 'jmap': identifier not found
The involved lines are the constructor:
: forwardFFT (fftOrder, false),
spectrogramImage (Image::RGB, 512, 512, true),
setAudioChannels (2, 0); // we want a couple of input channels but no outputs
setSize (700, 500);
and the declaration of the forwardFFT variable:
Is there something wrong in the code, or am I missing something?
It compiled last time I tried on Visual Studio 2013. What IDE are you using? I can try it again if you want.
I used the version from GitHub and now it works. Thank you again!
Sweet! Yeah I just tried it again with VS 2015 and VS 2013 and it works. It's actually a pretty neat little app. I've been wanting to make a simple FFT analyzer so I'll probably take a good look at this code soon.
By the way, you should really get yourself familiar with Git and GitHub. That way you can easily stay up to date with JUCE, as well as have all of the awesome benefits Git gives you. Not having version control is a real nightmare. I use it on almost every project now and make commits quite frequently so I don't have to worry about messing something up and not being able to get back to my working version. There's still a lot of things I need to learn about Git though.
This topic is quite old, but I have problems using a build of this FFT example. It looks like there is nothing I can do with it.
It doesnt show a spectrum when I playback something on the notebook or say something into the notebooks mic.
Just a black window. Thats it.
I actually wanted to dive into the code and come up with an own implementation in form of a VST plugin …and do some additional stuff with the magnitudes. But I want to at least see what it’s doing. My own fft viewer in VST is acting really weird…