Changeset e76842e


Ignore:
Timestamp:
Apr 19, 2016, 12:44:46 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
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:
9b7f238
Parents:
376d5e9
Message:

lib/aubio/midiconv.py: prepare for python3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/aubio/midiconv.py

    r376d5e9 re76842e  
    11# -*- coding: utf-8 -*-
     2
     3import sys
     4PY3 = sys.version_info[0] == 3
     5if PY3:
     6    string_types = [str]
     7else:
     8    string_types = [str, unicode]
    29
    310def note2midi(note):
     
    613    _valid_modifiers = {None: 0, u'♮': 0, '#': +1, u'♯': +1, u'\udd2a': +2, 'b': -1, u'♭': -1, u'\ufffd': -2}
    714    _valid_octaves = range(-1, 10)
    8     if type(note) not in (str, unicode):
    9         raise TypeError("a string is required, got %s" % note)
     15    if type(note) not in string_types:
     16        raise TypeError("a string is required, got %s (%s)" % (note, str(type(note)) ))
    1017    if not (1 < len(note) < 5):
    1118        raise ValueError(
Note: See TracChangeset for help on using the changeset viewer.