# Little help with FFT viewer

**URL:** <https://forum.juce.com/t/little-help-with-fft-viewer/15084>\
**Category:** General JUCE discussion\
**Created:** [July 7, 2015, 9:38am UTC](https://forum.juce.com/t/little-help-with-fft-viewer/15084 "2015-07-07T09:38:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francesco\_Setragno](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@Francesco\_Setragno](https://forum.juce.com/u/Francesco_Setragno)\
**Post date:** [July 7, 2015, 9:38am UTC](https://forum.juce.com/t/little-help-with-fft-viewer/15084/1 "2015-07-07T09:38:54Z")

</div>

Hi,

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&nbsp;_getNextAudioBlock()&nbsp;_function. Can you help me?

Thank you.

---

<div class="post-metadata">

**Author:** ![Jordan\_Harris](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jordan\_Harris](https://forum.juce.com/u/Jordan_Harris)\
**Post date:** [July 7, 2015, 10:09am UTC](https://forum.juce.com/t/little-help-with-fft-viewer/15084/2 "2015-07-07T10:09:00Z")

</div>

There's actually a FFT example&nbsp;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&nbsp;apps are probably&nbsp;one of the best ways to learn JUCE.

&nbsp;

Here's where the example is in the GitHub repository:

https://github.com/julianstorer/JUCE/tree/master/examples/SimpleFFTExample

---

<div class="post-metadata">

**Author:** ![Francesco\_Setragno](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@Francesco\_Setragno](https://forum.juce.com/u/Francesco_Setragno)\
**Post date:** [July 7, 2015, 12:56pm UTC](https://forum.juce.com/t/little-help-with-fft-viewer/15084/3 "2015-07-07T12:56:20Z")

</div>

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  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type is 'unknown-type'  
> error C3861: 'jmap': identifier not found  
> &nbsp;

The involved lines are the constructor:

> public:  
> &nbsp; &nbsp; SpectrogramComponent()  
> &nbsp; &nbsp; &nbsp; &nbsp; : forwardFFT (fftOrder, false),  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spectrogramImage (Image::RGB, 512, 512, true),  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fifoIndex (0),  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nextFFTBlockReady (false)  
> &nbsp; &nbsp; {  
> &nbsp; &nbsp; &nbsp; &nbsp; setOpaque (true);  
> &nbsp; &nbsp; &nbsp; &nbsp; setAudioChannels (2, 0); &nbsp;// we want a couple of input channels but no outputs  
> &nbsp; &nbsp; &nbsp; &nbsp; startTimerHz (60);  
> &nbsp; &nbsp; &nbsp; &nbsp; setSize (700, 500);  
> &nbsp; &nbsp; }

and the declaration of the _forwardFFT_ variable:

> private:  
> &nbsp; &nbsp; FFT forwardFFT;  
> &nbsp;

Is there something wrong in the code, or am I missing something?&nbsp;

---

<div class="post-metadata">

**Author:** ![Jordan\_Harris](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jordan\_Harris](https://forum.juce.com/u/Jordan_Harris)\
**Post date:** [July 7, 2015, 1:04pm UTC](https://forum.juce.com/t/little-help-with-fft-viewer/15084/4 "2015-07-07T13:04:47Z")

</div>

It compiled last time I tried on Visual Studio 2013. What IDE are you using? I can try it again if you want.&nbsp;

---

<div class="post-metadata">

**Author:** ![Francesco\_Setragno](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@Francesco\_Setragno](https://forum.juce.com/u/Francesco_Setragno)\
**Post date:** [July 7, 2015, 1:21pm UTC](https://forum.juce.com/t/little-help-with-fft-viewer/15084/5 "2015-07-07T13:21:20Z")

</div>

I used the version from GitHub and now it works. Thank you again!

---

<div class="post-metadata">

**Author:** ![Jordan\_Harris](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jordan\_Harris](https://forum.juce.com/u/Jordan_Harris)\
**Post date:** [July 7, 2015, 1:25pm UTC](https://forum.juce.com/t/little-help-with-fft-viewer/15084/6 "2015-07-07T13:25:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SteffenE](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@SteffenE](https://forum.juce.com/u/SteffenE)\
**Post date:** [June 20, 2017, 11:47am UTC](https://forum.juce.com/t/little-help-with-fft-viewer/15084/7 "2017-06-20T11:47:38Z")

</div>

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…
