const real = new Float32Array(2);
const imag = new Float32Array(2);
const ac = new AudioContext();
const osc = ac.createOscillator();
real[0] = 0;
imag[0] = 0;
real[1] = 1;
imag[1] = 0;
const wave = ac.createPeriodicWave(real, imag, { disableNormalization: true });
osc.setPeriodicWave(wave);
osc.connect(ac.destination);
osc.start();
osc.stop(2);BaseAudioContext: createPeriodicWave() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.