Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
});
}
}