// Metronome — programmable click pattern (drum tab notation). // X = accent, x = hit, - = rest; each character is an eighth note. // Default practice session: 10 minutes, accelerating from 80 to 240 BPM. // Run: node examples/metronome.js 120 X-x-X-x- // Run: node examples/metronome.js 80..240 10m X-x-x-x- // Run: node examples/metronome.js bpm=90 -d 30s pat=X-x-x- sound=wood // Waltz: X-x-x- Rock: X-x-X-x- Reggaeton: X--x--x- // Keys: space pause · ←/→ tempo ±2 BPM · ↑/↓ cycle sound · t tap-tempo · q quit import { readFileSync } from 'node:fs' import { AudioContext } from 'web-audio-api' import { createInstrument } from './graphs/metronome.js' import { args, num, sec, keys, status, clearLine, pausedTag, help } from './utils.js' help({ description: 'run a programmable practice metronome', usage: ['', '[bpm|start..end] [duration] [pattern]', '120 X-x-X-x-', '80..240 10m X-x-x-x-', 'bpm=90 dur=30s pat=X-x-x- sound=wood'], options: [ ['bpm=', 'fixed tempo or linear tempo ramp (default: 80..240)'], ['-d, --duration