# Frequencies not adding up

**URL:** <https://discourse.processing.org/t/frequencies-not-adding-up/9170>\
**Category:** Libraries\
**Created:** [March 10, 2019, 9:36am UTC](https://discourse.processing.org/t/frequencies-not-adding-up/9170 "2019-03-10T09:36:40Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [March 11, 2019, 12:49am UTC](https://discourse.processing.org/t/frequencies-not-adding-up/9170/4 "2019-03-11T00:49:13Z")

</div>

> [@Aeggy](#):
>
> I don’t think it’s mentioned in the documentation

yes, while the wording regarding BANDS is correct, it is not that clear  
as long you not mention the samples used.

> [@Aeggy](#):
>
> I don’t understand why processing does it this way

actually it might be a much better way for beginner who possibly are  
not interested into samples…  
just want a spectrum, anyhow a deeper understanding of FFT can not get  
from a one sentence of a code example.

again pls understand that processing does not do FFT, it just sends the  
sample array to the JAVA analyze function and gets back the spectrum  
for what it needs you to declare how long that array should be.

now that relation:  
samples FFT spectrum ( bands )  
i was hoping is more clear after you read the other posts,  
it has nothing to do with processing, code… it comes from the

> Sampling Theorem

and is valid for all types of signal analysis.

* * *

> [@Aeggy](#):
>
> Also, when you print all the amplitudes for bands below 30, what are you trying to show?

as from any line graphic i can not count lines

- i like the printed list ( i am more the excel type ),
- 
  - just limited to (30) and

- 
  - only printed at keyPressed  
( because a conti print in draw slows down the frameRate and would not be readable anyhow )

* * *

now for the math of digital audio:  
the used signal has 440Hz, so one sinus fits into 2.27 msec  
for a sampling rate of the audio signal of [44,100 Hz - Wikipedia](https://en.wikipedia.org/wiki/44,100_Hz)  
what does a sample every 22.67 usec.  
so takes 100.22 samples of that ONE 440Hz sinus.

if we use / analyze 1024 samples it contains 10.21 of that 440Hz sinus(es).  
( and covers 23.2 msec == max 43 batches per sec. ) )

---

_[View the full topic](https://discourse.processing.org/t/frequencies-not-adding-up/9170)._
