Skip to content

Prep release 1#1

Merged
nickmaccarthy merged 11 commits into
mainfrom
prep-release-1
Jan 7, 2026
Merged

Prep release 1#1
nickmaccarthy merged 11 commits into
mainfrom
prep-release-1

Conversation

@nickmaccarthy

Copy link
Copy Markdown
Owner

No description provided.

Nick MacCarthy added 11 commits January 1, 2026 10:56
- Update Swift models with formatting improvements
- Refine view layouts and constants
- Update test files for consistency
- Sync docs pages with latest features
Sine Wave improvements:
- Add 2nd, 3rd, 4th harmonics with boosted amplitudes (1.0, 0.7, 0.5)
- Add 5th and 6th harmonics for very low frequencies (<100Hz)
- Frequency-dependent gain boost up to 1.7x for low notes
- Increase base output gain to 0.95

Karplus-Strong (plucked string) improvements:
- Double low-pass filtering for warmer excitation
- Pick position simulation at 0.35 for guitar-like timbre
- Body resonance filter for warmth
- Add 2x harmonic for notes below 150Hz
- Add 3x and 4x harmonics for very low notes (<100Hz like C, D)
- Increase output gain to 0.95, reduce brightness for warmer tone

Test fixes:
- Add Foundation import to AboutViewTests and TunerViewModelTests
- Update ToneGeneratorTests for new parameters
- Fix flaky testPitchAccuracy and testAttackEnvelope tests
- Increase sineOutputGain from 0.95 to 1.0
- Increase outputGain (K-S) from 0.95 to 1.0
- Increase maxFrequencyBoost from 1.7 to 2.0 for low frequencies
- Update tests to match new values
Audio session fix:
- Change ToneGenerator to use .playAndRecord category (matches AudioEngine)
- Add .defaultToSpeaker option to ensure sound plays through speaker
- This fixes the OSStatus error 561017449 ('!pri') conflict

Volume boost:
- Increase maxFrequencyBoost from 2.0 to 2.5
- Increase stringHarmonicBoost2x from 0.5 to 0.7
- Increase stringHarmonicBoost3x from 0.7 to 0.9
- Increase stringHarmonicBoost4x from 0.5 to 0.7
Problem: ~500ms delay when starting tone playback because the audio
engine was created and started on every play() call.

Solution: Keep the audio engine running continuously and control
sound generation via a flag. The engine outputs silence when not
playing, giving instant response when play() is called.

Changes to ToneGenerator.swift:
- Add shouldGenerateSound flag to control audio output
- Add prepareEngine() method for early initialization
- Modify play() to just set flag and frequency (no engine restart)
- Modify stop() to fade out and clear flag (keep engine running)
- Add stopGenerating() for soft stop vs stopImmediate() for teardown
- Audio callback outputs silence when shouldGenerateSound is false
- Add currentToneTypeIsSine for thread-safe tone type access

Changes to TunerViewModel.swift:
- Call toneGenerator.prepareEngine() in init() to pre-warm engine

Expected improvement:
- First tone: ~50ms (engine warm-up at app start)
- Subsequent tones: instant (< 10ms)
…deView, themed ToolsMenuView, and enforced landscape lock.
- Remove low-pass filter, use full-band RMS energy for better click detection
- Fix detection order: check for onset BEFORE updating threshold
- Only update smoothed energy during quiet periods (non-onset)
- Lower all thresholds for maximum sensitivity:
  - onsetThresholdRatio: 1.1
  - risingEdgeRatio: 1.02
  - noiseFloor: 0.0005
- Show BPM after just 2 beats for faster first result
- Add beat-synced ring animation with ripple effect
- Simplify BPM calculation using median of intervals
- Validated Metronome 'Listen' stability with autocorrelation algorithm

- Fixed half-time detection error (120 vs 60 BPM) using harmonic weighting

- Updated BeatDetectorTests for new algorithm

- Removed 'Confidence' UI from MetronomeView

- Tweaked SpectrumAnalyzerView responsiveness
- Added Beat Detection algorithm specs

- Added BeatDetectorTests.swift to test list
@nickmaccarthy nickmaccarthy merged commit 5a46f37 into main Jan 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant