Skip to content

Instantly share code, notes, and snippets.

@twetzel
Forked from xem/gist:670dec8e70815842eb95
Created January 29, 2016 09:11
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 twetzel/519a628adbb6e132ef6b to your computer and use it in GitHub Desktop.
Save twetzel/519a628adbb6e132ef6b to your computer and use it in GitHub Desktop.
beep boop
<!-- solution 1, 117b, inspired by http://www.p01.org/releases/140bytes_music_softSynth/ -->
<button onclick="new Audio('data:audio/wav;base64,UklGRl9vT19XQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YU'+Array(1e3).join(123)).play()">Beep</button>
<!-- Solution 2, 107b, inspired by http://xem.github.io/chip8/c8.html -->
<button onclick="o=(A=new AudioContext()).createOscillator();o.connect(A.destination);o.start(0);setTimeout('o.stop(0)',500)">Boop</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment