Last active
January 19, 2023 22:43
-
-
Save xem/670dec8e70815842eb95 to your computer and use it in GitHub Desktop.
beep boop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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> |
great (and weird), but sadly, only works on Opera 12. =(
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want short and don't care so much about the sound, we can save 5 bytes on the Audio version: