compute Svara Template
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:
MusicGenre.HINDUSTANI → 12-TET grid, names
S r R g G m M P d D n N.MusicGenre.CARNATIC → just-intonation grid, 16 swarasthanas
S R1 R2 R3 G1 G2 G3 M1 M2 P D1 D2 D3 N1 N2 N3.
Return
The raga's measured svara grid, ready for transcribeNotes.
Parameters
Input pitch contour (should be processed first; see quantize notes).
Tonic frequency in Hz (must be > 0).
Music genre selecting the svara vocabulary (Hindustani or Carnatic).
The svara names the raga uses, e.g. ["S","R","G","m","P","D","N"].
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.