Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda