Skip to content

Commit b913f77

Browse files
author
Nick MacCarthy
committed
Update CLAUDE.md with Metronome details
- Added Beat Detection algorithm specs - Added BeatDetectorTests.swift to test list
1 parent f46eba8 commit b913f77

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Test files are located in `Stay TunedTests/`:
3333
- `TuningTests.swift` - Tuning and GuitarString models
3434
- `AudioTests.swift` - Pitch detection and spectrum analyzer sensitivity
3535
- `TunerViewModelTests.swift` - ViewModel business logic
36+
- `BeatDetectorTests.swift` - Autocorrelation & BPM logic
3637

3738
### Critical Audio Configuration (DO NOT CHANGE WITHOUT TESTING)
3839

@@ -99,6 +100,12 @@ Stay Tuned/
99100
- **Confirmed strings:** Persist green state until user taps to retune
100101
- **All-tuned celebration:** Quick flash + haptic when all strings confirmed
101102

103+
### Beat Detection (BeatDetector.swift)
104+
- **Algorithm:** Normalized Autocorrelation (172Hz resolution)
105+
- **Harmonic Correction:** "Double-Time Check" favors 2x tempos (e.g., 120 vs 60 BPM) if detected strength > 50%
106+
- **Buffer:** 3.5s circular buffer of RMS energy
107+
- **Range:** 60-200 BPM
108+
102109
### Audio Pipeline
103110
1. AudioEngine captures mic input with small buffer (low latency)
104111
2. PitchDetector accumulates samples and detects pitch

0 commit comments

Comments
 (0)