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_h

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

Convert frequencies (in Hz) to Hindustani 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.

abbrbool

If True (default) return abbreviated names (‘S’, ‘r’, ‘R’, ‘g’, ‘G’, …)

If False, return long-form names (‘Sa’, ‘re’, ‘Re’, ‘ga’, ‘Ga’, …)

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_h([261/2, 261, 261*2], Sa=261)
['Ṣ', 'S', 'Ṡ']

Convert one octave worth of frequencies with full names:

>>> freqs = librosa.cqt_frequencies(12, fmin=261)
>>> librosa.hz_to_svara_h(freqs, Sa=freqs[0], abbr=False)
['Sa', 're', 'Re', 'ga', 'Ga', 'ma', 'Ma', 'Pa', 'dha', 'Dha', 'ni', 'Ni']