librosa.midi_to_svara_h

librosa.midi_to_svara_h(midi, *, Sa, abbr=True, octave=True, unicode=True)[source]

Convert MIDI numbers to Hindustani svara

Parameters
midinumeric or np.ndarray

The MIDI number or numbers to convert

Sanumber > 0

MIDI number 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 MIDI number(s)

Examples

The first three svara with Sa at midi number 60:

>>> librosa.midi_svara_h([60, 61, 62], Sa=60)
['S', 'r', 'R']

With Sa=67, midi 60-62 are in the octave below:

>>> librosa.midi_to_svara_h([60, 61, 62], Sa=67)
['ṃ', 'Ṃ', 'P̣']

Or without unicode decoration:

>>> librosa.midi_to_svara_h([60, 61, 62], Sa=67, unicode=False)
['m,', 'M,', 'P,']

Or going up an octave, with Sa=60, and using unabbreviated notes

>>> librosa.midi_to_svara_h([72, 73, 74], Sa=60, abbr=False)
['Ṡa', 'ṙe', 'Ṙe']