I spent the day fiddling with my web tape player again! It’s getting there!
I’d held of for a while because I knew a lot of it needed to be rewritten, the previous experimentation had showed how it should have been implemented but that was a long way away from where the code was.
The core of it is now two AudioWorklets “threads”, one for recording and the other for playback. The first chunks up microphone audio and sends it to the main thread to be stored in IndexedDB and the second maintains a window of that audio data to be played back at different speeds. Now there’s a satisfying rewind sound when you’ve got some audio loaded into it!
I’m very much tired of my decision to not use any libraries and implement this in pure #JavaScript but I really have learnt so much in doing the process, albeit very slowly. It’s also been fun to use JavaScript in a low-level kind of way, I ended up needing a pool of buffers to prevent doing allocation during audio playback.
It’s still by no means finished, but it’s starting to feel like a vertical slice is taking shape.