🌱 audio worklets In the last post, we've been filling fixed length audio buffers. While this is very simple to implement, it's a bit annoying when the audio is always stopping. To calculate samples infinitely, we can use an AudioWorklet. Now we've arrived at a typical bytebeat/floatbeat editor: 💡 hit ctrl+enter to update the code & ctrl+. to stop ((( // by stimmer (2011-10-03) t*(4|t>>13&3)>>(~t>>11&1)&128|t*(t>>11&t>>13)*(~t>>9&3)&127 ) & 255) / 127.5 - 1)/4 play | stop The AudioWorklet is the lowest abstaction we get with the Web Audio API. It essentially gives us a function that fills a buffer of 128 samples over and over again, also running isolated from the rest of the page. At a sample rate of 44100/s, this means we fill a buffer every ~3ms (44100/128). Here are some examples to try: hello sine slow sine (inaudible) just intonation triad hello saw hello pulse wandering sine bytebeat 1 bytebeat 2 gladyouask - chirps aks - TR-808-like hihat show source (271 loc) 🌱 audio worklets

🌱 audio worklets

In the last post, we've been filling fixed length audio buffers. While this is very simple to implement, it's a bit annoying when the audio is always stopping. To calculate samples infinitely, we can use an AudioWorklet. Now we've arrived at a typical bytebeat/floatbeat editor:

💡 hit ctrl+enter to update the code & ctrl+. to stop
play | stop

The AudioWorklet is the lowest abstaction we get with the Web Audio API. It essentially gives us a function that fills a buffer of 128 samples over and over again, also running isolated from the rest of the page. At a sample rate of 44100/s, this means we fill a buffer every ~3ms (44100/128).

Here are some examples to try:

show page source

    

back to garten.salat

back to garten.salat