def note_to_midi(note, round_midi=True):
if not isinstance(note, six.string_types):<EOL><INDENT>return np.array([note_to_midi(n, round_midi=round_midi) for n in note])<EOL><DEDENT>pitch_map = {'<STR_LIT:C>': <NUM_LIT:0>, '<STR_LIT:D>': <NUM_LIT:2>, '<STR_LIT:E>': <NUM_LIT:4>, '<STR_LIT:F>': <NUM_LIT:5>, '<STR_LIT>': <NUM_LIT:7>, '<STR_LIT:A>': <NUM_LIT:9>, '<STR_LIT:B>': <NUM_LIT:11>}<EOL>acc_map = {'<STR_LIT:#>': <NUM_LIT:1>, '<STR_LIT>': <NUM_LIT:0>, '<STR_LIT:b>': -<NUM_LIT:1>, '<STR_LIT:!>': -<NUM_LIT:1>}<EOL>match = re.match(r'<STR_LIT>'<EOL>r'<STR_LIT>'<EOL>r'<STR_LIT>'<EOL>r'<STR_LIT>',<EOL>note)<EOL>if not match:<EOL><INDENT>raise ParameterError('<STR_LIT>'.format(note))<EOL><DEDENT>pitch = match.group('<STR_LIT>').upper()<EOL>offset = np.sum([acc_map[o] for o in match.group('<STR_LIT>')])<EOL>octave = match.group('<STR_LIT>')<EOL>cents = match.group('<STR_LIT>')<EOL>if not octave:<EOL><INDENT>octave = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>octave = int(octave)<EOL><DEDENT>if not cents:<EOL><INDENT>cents = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>cents = int(cents) * <NUM_LIT><EOL><DEDENT>note_value = <NUM_LIT:12> * (octave + <NUM_LIT:1>) + pitch_map[pitch] + offset + cents<EOL>if round_midi:<EOL><INDENT>note_value = int(np.round(note_value))<EOL><DEDENT>return note_value<EOL>
Convert one or more spelled notes to MIDI number(s).

    Notes may be spelled out with optional accidentals or octave numbers.

    The leading note name is case-insensitive.

    Sharps are indicated with ``#``, flats may be indicated with ``!`` or ``b``.

    Parameters
    ----------
    note : str or iterable of str
        One or more note names.

    round_midi : bool
        - If `True`, allow for fractional midi notes
        - Otherwise, round cent deviations to the nearest note

    Returns
    -------
    midi : float or np.array
        Midi note numbers corresponding to inputs.

    Raises
    ------
    ParameterError
        If the input is not in valid note format

    See Also
    --------
    midi_to_note
    note_to_hz

    Examples
    --------
    >>> librosa.note_to_midi('C')
    12
    >>> librosa.note_to_midi('C#3')
    49
    >>> librosa.note_to_midi('f4')
    65
    >>> librosa.note_to_midi('Bb-1')
    10
    >>> librosa.note_to_midi('A!8')
    116
    >>> # Lists of notes also work
    >>> librosa.note_to_midi(['C', 'E', 'G'])
    array([12, 16, 19])