extract

fun extract(samples: FloatArray, sampleRate: Int, segments: List<Segment>, keyHz: Float, contourExtractor: PitchContourExtractor, config: ReferenceExtractorConfig = ReferenceExtractorConfig.DEFAULT): LessonMaterial

Pre-extract reference features into a LessonMaterial.

Return

A LessonMaterial with pitch contour and HPCP frames populated.

Parameters

samples

Reference audio, mono. Resampled to 16 kHz internally.

sampleRate

Sample rate of samples in Hz.

segments

Phrase boundaries + lyrics for the lesson.

keyHz

Tonic frequency in Hz.

contourExtractor

Pitch contour extractor; caller owns its lifecycle.

config

HPCP frame geometry (must match the consuming session).

Throws

if samples is empty, sampleRate <= 0, keyHz <= 0, or segments is empty.