detect

abstract fun detect(samples: FloatArray, sampleRate: Int): PitchPoint

Single-shot pitch detection. Returns the latest pitch the detector can compute from the supplied audio.

Does NOT write to pitchContour. Callers that want a streaming contour must use feedContour instead. Splitting the two responsibilities keeps single-shot callers (demo apps, reference-pitch extraction) from paying the cost of maintaining a contour they never read.

Automatically resamples to 16 kHz internally if needed. The input samples may be any size; the detector buffers them internally until a full analysis window is available.

Return

PitchPoint containing the most recent pitch (Hz) and confidence (0.0-1.0).

Parameters

samples

Mono audio samples as Float (-1.0 to 1.0). Must be single-channel.

sampleRate

Sample rate of the input audio in Hz