120
Why this code works for Musicians
The "Lookahead" Scheduler: Instead of playing the sound exactly when the interval fires, the script looks ahead 100ms into the future and schedules the sound using the
audioCtx.currentTime. This bypasses any lag caused by heavy browser tabs or CPU spikes.Frequency Accents: Musicians need to know where the "1" is. This code sets the oscillator to 1000Hz for the first beat and 800Hz for the others.
Visual Feedback: The
setTimeoutused for the visual dots is calculated based on the difference between the scheduled audio time and the current time, keeping the flash perfectly in sync with the "click."Responsive Design: The UI uses
min-height: 100vhand a flexible card layout, ensuring it looks like a dedicated app on an iPhone or a tablet propped up on a music stand.