# FFT Function

**URL:** <https://forum.juce.com/t/fft-function/25277>\
**Category:** Audio Plugins\
**Created:** [November 23, 2017, 7:16pm UTC](https://forum.juce.com/t/fft-function/25277 "2017-11-23T19:16:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evvy](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@Evvy](https://forum.juce.com/u/Evvy)\
**Post date:** [November 23, 2017, 7:16pm UTC](https://forum.juce.com/t/fft-function/25277/1 "2017-11-23T19:16:37Z")

</div>

hi, me again and still with a simple problem 🙂  
project school, i have to make a plugin project by using the fft function and process the input signal, please tell me what should i do first?  
already looking for some references in git Hub but still make me confused, just need input process and no output, may i use code from example project? (Simple FFT Example), i have to get the signal real time

---

<div class="post-metadata">

**Author:** ![noahdayan](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/noahdayan/32/4093_2.png) [@noahdayan](https://forum.juce.com/u/noahdayan)\
**Post date:** [November 24, 2017, 9:12am UTC](https://forum.juce.com/t/fft-function/25277/2 "2017-11-24T09:12:08Z")

</div>

The Simple FFT example is a good place to start. It depends what you need to achieve with the FFT but the `dsp::FFT` can process the signal over complex or real numbers and if you only need magnitude frequency response, you can use the lightweight `performFrequencyOnlyForwardTransform()` function.

---

<div class="post-metadata">

**Author:** ![Evvy](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@Evvy](https://forum.juce.com/u/Evvy)\
**Post date:** [November 29, 2017, 9:02am UTC](https://forum.juce.com/t/fft-function/25277/3 "2017-11-29T09:02:28Z")

</div>

thank you Noah 🙂  
can u tell me, how much this function get frequency sample?

```
performFrequencyOnlyForwardTransform() 

```

and can i copy all the code in fft example and paste it into plugin project?  
need your help 🙂

---

<div class="post-metadata">

**Author:** ![noahdayan](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/noahdayan/32/4093_2.png) [@noahdayan](https://forum.juce.com/u/noahdayan)\
**Post date:** [November 29, 2017, 9:13am UTC](https://forum.juce.com/t/fft-function/25277/4 "2017-11-29T09:13:16Z")

</div>

The FFT example uses a FIFO to process the data 60 times a second and displays it as a spectrogram but if you only need to analyse the data, you may not need all of the example code.

What do you mean by “get frequency sample”? The array passed in the `performFrequencyOnlyForwardTransform()` needs to be twice the size of your FFT data points as it contains both input and output data. You also need to create a FFT object to call the transform on prior to this.

---

<div class="post-metadata">

**Author:** ![Evvy](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@Evvy](https://forum.juce.com/u/Evvy)\
**Post date:** [November 29, 2017, 9:56am UTC](https://forum.juce.com/t/fft-function/25277/5 "2017-11-29T09:56:12Z")

</div>

i mean "sample rate"  
and what about how make this code as a plugin?

---

<div class="post-metadata">

**Author:** ![noahdayan](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/noahdayan/32/4093_2.png) [@noahdayan](https://forum.juce.com/u/noahdayan)\
**Post date:** [November 29, 2017, 10:17am UTC](https://forum.juce.com/t/fft-function/25277/6 "2017-11-29T10:17:16Z")

</div>

You can get the sample rate from the `prepareToPlay()` function right before `getNextAudioBlock()` gets called.

I suppose you could make this as a plugin yes. I suggest starting from a plugin template in the Projucer and gradually implementing the FFT example.
