Changeset 016813e for python/lib/aubio
- Timestamp:
- May 10, 2016, 9:18:38 PM (9 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:
- 143682b
- Parents:
- ddfa6be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/aubio/midiconv.py
rddfa6be r016813e 5 5 py3 = sys.version_info[0] == 3 6 6 if py3: 7 str_instances = [str]8 int_instances = [int]7 str_instances = str 8 int_instances = int 9 9 else: 10 str_instances = [str, unicode]11 int_instances = [int, long]10 str_instances = (str, unicode) 11 int_instances = (int, long) 12 12 13 13 def note2midi(note): … … 17 17 'b': -1, u'♭': -1, u'\ufffd': -2} 18 18 _valid_octaves = range(-1, 10) 19 if isinstance(note, str_instances):19 if not isinstance(note, str_instances): 20 20 raise TypeError("a string is required, got %s (%s)" % (note, str(type(note)))) 21 21 if len(note) not in range(2, 5): … … 52 52 def midi2note(midi): 53 53 " convert midi note number to note name, e.g. [0, 127] -> [C-1, G9] " 54 if isinstance(midi, int_instances):54 if not isinstance(midi, int_instances): 55 55 raise TypeError("an integer is required, got %s" % midi) 56 56 if midi not in range(0, 128):
Note: See TracChangeset
for help on using the changeset viewer.