Pitch Detector Config
data class PitchDetectorConfig(val algorithm: PitchAlgorithm = PitchAlgorithm.YIN, val bufferSize: Int = 2048, val hopSize: Int = 160, val tolerance: Float = 0.15f, val minFreq: Float = 80.0f, val maxFreq: Float = 1000.0f, val amplitudeGateDb: Float = -40f, val confidenceThreshold: Float = 0.75f, val enableSmoothing: Boolean = false, val enableOctaveCorrection: Boolean = false, val smoothingWindowSize: Int = 5, val octaveThresholdCents: Float = 150.0f, val swiftF0BatchSize: Int = 2560)
Configuration for CalibraPitch detector.
Unified configuration for pitch detection including algorithm selection, detection parameters, and post-processing options.
Usage
// Tier 1: Use presets
val detector = CalibraPitch.createDetector(PitchDetectorConfig.BALANCED)
// Tier 2: Use Builder for discoverability
val config = PitchDetectorConfig.Builder()
.algorithm(PitchAlgorithm.SWIFT_F0)
.voiceType(VoiceType.carnaticMale)
.quietHandling(QuietHandling.SENSITIVE)
.enableProcessing()
.build()
// Tier 3: Use .copy() for raw parameter access
val config = PitchDetectorConfig.PRECISE.copy(tolerance = 0.08f)Content copied to clipboard
Constructors
Link copied to clipboard
constructor(algorithm: PitchAlgorithm = PitchAlgorithm.YIN, bufferSize: Int = 2048, hopSize: Int = 160, tolerance: Float = 0.15f, minFreq: Float = 80.0f, maxFreq: Float = 1000.0f, amplitudeGateDb: Float = -40f, confidenceThreshold: Float = 0.75f, enableSmoothing: Boolean = false, enableOctaveCorrection: Boolean = false, smoothingWindowSize: Int = 5, octaveThresholdCents: Float = 150.0f, swiftF0BatchSize: Int = 2560)
Types
Properties
Link copied to clipboard
Pitch detection algorithm (YIN or SWIFT_F0)
Link copied to clipboard
RMS amplitude threshold in dB for gating quiet frames
Link copied to clipboard
Size of the audio buffer for analysis (YIN-specific)
Link copied to clipboard
Minimum confidence (0.0-1.0) to accept pitch
Link copied to clipboard
Enable octave error correction
Link copied to clipboard
Enable pitch smoothing filter
Link copied to clipboard
How close to 1200 cents a jump must be to be corrected
Link copied to clipboard
Smoothing filter window size (must be odd)
Link copied to clipboard
Buffer size for SwiftF0 streaming detection in samples