Closed bingliscodes closed 10 months ago
This has been significantly improved by using Web Audio API and playing the sound with an Audio Context instead of audio.play, however the app still uses setInterval, which can likely be replaced.
Pre-processed audio using an audio buffer with Web Audio API seemed to do the trick. Also switched from setInterval to scheduling recursively.
When running the metronome there is sometimes a bit of a delay between clicks, which is very problematic given the role of the metronome in musical practice. To address this, we may need to use more advanced tools and techniques such as Web Audio API or Worker Timers to handle the sounds and improve accuracy. This will increase the complexity of the code, but will significantly improve the functionality.