librosa.mela_to_svara
- librosa.mela_to_svara(mela, *, abbr=True, unicode=True)[source]
Spell the Carnatic svara names for a given melakarta raga
This function exists to resolve enharmonic equivalences between pitch classes:
Ri2 / Ga1
Ri3 / Ga2
Dha2 / Ni1
Dha3 / Ni2
For svara outside the raga, names are chosen to preserve orderings so that all Ri precede all Ga, and all Dha precede all Ni.
- Parameters:
- melastr or int
the name or numerical index of the melakarta raga
- abbrbool
If True, use single-letter svara names: S, R, G, …
If False, use full names: Sa, Ri, Ga, …
- unicodebool
If True, use unicode symbols for numberings, e.g., Ri₁
If False, use low-order ASCII, e.g., Ri1.
- Returns:
- svaralist of strings
The svara names for each of the 12 pitch classes.
See also
Examples
Melakarta #1 (Kanakangi) uses R1, G1, D1, N1
>>> librosa.mela_to_svara(1) ['S', 'R₁', 'G₁', 'G₂', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'N₁', 'N₂', 'N₃']
#19 (Jhankaradhwani) uses R2 and G2 so the third svara are Ri:
>>> librosa.mela_to_svara(19) ['S', 'R₁', 'R₂', 'G₂', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'N₁', 'N₂', 'N₃']
#31 (Yagapriya) uses R3 and G3, so third and fourth svara are Ri:
>>> librosa.mela_to_svara(31) ['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'N₁', 'N₂', 'N₃']
#34 (Vagadheeswari) uses D2 and N2, so Ni1 becomes Dha2:
>>> librosa.mela_to_svara(34) ['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'D₂', 'N₂', 'N₃']
#36 (Chalanatta) uses D3 and N3, so Ni2 becomes Dha3:
>>> librosa.mela_to_svara(36) ['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'D₂', 'D₃', 'N₃']
# You can also query by raga name instead of index:
>>> librosa.mela_to_svara('chalanatta') ['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'D₂', 'D₃', 'N₃']