@@ -0,0 +1,85 @@
|
||||
from __future__ import annotations
|
||||
|
||||
DEFAULT_STYLE = "Medium Swing"
|
||||
|
||||
BUILT_IN_STYLES = (
|
||||
# Jazz
|
||||
"Afro 12/8",
|
||||
"Ballad Double Time Feel",
|
||||
"Ballad Even",
|
||||
"Ballad Melodic",
|
||||
"Ballad Swing",
|
||||
"Blue Note",
|
||||
"Bossa Nova",
|
||||
"Doo Doo Cats",
|
||||
"Double Time Swing",
|
||||
"Even 8ths",
|
||||
"Even 8ths Open",
|
||||
"Even 16ths",
|
||||
"Guitar Trio",
|
||||
"Gypsy Jazz",
|
||||
"Latin",
|
||||
"Latin/Swing",
|
||||
"Long Notes",
|
||||
"Medium Swing",
|
||||
"Medium Up Swing",
|
||||
"Medium Up Swing 2",
|
||||
"New Orleans Swing",
|
||||
"Second Line",
|
||||
"Slow Swing",
|
||||
"Swing Two/Four",
|
||||
"Trad Jazz",
|
||||
"Up Tempo Swing",
|
||||
"Up Tempo Swing 2",
|
||||
# Latin
|
||||
"Argentina: Tango",
|
||||
"Brazil: Bossa Acoustic",
|
||||
"Brazil: Bossa Electric",
|
||||
"Brazil: Samba",
|
||||
"Cuba: Bolero",
|
||||
"Cuba: Cha Cha Cha",
|
||||
"Cuba: Son Montuno 2-3",
|
||||
"Cuba: Son Montuno 3-2",
|
||||
# Pop
|
||||
"Bluegrass",
|
||||
"Country",
|
||||
"Disco",
|
||||
"Funk",
|
||||
"Glam Funk",
|
||||
"House",
|
||||
"Reggae",
|
||||
"RnB",
|
||||
"Rock",
|
||||
"Rock 12/8",
|
||||
"Shuffle",
|
||||
"Slow Rock",
|
||||
"Smooth",
|
||||
"Soul",
|
||||
"Virtual Funk",
|
||||
)
|
||||
|
||||
BUILT_IN_STYLE_SET = frozenset(BUILT_IN_STYLES)
|
||||
|
||||
STYLE_ALIASES = {
|
||||
"Med.": DEFAULT_STYLE,
|
||||
"Med. Swing": DEFAULT_STYLE,
|
||||
"Medium": DEFAULT_STYLE,
|
||||
}
|
||||
|
||||
|
||||
def canonical_style(value: object) -> str:
|
||||
if value is None:
|
||||
return DEFAULT_STYLE
|
||||
|
||||
if not isinstance(value, str):
|
||||
raise ValueError("style must be a string")
|
||||
|
||||
style = value.strip()
|
||||
if not style:
|
||||
return DEFAULT_STYLE
|
||||
|
||||
style = STYLE_ALIASES.get(style, style)
|
||||
if style not in BUILT_IN_STYLE_SET:
|
||||
raise ValueError(f"style {value!r} is not a supported player style")
|
||||
|
||||
return style
|
||||
Reference in New Issue
Block a user