Are note names supported in Scamp?

I searched in the documentation but could not find out if note names like c4 fs5 bf3 are supported or if there are classes/functions that convert between names and midi notes. I saw note names mentioned in the docs in the performance object only.

It’s not currently implemented, but you’re not the first person to ask about it! I’ll think about adding it to scamp_extensions, or even to scamp itself. Here’s how you might implement it:

pitch_class_displacements = {
    'c': 0,
    'd': 2,
    'e': 4,
    'f': 5,
    'g': 7,
    'a': 9,
    'b': 11
}

accidental_displacements = {
    '#': 1,
    's': 1,
    'f': -1,
    'b': -1,
    'x': 2,
    'bb': -2
}

def note_name_to_number(note_name: str):
    note_name = note_name.lower().replace(' ', '')
    pitch_class_name = note_name[0]
    octave = note_name[-1]
    accidental = note_name[1:-1]
    return (int(octave) + 1) * 12 + \
           pitch_class_displacements[pitch_class_name] + \
           (accidental_displacements[accidental] if accidental in accidental_displacements else 0)


print(note_name_to_number("c4"))
print(note_name_to_number("fs5"))
print(note_name_to_number("bf3"))

Thanks. I might try and implement it myself as a Python exercise.