Spaces:
Running on Zero
Running on Zero
| """Creative presets for ACE-Step Inspire.""" | |
| from __future__ import annotations | |
| # Shared instrument / texture palette, grouped for the Mix Bay browser. | |
| INSTRUMENT_GROUPS: list[tuple[str, list[str]]] = [ | |
| ("Drums & percussion", [ | |
| "punchy drums", | |
| "live drums", | |
| "soft drums", | |
| "brushed drums", | |
| "shuffle drums", | |
| "four-on-the-floor kick", | |
| "double bass drums", | |
| "trap snares", | |
| "crisp hi-hats", | |
| "rimshot drums", | |
| "kick-snare groove", | |
| "hybrid percussion", | |
| "timpani", | |
| "orchestral percussion", | |
| "hand percussion", | |
| "congas", | |
| "bongos", | |
| "syncopated percussion", | |
| "light percussion", | |
| "taiko drums", | |
| "tight drums", | |
| "modern drums", | |
| ]), | |
| ("Bass", [ | |
| "bass guitar", | |
| "808 bass", | |
| "smooth bass", | |
| "upright bass", | |
| "walking bass", | |
| "sidechain bass", | |
| "deep bass", | |
| "thunderous bass", | |
| "synth bass", | |
| "mellow bass", | |
| "bass groove", | |
| "double bass (orchestral)", | |
| ]), | |
| ("Guitars & plucked", [ | |
| "electric guitar", | |
| "acoustic guitar", | |
| "distorted electric guitars", | |
| "distorted guitars", | |
| "clean guitar arpeggios", | |
| "fingerpicking", | |
| "nylon guitar", | |
| "offbeat guitar skank", | |
| "twangy electric guitar", | |
| "blues guitar", | |
| "guitar licks", | |
| "guitar hooks", | |
| "shred solos", | |
| "pedal steel", | |
| "mandolin", | |
| "banjo", | |
| "ukulele", | |
| "plucked strings", | |
| "fiddle", | |
| "sitar", | |
| "kora", | |
| ]), | |
| ("Keys & synths", [ | |
| "piano", | |
| "soft piano", | |
| "grand piano", | |
| "dusty piano samples", | |
| "sampled piano", | |
| "upright piano", | |
| "warm electric piano", | |
| "rhodes", | |
| "gospel organ", | |
| "organ", | |
| "organ bubble", | |
| "pipe organ", | |
| "harpsichord", | |
| "bright synths", | |
| "analog synths", | |
| "polished synths", | |
| "tropical synths", | |
| "filtered pads", | |
| "atmospheric pads", | |
| "arpeggiators", | |
| "jazzy chords", | |
| "piano motif", | |
| ]), | |
| ("Strings & orchestra", [ | |
| "string orchestra", | |
| "string quartet", | |
| "violin section", | |
| "solo violin", | |
| "viola", | |
| "cello", | |
| "harp", | |
| "chamber ensemble", | |
| "orchestral hits", | |
| ]), | |
| ("Brass & winds", [ | |
| "brass section", | |
| "french horns", | |
| "trumpets", | |
| "trombones", | |
| "woodwind section", | |
| "flute", | |
| "oboe", | |
| "clarinet", | |
| "bassoon", | |
| "horn section", | |
| "brass stabs", | |
| "saxophone", | |
| "trumpet", | |
| "harmonica", | |
| "world flutes", | |
| ]), | |
| ("Voice & textures", [ | |
| "choir", | |
| "wordless choir", | |
| "operatic solo", | |
| "vocal chops", | |
| "vocal stacks", | |
| "choir textures", | |
| "risers", | |
| "bass drops", | |
| "echo delays", | |
| "vinyl crackle", | |
| "tape hiss", | |
| "field recordings", | |
| ]), | |
| ] | |
| INSTRUMENTS_ALL: list[str] = [] | |
| for _group_name, _items in INSTRUMENT_GROUPS: | |
| for _inst in _items: | |
| if _inst not in INSTRUMENTS_ALL: | |
| INSTRUMENTS_ALL.append(_inst) | |
| GENRES: dict[str, dict] = { | |
| "Pop": { | |
| "styles": [ | |
| "mainstream pop", | |
| "synth-pop", | |
| "dance-pop", | |
| "indie pop", | |
| "electropop", | |
| "power pop", | |
| "bubblegum pop", | |
| "art pop", | |
| ], | |
| "bpm": (100, 128), | |
| "default_bpm": 118, | |
| "keys": [ | |
| "C major", | |
| "G major", | |
| "D major", | |
| "A major", | |
| "F major", | |
| "A minor", | |
| "E minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "bright synths", | |
| "punchy drums", | |
| "bass guitar", | |
| "electric guitar", | |
| "piano", | |
| "vocal chops", | |
| "atmospheric pads", | |
| "guitar hooks", | |
| ], | |
| "moods": [ | |
| "uplifting", | |
| "romantic", | |
| "confident", | |
| "nostalgic", | |
| "playful", | |
| "bittersweet", | |
| ], | |
| "vocal": [ | |
| "female lead", | |
| "male lead", | |
| "duet", | |
| "stacked harmonies", | |
| ], | |
| }, | |
| "Hip-Hop / Rap": { | |
| "styles": [ | |
| "boom bap", | |
| "trap", | |
| "lo-fi hip-hop", | |
| "conscious rap", | |
| "cloud rap", | |
| "drill", | |
| "old-school hip-hop", | |
| "melodic rap", | |
| ], | |
| "bpm": (70, 160), | |
| "default_bpm": 92, | |
| "keys": [ | |
| "C minor", | |
| "A minor", | |
| "D minor", | |
| "F minor", | |
| "G minor", | |
| "Bb minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "808 bass", | |
| "crisp hi-hats", | |
| "sampled piano", | |
| "vinyl crackle", | |
| "trap snares", | |
| "atmospheric pads", | |
| "vocal chops", | |
| "synth bass", | |
| ], | |
| "moods": [ | |
| "confident", | |
| "introspective", | |
| "aggressive", | |
| "chill", | |
| "storytelling", | |
| "dark", | |
| ], | |
| "vocal": [ | |
| "male rapper", | |
| "female rapper", | |
| "sung chorus", | |
| "spoken word", | |
| ], | |
| }, | |
| "Rock": { | |
| "styles": [ | |
| "classic rock", | |
| "indie rock", | |
| "alternative rock", | |
| "punk rock", | |
| "hard rock", | |
| "soft rock", | |
| "garage rock", | |
| "post-rock", | |
| ], | |
| "bpm": (90, 160), | |
| "default_bpm": 128, | |
| "keys": [ | |
| "E minor", | |
| "A minor", | |
| "D major", | |
| "G major", | |
| "C major", | |
| "B minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "distorted electric guitars", | |
| "live drums", | |
| "bass guitar", | |
| "organ", | |
| "clean guitar arpeggios", | |
| "piano", | |
| "electric guitar", | |
| "shred solos", | |
| ], | |
| "moods": [ | |
| "rebellious", | |
| "anthemic", | |
| "melancholic", | |
| "energetic", | |
| "raw", | |
| "hopeful", | |
| ], | |
| "vocal": [ | |
| "male grit vocals", | |
| "female rock vocals", | |
| "gang vocals", | |
| "shouted chorus", | |
| ], | |
| }, | |
| "Electronic / Dance": { | |
| "styles": [ | |
| "house", | |
| "techno", | |
| "trance", | |
| "drum and bass", | |
| "synthwave", | |
| "future bass", | |
| "deep house", | |
| "ambient techno", | |
| ], | |
| "bpm": (110, 174), | |
| "default_bpm": 124, | |
| "keys": [ | |
| "A minor", | |
| "F minor", | |
| "C minor", | |
| "D minor", | |
| "G minor", | |
| "E minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "four-on-the-floor kick", | |
| "analog synths", | |
| "arpeggiators", | |
| "sidechain bass", | |
| "filtered pads", | |
| "risers", | |
| "bass drops", | |
| "vocal chops", | |
| ], | |
| "moods": [ | |
| "euphoric", | |
| "hypnotic", | |
| "dark", | |
| "dreamy", | |
| "peak-time", | |
| "late-night", | |
| ], | |
| "vocal": [ | |
| "female vocal hooks", | |
| "male vocal chops", | |
| "instrumental", | |
| "spoken phrases", | |
| ], | |
| }, | |
| "R&B / Soul": { | |
| "styles": [ | |
| "contemporary R&B", | |
| "neo-soul", | |
| "classic soul", | |
| "quiet storm", | |
| "funk-soul", | |
| "alt-R&B", | |
| ], | |
| "bpm": (65, 110), | |
| "default_bpm": 84, | |
| "keys": [ | |
| "Db major", | |
| "Ab major", | |
| "F minor", | |
| "Bb minor", | |
| "C minor", | |
| "Eb major", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "warm electric piano", | |
| "smooth bass", | |
| "brushed drums", | |
| "horn section", | |
| "gospel organ", | |
| "guitar licks", | |
| "rhodes", | |
| "vocal stacks", | |
| ], | |
| "moods": [ | |
| "sensual", | |
| "vulnerable", | |
| "smooth", | |
| "late-night", | |
| "romantic", | |
| "empowered", | |
| ], | |
| "vocal": [ | |
| "silky female vocals", | |
| "silky male vocals", | |
| "falsetto lead", | |
| "harmony stacks", | |
| ], | |
| }, | |
| "Jazz": { | |
| "styles": [ | |
| "jazz trio", | |
| "smooth jazz", | |
| "bebop", | |
| "nu-jazz", | |
| "jazz-funk", | |
| "vocal jazz", | |
| "cool jazz", | |
| ], | |
| "bpm": (70, 180), | |
| "default_bpm": 112, | |
| "keys": [ | |
| "Bb major", | |
| "F major", | |
| "Eb major", | |
| "C minor", | |
| "D minor", | |
| "A minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "upright bass", | |
| "piano", | |
| "brushed drums", | |
| "saxophone", | |
| "trumpet", | |
| "rhodes", | |
| "jazzy chords", | |
| "walking bass", | |
| ], | |
| "moods": [ | |
| "sophisticated", | |
| "smoky", | |
| "playful", | |
| "intimate", | |
| "swinging", | |
| "nocturnal", | |
| ], | |
| "vocal": [ | |
| "crooner", | |
| "scat vocals", | |
| "instrumental", | |
| "lounge singer", | |
| ], | |
| }, | |
| "Folk / Acoustic": { | |
| "styles": [ | |
| "contemporary folk", | |
| "indie folk", | |
| "singer-songwriter", | |
| "americana", | |
| "campfire folk", | |
| "celtic folk", | |
| ], | |
| "bpm": (70, 120), | |
| "default_bpm": 96, | |
| "keys": [ | |
| "G major", | |
| "D major", | |
| "C major", | |
| "A major", | |
| "E minor", | |
| "A minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "acoustic guitar", | |
| "fingerpicking", | |
| "harmonica", | |
| "light percussion", | |
| "mandolin", | |
| "soft piano", | |
| "banjo", | |
| "ukulele", | |
| ], | |
| "moods": [ | |
| "wistful", | |
| "warm", | |
| "storytelling", | |
| "pastoral", | |
| "intimate", | |
| "hopeful", | |
| ], | |
| "vocal": [ | |
| "gentle male vocals", | |
| "gentle female vocals", | |
| "harmony duet", | |
| "whispered verses", | |
| ], | |
| }, | |
| "Metal": { | |
| "styles": [ | |
| "heavy metal", | |
| "metalcore", | |
| "power metal", | |
| "doom metal", | |
| "progressive metal", | |
| "thrash", | |
| ], | |
| "bpm": (90, 200), | |
| "default_bpm": 140, | |
| "keys": [ | |
| "E minor", | |
| "D minor", | |
| "B minor", | |
| "F# minor", | |
| "A minor", | |
| "C minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "distorted guitars", | |
| "double bass drums", | |
| "thunderous bass", | |
| "shred solos", | |
| "orchestral hits", | |
| "string orchestra", | |
| "choir", | |
| "live drums", | |
| ], | |
| "moods": [ | |
| "aggressive", | |
| "epic", | |
| "dark", | |
| "triumphant", | |
| "brooding", | |
| "chaotic", | |
| ], | |
| "vocal": [ | |
| "harsh vocals", | |
| "clean epic vocals", | |
| "growls + cleans", | |
| "choir backing", | |
| ], | |
| }, | |
| "Latin": { | |
| "styles": [ | |
| "reggaeton", | |
| "latin pop", | |
| "salsa", | |
| "bachata", | |
| "cumbia", | |
| "latin trap", | |
| "bossa nova", | |
| ], | |
| "bpm": (85, 130), | |
| "default_bpm": 96, | |
| "keys": [ | |
| "A minor", | |
| "D minor", | |
| "G major", | |
| "C major", | |
| "E minor", | |
| "F major", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "syncopated percussion", | |
| "nylon guitar", | |
| "tropical synths", | |
| "congas", | |
| "bass groove", | |
| "horn section", | |
| "bongos", | |
| "brass stabs", | |
| ], | |
| "moods": [ | |
| "romantic", | |
| "festive", | |
| "sensual", | |
| "sunny", | |
| "dancefloor", | |
| "nostalgic", | |
| ], | |
| "vocal": [ | |
| "Spanish male vocals", | |
| "Spanish female vocals", | |
| "bilingual vocals", | |
| "reggaeton flow", | |
| ], | |
| }, | |
| "Country": { | |
| "styles": [ | |
| "modern country", | |
| "country pop", | |
| "outlaw country", | |
| "bluegrass", | |
| "country ballad", | |
| "americana", | |
| ], | |
| "bpm": (70, 140), | |
| "default_bpm": 108, | |
| "keys": [ | |
| "G major", | |
| "D major", | |
| "A major", | |
| "C major", | |
| "E major", | |
| "A minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "acoustic guitar", | |
| "pedal steel", | |
| "fiddle", | |
| "banjo", | |
| "twangy electric guitar", | |
| "kick-snare groove", | |
| "harmonica", | |
| "piano", | |
| ], | |
| "moods": [ | |
| "heartfelt", | |
| "road-trip", | |
| "heartbroken", | |
| "celebratory", | |
| "homey", | |
| "bittersweet", | |
| ], | |
| "vocal": [ | |
| "male country vocals", | |
| "female country vocals", | |
| "harmony chorus", | |
| "storyteller", | |
| ], | |
| }, | |
| "Lo-Fi / Chill": { | |
| "styles": [ | |
| "lo-fi hip-hop", | |
| "chillhop", | |
| "study beats", | |
| "downtempo", | |
| "chillwave", | |
| "bedroom pop", | |
| ], | |
| "bpm": (70, 95), | |
| "default_bpm": 82, | |
| "keys": [ | |
| "C major", | |
| "A minor", | |
| "F major", | |
| "D minor", | |
| "G major", | |
| "E minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "dusty piano samples", | |
| "soft drums", | |
| "vinyl crackle", | |
| "mellow bass", | |
| "tape hiss", | |
| "jazzy chords", | |
| "rhodes", | |
| "field recordings", | |
| ], | |
| "moods": [ | |
| "relaxed", | |
| "cozy", | |
| "melancholy", | |
| "dreamy", | |
| "focus", | |
| "rainy-day", | |
| ], | |
| "vocal": [ | |
| "soft mumbled vocals", | |
| "instrumental", | |
| "distant vocal sample", | |
| "whispered hooks", | |
| ], | |
| }, | |
| "Cinematic / Soundtrack": { | |
| "styles": [ | |
| "epic orchestral", | |
| "hybrid trailer", | |
| "intimate score", | |
| "adventure theme", | |
| "dark ambient score", | |
| "heroic fanfare", | |
| ], | |
| "bpm": (60, 140), | |
| "default_bpm": 100, | |
| "keys": [ | |
| "D minor", | |
| "C minor", | |
| "Bb major", | |
| "F major", | |
| "A minor", | |
| "E minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "string orchestra", | |
| "brass section", | |
| "timpani", | |
| "choir", | |
| "piano motif", | |
| "hybrid percussion", | |
| "french horns", | |
| "orchestral hits", | |
| ], | |
| "moods": [ | |
| "epic", | |
| "tender", | |
| "suspenseful", | |
| "triumphant", | |
| "mysterious", | |
| "emotional", | |
| ], | |
| "vocal": [ | |
| "instrumental", | |
| "wordless choir", | |
| "operatic vocals", | |
| "narrative spoken word", | |
| ], | |
| }, | |
| "Classical": { | |
| "styles": [ | |
| "baroque", | |
| "classical period", | |
| "romantic orchestral", | |
| "chamber music", | |
| "solo piano", | |
| "concerto", | |
| "contemporary classical", | |
| "minimalist classical", | |
| ], | |
| "bpm": (40, 160), | |
| "default_bpm": 88, | |
| "keys": [ | |
| "C major", | |
| "G major", | |
| "D major", | |
| "A minor", | |
| "D minor", | |
| "E minor", | |
| "Bb major", | |
| "F minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "string orchestra", | |
| "string quartet", | |
| "grand piano", | |
| "woodwind section", | |
| "brass section", | |
| "harp", | |
| "solo violin", | |
| "cello", | |
| "flute", | |
| "oboe", | |
| "clarinet", | |
| "french horns", | |
| "timpani", | |
| "chamber ensemble", | |
| "pipe organ", | |
| ], | |
| "moods": [ | |
| "elegant", | |
| "dramatic", | |
| "serene", | |
| "passionate", | |
| "solemn", | |
| "playful", | |
| ], | |
| "vocal": [ | |
| "instrumental", | |
| "operatic soprano", | |
| "operatic tenor", | |
| "choir", | |
| ], | |
| }, | |
| "K-Pop": { | |
| "styles": [ | |
| "bright K-pop", | |
| "dark K-pop", | |
| "EDM K-pop", | |
| "ballad K-pop", | |
| "hip-hop K-pop", | |
| "city-pop flavored K-pop", | |
| ], | |
| "bpm": (95, 140), | |
| "default_bpm": 122, | |
| "keys": [ | |
| "C major", | |
| "G major", | |
| "A minor", | |
| "F major", | |
| "D major", | |
| "E minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "polished synths", | |
| "tight drums", | |
| "bass drops", | |
| "vocal stacks", | |
| "horn section", | |
| "guitar hooks", | |
| "bright synths", | |
| "arpeggiators", | |
| ], | |
| "moods": [ | |
| "catchy", | |
| "confident", | |
| "emotional", | |
| "playful", | |
| "dramatic", | |
| "glossy", | |
| ], | |
| "vocal": [ | |
| "group vocals", | |
| "female idol lead", | |
| "male idol lead", | |
| "rap bridge", | |
| ], | |
| }, | |
| "Reggae / Dancehall": { | |
| "styles": [ | |
| "roots reggae", | |
| "dancehall", | |
| "dub", | |
| "ska", | |
| "lovers rock", | |
| "modern reggae fusion", | |
| ], | |
| "bpm": (70, 110), | |
| "default_bpm": 78, | |
| "keys": [ | |
| "A minor", | |
| "G major", | |
| "C major", | |
| "D major", | |
| "E minor", | |
| "F major", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "offbeat guitar skank", | |
| "deep bass", | |
| "rimshot drums", | |
| "organ bubble", | |
| "horn section", | |
| "echo delays", | |
| "congas", | |
| "electric guitar", | |
| ], | |
| "moods": [ | |
| "sunny", | |
| "relaxed", | |
| "spiritual", | |
| "groovy", | |
| "romantic", | |
| "protest", | |
| ], | |
| "vocal": [ | |
| "reggae toasting", | |
| "smooth singers", | |
| "dancehall toast", | |
| "harmony chorus", | |
| ], | |
| }, | |
| "Blues": { | |
| "styles": [ | |
| "electric blues", | |
| "delta blues", | |
| "blues rock", | |
| "soul blues", | |
| "chicago blues", | |
| ], | |
| "bpm": (60, 120), | |
| "default_bpm": 88, | |
| "keys": [ | |
| "E major", | |
| "A major", | |
| "G major", | |
| "C major", | |
| "A minor", | |
| "E minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "blues guitar", | |
| "harmonica", | |
| "upright piano", | |
| "shuffle drums", | |
| "walking bass", | |
| "organ", | |
| "horn section", | |
| "electric guitar", | |
| ], | |
| "moods": [ | |
| "soulful", | |
| "heartbroken", | |
| "gritty", | |
| "late-night", | |
| "resilient", | |
| ], | |
| "vocal": [ | |
| "raspy male vocals", | |
| "powerful female blues", | |
| "call and response", | |
| "instrumental", | |
| ], | |
| }, | |
| "World / Fusion": { | |
| "styles": [ | |
| "afrobeats", | |
| "afro-fusion", | |
| "middle-eastern fusion", | |
| "indian classical fusion", | |
| "balkan beat", | |
| "global pop", | |
| ], | |
| "bpm": (90, 130), | |
| "default_bpm": 110, | |
| "keys": [ | |
| "D minor", | |
| "A minor", | |
| "G minor", | |
| "C major", | |
| "F major", | |
| "E minor", | |
| ], | |
| "time_signature": "4", | |
| "instruments": [ | |
| "hand percussion", | |
| "world flutes", | |
| "plucked strings", | |
| "modern drums", | |
| "synth bass", | |
| "choir textures", | |
| "sitar", | |
| "kora", | |
| "taiko drums", | |
| "nylon guitar", | |
| ], | |
| "moods": [ | |
| "celebratory", | |
| "spiritual", | |
| "adventurous", | |
| "warm", | |
| "hypnotic", | |
| "joyful", | |
| ], | |
| "vocal": [ | |
| "multilingual vocals", | |
| "chant-like vocals", | |
| "smooth lead", | |
| "call and response", | |
| ], | |
| }, | |
| } | |
| MOOD_EXTRA: list[str] = [ | |
| "uplifting", | |
| "melancholic", | |
| "euphoric", | |
| "intimate", | |
| "dark", | |
| "playful", | |
| "cinematic", | |
| "nostalgic", | |
| "aggressive", | |
| "dreamy", | |
| "romantic", | |
| "mysterious", | |
| ] | |
| USE_CASES: list[str] = [ | |
| "(none)", | |
| "workout / gym", | |
| "study / focus", | |
| "road trip", | |
| "late-night drive", | |
| "party / club", | |
| "wedding first dance", | |
| "game trailer", | |
| "YouTube intro", | |
| "meditation / calm", | |
| "rainy afternoon", | |
| "sunrise / morning", | |
| ] | |
| # Default BPM when a use case is selected ("(none)" leaves tempo alone). | |
| USE_CASE_BPM: dict[str, int | None] = { | |
| "(none)": None, | |
| "workout / gym": 132, | |
| "study / focus": 78, | |
| "road trip": 112, | |
| "late-night drive": 92, | |
| "party / club": 126, | |
| "wedding first dance": 70, | |
| "game trailer": 108, | |
| "YouTube intro": 118, | |
| "meditation / calm": 62, | |
| "rainy afternoon": 76, | |
| "sunrise / morning": 100, | |
| } | |
| def suggest_style_bpm(genre: str, style: str) -> int: | |
| """Pick a tempo that fits the style, clamped to the genre's soft BPM range.""" | |
| g = GENRES.get(genre, GENRES[DEFAULT_GENRE]) | |
| lo, hi = g["bpm"] | |
| base = int(g["default_bpm"]) | |
| s = (style or "").lower() | |
| slow_keys = ( | |
| "ballad", "doom", "ambient", "downtempo", "study", "intimate", "quiet", | |
| "lovers", "chill", "lo-fi", "lofi", "roots", "delta", "solo piano", | |
| "chamber", "baroque", "minimalist", "meditation", "dub", | |
| ) | |
| fast_keys = ( | |
| "dance", "club", "trance", "techno", "house", "drill", "trap", "thrash", | |
| "metalcore", "drum and bass", "dnb", "peak", "party", "edm", "power metal", | |
| "punk", "reggaeton", "salsa", "afrobeats", "future bass", "workout", | |
| ) | |
| mid_fast = ("pop", "rock", "k-pop", "synthwave", "cumbia", "ska", "bebop") | |
| bpm = base | |
| if any(k in s for k in slow_keys): | |
| bpm = base - 22 | |
| elif any(k in s for k in fast_keys): | |
| bpm = base + 18 | |
| elif any(k in s for k in mid_fast): | |
| bpm = base + 6 | |
| return max(lo, min(hi, int(bpm))) | |
| def suggest_use_case_bpm(use_case: str) -> int | None: | |
| """Return a use-case default BPM, or None to leave the current tempo unchanged.""" | |
| if not use_case: | |
| return None | |
| return USE_CASE_BPM.get(use_case, None) | |
| STRUCTURES: dict[str, str] = { | |
| "Verse–Chorus–Verse–Chorus–Bridge–Chorus": "vcvcbc", | |
| "Verse–Chorus–Verse–Chorus": "vcvc", | |
| "Intro–Verse–Chorus–Verse–Chorus–Outro": "ivcvco", | |
| "Verse–Pre–Chorus–Chorus (x2) + Bridge": "vppcpb", | |
| "Instrumental (no lyrics)": "instrumental", | |
| } | |
| KEYS_ALL: list[str] = [ | |
| "C major", | |
| "C minor", | |
| "C# major", | |
| "C# minor", | |
| "D major", | |
| "D minor", | |
| "Eb major", | |
| "Eb minor", | |
| "E major", | |
| "E minor", | |
| "F major", | |
| "F minor", | |
| "F# major", | |
| "F# minor", | |
| "G major", | |
| "G minor", | |
| "Ab major", | |
| "Ab minor", | |
| "A major", | |
| "A minor", | |
| "Bb major", | |
| "Bb minor", | |
| "B major", | |
| "B minor", | |
| ] | |
| TIME_SIGNATURES: list[str] = ["2", "3", "4", "6"] | |
| VOCAL_LANGUAGES: dict[str, str] = { | |
| "English": "en", | |
| "German": "de", | |
| "Spanish": "es", | |
| "French": "fr", | |
| "Japanese": "ja", | |
| "Korean": "ko", | |
| "Chinese": "zh", | |
| "Portuguese": "pt", | |
| "Italian": "it", | |
| "Russian": "ru", | |
| } | |
| # Only Diffusers-format AceStepPipeline checkpoints work in this Space. | |
| # Native transformers checkpoints (acestep-v15-sft / base / Ace-Step1.5) need the full ACE-Step package. | |
| MODELS: dict[str, dict] = { | |
| "Turbo (non-XL) — default": { | |
| "repo_id": "Runware/acestep-v15-turbo-diffusers", | |
| "steps": 8, | |
| "guidance": 1.0, | |
| "shift": 3.0, | |
| "turbo": True, | |
| "gpu_seconds": 180, | |
| }, | |
| "XL Turbo (faster / larger)": { | |
| "repo_id": "ACE-Step/acestep-v15-xl-turbo-diffusers", | |
| "steps": 8, | |
| "guidance": 1.0, | |
| "shift": 3.0, | |
| "turbo": True, | |
| "gpu_seconds": 200, | |
| }, | |
| "XL SFT (higher quality, slower)": { | |
| "repo_id": "ACE-Step/acestep-v15-xl-sft-diffusers", | |
| "steps": 28, | |
| "guidance": 7.0, | |
| "shift": 3.0, | |
| "turbo": False, | |
| "gpu_seconds": 360, | |
| }, | |
| "XL Base (more diversity, slower)": { | |
| "repo_id": "ACE-Step/acestep-v15-xl-base-diffusers", | |
| "steps": 32, | |
| "guidance": 7.0, | |
| "shift": 3.0, | |
| "turbo": False, | |
| "gpu_seconds": 360, | |
| }, | |
| } | |
| DEFAULT_MODEL = "Turbo (non-XL) — default" | |
| DEFAULT_GENRE = "Pop" | |
| DEFAULT_DURATION = 180 | |
| # Hidden Gradio dropdowns must accept any pad-selected value (genre changes async). | |
| ALL_STYLES: list[str] = [] | |
| ALL_VOCALS: list[str] = [] | |
| for _g in GENRES.values(): | |
| for _s in _g.get("styles", []): | |
| if _s not in ALL_STYLES: | |
| ALL_STYLES.append(_s) | |
| for _v in _g.get("vocal", []): | |
| if _v not in ALL_VOCALS: | |
| ALL_VOCALS.append(_v) | |