Detector
Realtime pitch detector for processing audio buffers.
Handles variable buffer sizes by internally accumulating samples until it has enough for pitch detection. This is important because:
iOS delivers audio at hardware sample rate (48kHz) in ~100ms chunks
After resampling to 16kHz, buffers may be smaller than required frame size
Implementations:
YinRealtimeDetector: YIN algorithm - frame-by-frame DSP, no ML dependency
SwiftF0RealtimeDetector: SwiftF0 neural network - batch-oriented, higher accuracy
Properties
The configuration used to create this detector
Check if post-processing is active
Live pitch contour accumulated during recording.
Whether post-processing is currently enabled. Set to enable/disable at runtime.
Functions
Clear the accumulated pitch contour.
Detect pitch from audio samples.
Create a duplicate detector with the same configuration.
Get the amplitude (RMS) of the audio samples.
Set the maximum duration for the live pitch contour.