# Using the FFT library, is it possible to get the beats per minute?

**URL:** <https://discourse.processing.org/t/using-the-fft-library-is-it-possible-to-get-the-beats-per-minute/22965>\
**Category:** Libraries\
**Created:** [August 1, 2020, 12:57pm UTC](https://discourse.processing.org/t/using-the-fft-library-is-it-possible-to-get-the-beats-per-minute/22965 "2020-08-01T12:57:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 1, 2020, 3:51pm UTC](https://discourse.processing.org/t/using-the-fft-library-is-it-possible-to-get-the-beats-per-minute/22965/2 "2020-08-01T15:51:50Z")

</div>

Hello,

Please include references when discussing a library.

FFT is part of the Processing sound library:

> **[Sound / Libraries](https://processing.org/reference/libraries/sound/index.html)**
>
> Playback audio files, audio input, synthesize sound, and effects.

I have a deep voice and was beeping like a metronome to test some code out.  
I actually made “beep” sounds.

Steps:

- Started with:  
[FFT / Libraries / Processing.org](https://processing.org/reference/libraries/sound/FFT.html)
- focused only on low end of the spectrum from the array  
[println() / Reference / Processing.org](https://processing.org/reference/println_.html) used to see data to get a sense of it
- grabbed the time when there was a “beep” (peak power at the frequency range of interest)  
[millis() / Reference / Processing.org](https://processing.org/reference/millis_.html)
- calculate the difference between times
- flags (true\false) were used in code to keep track of peaks and lows so I was able to calculate time differences

I was able to get the time between “beeps” in this first attempt.

It would require a lot more work to clean this up and work with a broader spectrum of sound with a “beat” hidden in there.

Some of the filters look like something to try; depends on what the “beat” is that you are filtering.

> [@anon76195010](#):
>
> If so what would I type exactly?

> [@Would anyone know how to get the tempo/speed of a song using import processing.sound.\* library?](https://discourse.processing.org/t/would-anyone-know-how-to-get-the-tempo-speed-of-a-song-using-import-processing-sound-library/22928/5):
>
> I have a university project and it is very hard to find the correct library.

Sometimes you have to write your own code from what is available in existing libraries.

This is an academic exercise from what I have gleaned from your other posts so I will not be sharing code.

`:)`

---

_[View the full topic](https://discourse.processing.org/t/using-the-fft-library-is-it-possible-to-get-the-beats-per-minute/22965)._
