How to use the standardized-audio-context.PeriodicWave function in standardized-audio-context

To help you get started, we’ve selected a few standardized-audio-context examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vitaliy-bobrov / js-rocks / src / app / audio / effects / lfo.ts View on Github external
for (let i = 0; i < periodicWaveSize; ++i) {
      if (i & 1) {
        // is odd number
        const npf = i * Math.PI;
        real[i] =
          2 *
          (Math.sin(npf * tau) / (npf * tau)) *
          (Math.sin(npf * tr) / (npf * tr)) *
          Math.cos(2 * npf - npf * (tau - tr));
      } else {
        real[i] = 0;
      }
    }

    return new PeriodicWave(this.osc.context, {
      real,
      imag,
      disableNormalization: true
    });
  }
}