Changeset f552e9e for python/lib/aubio
- Timestamp:
- Mar 10, 2013, 5:13:51 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:
- 9ead7a9
- Parents:
- 33102ab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/aubio/midiconv.py
r33102ab rf552e9e 2 2 3 3 def note2midi(note): 4 " convert a note name to a midi note value " 5 # from C-2 to G8, though we do accept everything in the upper octave 4 " convert note name to midi note number, e.g. [C-1, G9] -> [0, 127] " 6 5 _valid_notenames = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11} 7 6 _valid_modifiers = {None: 0, u'♮': 0, '#': +1, u'♯': +1, u'\udd2a': +2, 'b': -1, u'♭': -1, u'\ufffd': -2} 8 7 _valid_octaves = range(-1, 10) 8 if type(note) not in (str, unicode): 9 raise TypeError, "a string is required, got %s" % note 9 10 if not (1 < len(note) < 5): 10 11 raise ValueError, "string of 2 to 4 characters expected, got %d (%s)" % (len(note), note)
Note: See TracChangeset
for help on using the changeset viewer.