Skip to content

Instantly share code, notes, and snippets.

@LewisGet
Created August 7, 2016 12:11
Show Gist options
  • Save LewisGet/832b69cf6ff54924a8cd551ae98f4c74 to your computer and use it in GitHub Desktop.
Save LewisGet/832b69cf6ff54924a8cd551ae98f4c74 to your computer and use it in GitHub Desktop.
var real = new Float32Array(2);
var imag = new Float32Array(2);
var ac = new AudioContext();
var osc = ac.createOscillator();
real[0] = 0;
imag[0] = 0;
real[1] = 1;
imag[1] = 0;
var wave = ac.createPeriodicWave(real, imag, {disableNormalization: true});
osc.setPeriodicWave(wave);
osc.connect(ac.destination);
osc.start();
osc.stop(2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment