Changeset 9ead7a9 for python/lib/aubio
- Timestamp:
- Mar 10, 2013, 5:14:49 PM (12 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 7d89e61
- Parents:
- f552e9e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/aubio/midiconv.py
rf552e9e r9ead7a9 37 37 raise ValueError, "%s is outside of the range C-2 to G8" % note 38 38 return midi 39 40 def midi2note(midi): 41 " convert midi note number to note name, e.g. [0, 127] -> [C-1, G9] " 42 if type(midi) != int: 43 raise TypeError, "an integer is required, got %s" % midi 44 if not (-1 < midi < 128): 45 raise ValueError, "an integer between 0 and 127 is excepted, got %d" % midi 46 midi = int(midi) 47 _valid_notenames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'] 48 return _valid_notenames[midi % 12] + str( midi / 12 - 1)
Note: See TracChangeset
for help on using the changeset viewer.