Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
How to map the values of AnalyserNode.getFloatFrequencyData() to values between 0 and 1?

EDIT: Apparently the lowest non-infinity value is -250. I generated a silent audio file with DarkAudacity and the lowest frequency value I got was -249.21243286132812, which is BASICALLY -250

Oh yeah, the question title might be somewhat wrong, so I guess you should just do this, as an answer to the title's question:

for (let i = 0; i < FrequencyData.length; i++) {
    FrequencyData[i] = FrequencyData[i] / 250 + 1;
}

Original Question:

What I want to have: An array of Frequency Data that is easier to work with.

What I need to do to achieve it: Abstract the Frequency Data into Values between 0 and 1. (0 being silent and 1 being "loudest")

The Problem: I don't know what the lowest value is that can be returned by AnalyserNode.getFloatFrequencyData() (However, I assume the highest value is just 0, unless I get told otherwise)

What I have tried:

  • Looking up the lowest possible value that can be returned. (everyone said -Infinity, which doesn't help because I would only get 0 or 1 if I tried to scale that)
  • Get the lowest value myself by console logging. (Kind of worked but I got -236.[lotsOfDecimalsHere], and I dislike to think that the lowest value has decimals)

Here is roughly what my second try was:

let lowest = Infinity;

function loop() {
    myAnalyserNode.getFloatFrequencyData(myFrequencyData);

    if (!myFrequencyData.includes(-Infinity)) {
        lowest = Math.min(lowest, ...myFrequencyData);
    }

    console.log(lowest);
    requestAnimationFrame(loop);
}

loop();
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!