9 ms·
I had a go at rewriting this to use requestAnimationFrame, and provide more instruments and some random/clear buttons: https://blog.omgmog.net/beatmaker/ https:
by omgmog 10y ago
I had a go at rewriting this to use requestAnimationFrame, and provide more instruments and some random/clear buttons: https://blog.omgmog.net/beatmaker/ https://blog.omgmog.net/beatmaker/
Including whitespace it's 102 lines: https://github.com/omgmog/beatmaker/blob/master/js/index.js https://github.com/omgmog/beatmaker/blob/master/js/index.js
An interesting thing, after a short while the browser unloads the page (Chrome on Mac OS) -- probably due to memory usage, which I think this is down to creating a new Audio element each time, rather than initialising them once and then triggering .play() when needed.
update:
Alright I'm using AudioContext now rather than `new Audio`, seems to be performing a lot better. This puts us at about 144 lines.
- mixedCase 10y agoWell your version doesn't crash shortly after toying around in it unlike OP's so good job!.
- siggy 10y agoReally like your changes! I've incorporated your use of requestAnimationFrame and AudioContext back into mine: https://github.com/siggy/beatboxer/commit/dccff243474b17ca347583b3919fbf17b625a46b https://github.com/siggy/beatboxer/commit/dccff243474b17ca34...