Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.9.1.

librosa.hz_to_svara_c

librosa.hz_to_svara_c(frequencies, Sa, mela, abbr=True, octave=True, unicode=True)[source]

Convert frequencies (in Hz) to Carnatic svara

Note that this conversion assumes 12-tone equal temperament.

Parameters
frequenciespositive number or np.ndarray

The frequencies (in Hz) to convert

Sapositive number

Frequency (in Hz) of the reference Sa.

melaint [1, 72] or string

The melakarta raga to use.

abbrbool

If True (default) return abbreviated names (‘S’, ‘R1’, ‘R2’, ‘G1’, ‘G2’, …)

If False, return long-form names (‘Sa’, ‘Ri1’, ‘Ri2’, ‘Ga1’, ‘Ga2’, …)

octavebool

If True, decorate svara in neighboring octaves with over- or under-dots.

If False, ignore octave height information.

unicodebool

If True, use unicode symbols to decorate octave information.

If False, use low-order ASCII (’ and ,) for octave decorations.

This only takes effect if octave=True.

Returns
svarastr or list of str

The svara corresponding to the given frequency/frequencies

Examples

Convert Sa in three octaves:

>>> librosa.hz_to_svara_c([261/2, 261, 261*2], Sa=261, mela='kanakangi')
['Ṣ', 'S', 'Ṡ']

Convert one octave worth of frequencies using melakarta #36:

>>> freqs = librosa.cqt_frequencies(12, fmin=261)
>>> librosa.hz_to_svara_c(freqs, Sa=freqs[0], mela=36)
['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'D₂', 'D₃', 'N₃']