Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

169
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda