src/common/utils/windows.js
function initHannWindow(buffer, size, normCoefs) {
  let linSum = 0;
  let powSum = 0;
  const step = 2 * PI / size;

  for (let i = 0; i < size; i++) {
    const phi = i * step;
    const value = 0.5 - 0.5 * cos(phi);

    buffer[i] = value;

    linSum += value;
    powSum += value * value;
  }

  normCoefs.linear = size / linSum;
  normCoefs.power = sqrt(size / powSum);
}
function initHannWindow(buffer, size, normCoefs) {
  let linSum = 0;
  let powSum = 0;
  const step = 2 * PI / size;

  for (let i = 0; i < size; i++) {
    const phi = i * step;
    const value = 0.5 - 0.5 * cos(phi);

    buffer[i] = value;

    linSum += value;
    powSum += value * value;
  }

  normCoefs.linear = size / linSum;
  normCoefs.power = sqrt(size / powSum);
}
function initHannWindow ( buffer , size , normCoefs ) { let linSum = 0 ; let powSum = 0 ; const step = 2 * PI / size ; for ( let i = 0 ; i < size ; i ++ ) { const phi = i * step ; const value = 0.5 - 0.5 * cos ( phi ) ; buffer [ i ] = value ; linSum += value ; powSum += value * value ; } normCoefs . linear = size / linSum ; normCoefs . power = sqrt ( size / powSum ) ; }
window creation functions
window creation functions