(Minim) How to Normalize FFT Data

edited November 2017 in Library Questions

I'm an intermediate-level programmer working on my first Processing project, using Minim. Before jumping into anything crazy, I'm just trying to get the basic FFT vertical bar visualizer (basically hello world for music visualization) up and running. I expected a successful test run, but I had expected the data from the FFT object to be scaled between 0 and 1, as they are when working with processing.sound. I am instead getting values between 0 and about 3.2. I know what I would need to do to perform the scaling myself, except I have absolutely no clue what the upper bound for the data should be, and I get the feeling it can vary from audio file to audio file.

There must be a simple solution to this, right? I don't see how anyone could possibly have created any controllable visualizers from FFT data otherwise, but I've spent more time searching for the answer to this than I have writing actual code.

Tagged:

Answers

  • edited November 2017

    This is actually wrong. I was mistaking very small values in the format of 3.1823839E-6 or what have you for numbers greater than 0

    Edit: No, after further debugging, this is still the case

  • edited November 2017 Answer ✓

    Question from November 15, probably gets solved. I'm also not sure if i understand concretely.
    _ Quote: _

    "I have absolutely no clue what the upper bound for the data should be" "vary from audio file to audio file."

    This sounds like you measure the amplitude, loudness of an file rather the Band spectra.

    In any other case: https://forum.processing.org/two/discussion/20491/what-range-does-getavg-return-in-minim

    Processing: norm or map

  • but I had expected the data from the FFT object to be scaled between 0 and 1, as they are when working with processing.sound

    I suggest you check the source code of the sound library and see what they are doing there.

    Kf

  • Thanks for the input, everyone. What ultimately ended up making sense to do was to watch the output for a lot of different files and impose upper and lower bounds that captured the range I was interested in. I hesitated to take this approach at first because it seemed messy and like it might fail for audio files with unusually high or low volume, but so far, it has worked just fine.

Sign In or Register to comment.