Skip to content

Instantly share code, notes, and snippets.

@abhishekkr
Last active February 27, 2019 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishekkr/802f5e3e0b5f0fee393491689b9e77fd to your computer and use it in GitHub Desktop.
Save abhishekkr/802f5e3e0b5f0fee393491689b9e77fd to your computer and use it in GitHub Desktop.
webaudio js samples
{ctx = new AudioContext();
t = {b: ctx.currentTime};
o = ctx.createOscillator();
o.connect(ctx.destination);
o.frequency.value = 500;
o.frequency.exponentialRampToValueAtTime(166,t.b+5);
o.start(t.b);
o.stop(t.b+5);}
{ctx = new AudioContext();
t = {b: ctx.currentTime};
o = ctx.createOscillator();
o.connect(ctx.destination);
o.frequency.value = 247;
o.frequency.setValueAtTime(329.63,t.b+0.25);
o.frequency.setValueAtTime(256,t.b+0.5);
o.frequency.setValueAtTime(329.63,t.b+0.75);
o.frequency.setValueAtTime(264,t.b+1);
o.frequency.setValueAtTime(329.63,t.b+1.25);
o.frequency.setValueAtTime(247,t.b+1.5);
o.frequency.setValueAtTime(329.63,t.b+1.75);
o.frequency.setValueAtTime(247,t.b+2);
o.frequency.setValueAtTime(329.63,t.b+2.25);
o.frequency.setValueAtTime(256,t.b+2.5);
o.frequency.setValueAtTime(329.63,t.b+2.75);
o.frequency.setValueAtTime(264,t.b+3);
o.frequency.setValueAtTime(329.63,t.b+3.25);
o.frequency.setValueAtTime(247,t.b+3.5);
o.frequency.setValueAtTime(329.63,t.b+3.75);
o.start(t.b); o.stop(t.b+4);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment