Changeset 3aad0b1 for python/lib/aubio


Ignore:
Timestamp:
Dec 3, 2016, 4:03:47 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, sampler, yinfft+
Children:
c0c3f33
Parents:
d554321
Message:

python/lib/aubio/midiconv.py: improve unicode handling, skip UnicodeEncodeError? on python 2.x

File:
1 edited

Legend:

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

    rd554321 r3aad0b1  
    1616    " convert note name to midi note number, e.g. [C-1, G9] -> [0, 127] "
    1717    _valid_notenames = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
    18     _valid_modifiers = {None: 0, u'♮': 0, '#': +1, u'♯': +1, u'\udd2a': +2,
    19                         u'\U0001D12A': +2,
    20                         'b': -1, u'♭': -1, u'\ufffd': -2,
    21                         u'\U0001D12B': -2,
    22                         }
     18    _valid_modifiers = {
     19            u'𝄫': -2,                        # double flat
     20            u'♭': -1, 'b': -1, '\u266d': -1, # simple flat
     21            u'♮': 0, '\u266e': 0, None: 0,   # natural
     22            '#': +1, u'♯': +1, '\u266f': +1, # sharp
     23            u'𝄪': +2,                        # double sharp
     24            }
    2325    _valid_octaves = range(-1, 10)
    2426    if not isinstance(note, str_instances):
Note: See TracChangeset for help on using the changeset viewer.