bingliscodes / metronome

Metronome App with Practice Tracking
0 stars 0 forks source link

Imprecise Timing for clicks #1

Closed bingliscodes closed 10 months ago

bingliscodes commented 10 months ago

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.

bingliscodes commented 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.

bingliscodes commented 10 months ago

Pre-processed audio using an audio buffer with Web Audio API seemed to do the trick. Also switched from setInterval to scheduling recursively.