function _fft (arr) {
    const len = arr.length
    if (len === 1) return [arr[0]]
    if (len % 2 === 0) {
      const ret = [
        ..._fft(arr.filter((_, i) => i % 2 === 0), len / 2),
        ..._fft(arr.filter((_, i) => i % 2 === 1), len / 2)
      ]
      for (let k = 0; k < len / 2; k++) {
        const p = ret[k]
        const q = multiplyScalar(
          ret[k + len / 2],
          exp(
            multiplyScalar(multiplyScalar(tau, I), divideScalar(-k, len))
          )
        )
        ret[k] = addScalar(p, q)
        ret[k + len / 2] = addScalar(p, multiplyScalar(-1, q))
      }
      return ret
    } else {
      // use chirp-z transform for non-power-of-2 FFT
      return _czt(arr)
    }
    // throw new Error('Can only calculate FFT of power-of-two size')
  }
Perform an 1-dimensional Fourier transform

@param {Array} arr      The array
@return {Array}         resulting array