computeSvaraTemplate

fun computeSvaraTemplate(contour: PitchContour, tonicHz: Float, genre: MusicGenre, svaras: List<String>, config: SvaraTemplateConfig = SvaraTemplateConfig.DEFAULT): SvaraTemplate

Compute a data-driven SvaraTemplate for a raga from a pitch contour.

Folds the contour's pitch histogram into one octave, peak-picks it, and for each svara the raga uses (named in svaras) takes the measured peak near its theory position, falling back to the theory default when no peak is close. The result is extended across octaves with octave accents.

The raga's svaras are named in the genre's vocabulary:

Return

The raga's measured svara grid, ready for transcribeNotes.

Parameters

contour

Input pitch contour (should be processed first; see quantize notes).

tonicHz

Tonic frequency in Hz (must be > 0).

genre

Music genre selecting the svara vocabulary (Hindustani or Carnatic).

svaras

The svara names the raga uses, e.g. ["S","R","G","m","P","D","N"].

config

Template configuration (smoothing, peak tolerance, octave span).

Throws

if tonicHz <= 0, genre is WESTERN, or a name in svaras is not a valid svara for the genre.