. High precision clock timer based on Web Audio API (AudioContext)
The most important requirement in musical instrument performance and rhythm training is to maintain an accurate beat (tempo) that does not allow even millisecond deviations.
Typical JavaScript timer functions such as setTimeout and setInterval can easily experience a delay (jitter) of several milliseconds to tens of milliseconds due to the load on the browser's main thread or the setting of a tab in the background.
This system directly uses the Web Audio API (AudioContext.currentTime), which is a hardware clock dedicated to browser audio processing, as the clock source.
As a result, we have achieved a timer thread with the same high precision as a crystal oscillator, which is not affected by CPU load or screen drawing delays.
Lookahead Scheduling to reduce jitter in the JavaScript event loop
In order to maximize the accuracy of the Web Audio API, this tool implements a "Lookahead Scheduling" algorithm. This is a method that calculates the timestamp of a click sound that will be played in the future every few milliseconds and pre-registers it in the audio hardware's buffer.
Due to this double timer structure, even if the browser UI thread becomes temporarily heavy, the click sounds already scheduled to the audio buffer will continue to be emitted at the correct timing, ensuring that the rhythm will never be interrupted or distorted.
Time signature determination (2/4, 3/4, 4/4, 6/8) and tone accent oscillator generation
In order to accommodate a variety of music genres and practice styles, it incorporates an acoustic synthesis engine for accent sounds (strong beats and weak beats).
Click sounds are dynamically generated by controlling the frequency and envelope (GainNode) of sine waves and square waves in real time using the Web Audio API's OscillatorNode without using a sampling sound source file.
It is designed to make complex time signature systems such as 2/4, 3/4, 4/4, and 6/8 clearly understood both visually and aurally by emitting a high-pitched accent pitch (e.g.
1000Hz) at the beginning of the beat (1st beat) and a standard pitch (e.g. 800Hz) from the second beat onwards.
Low-latency sound synthesis and offline operation using completely local processing
This metronome tool is a completely local web application that does not require downloading audio files or communicating with external servers.
All acoustic waveforms are calculated and pronounced in real time by the browser's internal audio processor.
Therefore, latency (pronunciation delay) is kept to an absolute minimum, and the beat starts the moment you press the button. In addition, it is possible to continue operating completely even in an offline environment (such as a studio or underground practice area) where the Internet connection is disconnected.
. Synchronous control of BPM (1~300) modulation and visual tempo indicator
Tempo settings (BPM: Beats Per Minute) can be intuitively adjusted from 1 to 300 in 1 steps. When changing tempo, the running clock calculation logic recalculates the phase in real time, creating a seamless transition with no beat breaks or double notes when switching tempos.
In addition, the Web Audio API's timer event and the on-screen visual indicator (Flash LED) are precisely synchronized via requestAnimationFrame, so you can confirm the exact beat by blinking the screen even in environments where the click sound is difficult to hear during loud performances.
Frequently Asked Questions (FAQ)
Q1. Will the sound continue to play even if I put my smartphone screen in the background or put it to sleep?
A1. Although it depends on the browser specifications and OS power saving settings, the design is such that background playback is maintained while the Web Audio API is enabled.
For more stable playback, we recommend temporarily turning off the screen's automatic sleep mode while playing.
Q2. Can I adjust the volume and pitch of the click sound?
A2. Yes, you can freely change it using the volume slider and accent sound settings on the screen. It is tuned to a comfortable frequency response that does not sting your ears.
Q3. Can it be used in a soundproof room or basement studio that is not connected to the internet?
A3. Yes, once you open the page, all audio synthesis processing is completed within your device, so you can use it without any problems even in a completely offline environment.