in pedalboard/_pedalboard.py [0:0]
def normalize_python_parameter_name(name: str) -> str:
name = name.lower().strip()
# Special case: some plugins expose parameters with "#"/"♯" or "b"/"♭" in their names.
name = name.replace("#", "_sharp").replace("♯", "_sharp").replace("♭", "_flat")
# Replace all non-alphanumeric characters with underscores
name_chars = [
c if (c.isalpha() or c.isnumeric()) and c.isprintable() and ord(c) < 128 else "_"
for c in name
]
if not name_chars: # Unhandled/Weird param name
return ""
# Remove any double-underscores:
name_chars = [a for a, b in zip(name_chars, name_chars[1:]) if a != b or b != "_"] + [
name_chars[-1]
]
# Remove any leading or trailing underscores:
name = "".join(name_chars).strip("_")
return name