From 8b5cb2c16aaa3a41d680b950d38d74f1e45b2636 Mon Sep 17 00:00:00 2001 From: gahusb Date: Sun, 10 May 2026 23:53:35 +0900 Subject: [PATCH] =?UTF-8?q?feat(music-lab):=20=EB=9E=9C=EB=8D=A4=20?= =?UTF-8?q?=ED=92=80=EC=97=90=207=EA=B0=9C=20=EC=9E=A5=EB=A5=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20+=20GET=20/api/music/genres?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- music-lab/app/main.py | 7 ++++ music-lab/app/random_pools.py | 68 +++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/music-lab/app/main.py b/music-lab/app/main.py index 6d4dcd1..c38a521 100644 --- a/music-lab/app/main.py +++ b/music-lab/app/main.py @@ -906,6 +906,13 @@ def list_batches(status: str = "all"): return {"batches": _db_module.list_batch_jobs(active_only=(status == "active"))} +@app.get("/api/music/genres") +def list_supported_genres(): + """배치 생성에서 사용 가능한 장르 목록 — random_pools의 키.""" + from .random_pools import list_genres + return {"genres": list_genres()} + + # ── 수익화 추적 API ─────────────────────────────────────────────────────────── @app.get("/api/music/revenue/dashboard") diff --git a/music-lab/app/random_pools.py b/music-lab/app/random_pools.py index 9ea8236..de0ebeb 100644 --- a/music-lab/app/random_pools.py +++ b/music-lab/app/random_pools.py @@ -38,6 +38,69 @@ POOLS = { "scales": ["major"], "prompt_modifiers": ["radio-ready", "summer vibe", "feel-good"], }, + "synthwave": { + "moods": ["retro", "nostalgic", "futuristic", "dreamy", "moody"], + "instruments_pool": ["synth lead", "synth bass", "drum machine", "arp synth", "pad synth", "vocoder"], + "instruments_count": (3, 4), + "bpm": (90, 120), + "keys": ["A", "D", "F", "G"], + "scales": ["minor", "major"], + "prompt_modifiers": ["80s neon city night", "retro arcade glow", "VHS aesthetic", "cyberpunk skyline"], + }, + "chillhop": { + "moods": ["chill", "groovy", "warm", "nostalgic", "head-nodding"], + "instruments_pool": ["jazz piano", "bass guitar", "drum kit", "saxophone", "vinyl crackle", "rhodes", "muted trumpet"], + "instruments_count": (3, 5), + "bpm": (75, 95), + "keys": ["C", "D", "F", "G", "A"], + "scales": ["major", "minor"], + "prompt_modifiers": ["jazz bar lounge", "chill summer afternoon", "vintage warm tape"], + }, + "jazz": { + "moods": ["smooth", "elegant", "moody", "warm", "sophisticated"], + "instruments_pool": ["piano", "double bass", "jazz drums", "saxophone", "trumpet", "jazz guitar"], + "instruments_count": (3, 5), + "bpm": (75, 130), + "keys": ["C", "D", "F", "G", "A"], + "scales": ["major", "minor"], + "prompt_modifiers": ["smoky jazz club", "fireplace evening", "elegant lounge", "rainy speakeasy"], + }, + "hip-hop": { + "moods": ["confident", "groovy", "head-nodding", "dark", "energetic"], + "instruments_pool": ["808 bass", "trap drums", "synth lead", "vocal samples", "piano chords", "vinyl scratch", "boom bap drums"], + "instruments_count": (3, 4), + "bpm": (85, 100), + "keys": ["C", "D", "F", "G"], + "scales": ["minor"], + "prompt_modifiers": ["urban night", "boom bap classic", "street vibe", "underground"], + }, + "electronic": { + "moods": ["energetic", "uplifting", "hypnotic", "futuristic", "driving"], + "instruments_pool": ["synth lead", "synth bass", "drum machine", "fx pad", "arp", "kick", "snare claps"], + "instruments_count": (3, 5), + "bpm": (110, 140), + "keys": ["A", "C", "D", "F", "G"], + "scales": ["minor", "major"], + "prompt_modifiers": ["club energy", "festival vibe", "neon dance floor"], + }, + "classical": { + "moods": ["serene", "elegant", "melancholic", "majestic", "tender"], + "instruments_pool": ["piano", "strings", "cello", "violin", "harp", "flute", "oboe"], + "instruments_count": (1, 3), + "bpm": (60, 100), + "keys": ["C", "D", "E", "F", "G", "A"], + "scales": ["major", "minor"], + "prompt_modifiers": ["orchestra hall", "candlelight evening", "morning piano study", "stately concert"], + }, + "funk": { + "moods": ["groovy", "funky", "energetic", "uplifting", "playful"], + "instruments_pool": ["bass guitar", "wah guitar", "horn section", "drums", "clavinet", "rhodes"], + "instruments_count": (3, 5), + "bpm": (95, 120), + "keys": ["C", "D", "E", "F", "G"], + "scales": ["major", "minor"], + "prompt_modifiers": ["70s groove", "disco funk", "soul party"], + }, "default": { "moods": ["chill", "relaxing", "uplifting", "mellow"], "instruments_pool": ["piano", "synth", "drums", "guitar", "bass", "strings"], @@ -50,6 +113,11 @@ POOLS = { } +def list_genres() -> list[str]: + """프론트에 노출할 장르 목록 — POOLS의 키 (default 제외).""" + return [g for g in POOLS.keys() if g != "default"] + + def randomize(genre: str, rng=None) -> dict: """장르 → 랜덤 음악 파라미터 1세트.