Created
February 10, 2026 06:53
-
-
Save amiika/56d103ca913035104d98c597b3cfdaa2 to your computer and use it in GitHub Desktop.
minimalistic bytebeat live coding editor
This file contains hidden or 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
| <body style=margin:0;overflow:hidden;background:#000000> | |
| <textarea id=v style="width:100%;height:100%;background:0 0;border:0;color:#4AF262;font:1.4rem monospace;padding:20;" spellcheck=false> | |
| t >> 3 | t & t >> 4 + (t >> 14 & 4) | ((t >> 14 & 2) ? t&t*t>>2 : t&t>>7)</textarea> | |
| <script> | |
| let c,n; | |
| const w = `registerProcessor('a', class extends AudioWorkletProcessor { | |
| constructor() { super(); this.t = 0; this.port.onmessage = e => { | |
| try { let n = new Function('t', 'with(Math) return ' + e.data); n(0); this.f = n; } catch(_) {} | |
| }} | |
| process(_, o) { | |
| const d = o[0][0]; | |
| for (let i = 0; i < d.length; i++) { | |
| d[i] = ((this.f(this.t++)&255)-128)/128; | |
| } | |
| return true; | |
| } | |
| })`; | |
| v.oninput = v.onclick = async () => { | |
| if (!c) { | |
| c = new AudioContext({ sampleRate: 8000 }); | |
| await c.audioWorklet.addModule(URL.createObjectURL(new Blob([w], {type:'text/javascript'}))); | |
| n = new AudioWorkletNode(c, 'a'); | |
| n.connect(c.destination); | |
| } | |
| if (c.state === 'suspended') c.resume(); | |
| n && n.port.postMessage(v.value); | |
| }; | |
| </script> | |
| </body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment