Bobby Collins Claude Opus 4.6 commited on
Commit
eadf3b8
Β·
0 Parent(s):

Initial commit: Suno Prompt Generator app

Browse files

Gradio web app that converts natural language song ideas into structured
Suno AI prompts via OpenRouter API. Features model selection, weirdness
slider for creative control, and outputs for style prompt, song title,
lyrics with tags, Suno UI settings, and cover art image prompt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (6) hide show
  1. .env.example +3 -0
  2. .gitignore +4 -0
  3. Launch Suno Prompter.bat +4 -0
  4. app.py +244 -0
  5. knowledge_base.py +326 -0
  6. requirements.txt +3 -0
.env.example ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # OpenRouter API Key
2
+ # Get yours at https://openrouter.ai/keys
3
+ OPENROUTER_API_KEY=sk-or-v1-your-key-here
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .env
Launch Suno Prompter.bat ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ @echo off
2
+ cd /d "%~dp0"
3
+ venv\Scripts\python.exe app.py
4
+ pause
app.py ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Suno Prompting App
3
+ Converts natural language song ideas into structured Suno AI prompts via OpenRouter API.
4
+ """
5
+
6
+ import json
7
+ import os
8
+
9
+ import gradio as gr
10
+ from dotenv import load_dotenv
11
+ from openai import OpenAI
12
+
13
+ from knowledge_base import build_system_prompt
14
+
15
+ # ─────────────────────────────────────────────
16
+ # CONFIG
17
+ # ─────────────────────────────────────────────
18
+
19
+ load_dotenv()
20
+
21
+ OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY", "")
22
+
23
+ MODELS = {
24
+ "Google Gemini 3 Pro": "google/gemini-3-pro-preview",
25
+ "Google Gemini 3 Flash": "google/gemini-3-flash-preview",
26
+ "Anthropic Claude Sonnet 4.6": "anthropic/claude-sonnet-4.6",
27
+ "OpenAI GPT-5.2": "openai/gpt-5.2",
28
+ "xAI Grok 4": "x-ai/grok-4",
29
+ "Custom": "custom",
30
+ }
31
+
32
+ client = OpenAI(
33
+ base_url="https://openrouter.ai/api/v1",
34
+ api_key=OPENROUTER_API_KEY,
35
+ )
36
+
37
+
38
+ # ─────────────────────────────────────────────
39
+ # CORE LOGIC
40
+ # ─────────────────────────────────────────────
41
+
42
+ def generate_prompt(song_idea: str, model_choice: str, custom_model: str, weirdness: int):
43
+ """Call OpenRouter and parse the structured response."""
44
+ if not song_idea.strip():
45
+ return "", "Please enter a song idea.", "", "", ""
46
+
47
+ # Resolve model ID
48
+ if model_choice == "Custom":
49
+ model_id = custom_model.strip()
50
+ if not model_id:
51
+ return "", "Please enter a custom model ID.", "", "", ""
52
+ else:
53
+ model_id = MODELS.get(model_choice, "google/gemini-3-flash-preview")
54
+
55
+ system_prompt = build_system_prompt(weirdness)
56
+
57
+ try:
58
+ response = client.chat.completions.create(
59
+ model=model_id,
60
+ messages=[
61
+ {"role": "system", "content": system_prompt},
62
+ {"role": "user", "content": song_idea},
63
+ ],
64
+ temperature=0.9,
65
+ max_tokens=4096,
66
+ )
67
+
68
+ raw = response.choices[0].message.content.strip()
69
+
70
+ # Strip markdown code fences if present
71
+ if raw.startswith("```"):
72
+ lines = raw.split("\n")
73
+ # Remove first line (```json or ```) and last line (```)
74
+ if lines[-1].strip() == "```":
75
+ lines = lines[1:-1]
76
+ else:
77
+ lines = lines[1:]
78
+ raw = "\n".join(lines)
79
+
80
+ data = json.loads(raw)
81
+
82
+ song_title = data.get("song_title", "Untitled")
83
+ style_prompt = data.get("style_prompt", "")
84
+ lyrics = data.get("lyrics", "")
85
+
86
+ # Build settings display
87
+ w = data.get("weirdness", "N/A")
88
+ w_reason = data.get("weirdness_reasoning", "")
89
+ si = data.get("style_influence", "N/A")
90
+ si_reason = data.get("style_influence_reasoning", "")
91
+ settings = f"Weirdness: {w}/100\n{w_reason}\n\nStyle Influence: {si}/100\n{si_reason}"
92
+
93
+ cover_art = data.get("cover_art_prompt", "")
94
+
95
+ return song_title, style_prompt, lyrics, settings, cover_art
96
+
97
+ except json.JSONDecodeError:
98
+ # If JSON parsing fails, show raw response
99
+ return (
100
+ "",
101
+ f"[JSON parse error - raw response below]\n\n{raw}",
102
+ "",
103
+ "",
104
+ "",
105
+ )
106
+ except Exception as e:
107
+ return "", f"Error: {e}", "", "", ""
108
+
109
+
110
+ def toggle_custom_visibility(choice):
111
+ """Show/hide custom model text field."""
112
+ return gr.update(visible=(choice == "Custom"))
113
+
114
+
115
+ # ─────────────────────────────────────────────
116
+ # UI
117
+ # ─────────────────────────────────────────────
118
+
119
+ theme = gr.themes.Base(
120
+ primary_hue=gr.themes.colors.orange,
121
+ secondary_hue=gr.themes.colors.neutral,
122
+ neutral_hue=gr.themes.colors.gray,
123
+ font=gr.themes.GoogleFont("Inter"),
124
+ ).set(
125
+ body_background_fill="#1a1a1a",
126
+ body_background_fill_dark="#1a1a1a",
127
+ body_text_color="#e0e0e0",
128
+ body_text_color_dark="#e0e0e0",
129
+ block_background_fill="#2a2a2a",
130
+ block_background_fill_dark="#2a2a2a",
131
+ block_border_color="#444",
132
+ block_border_color_dark="#444",
133
+ block_label_text_color="#ccc",
134
+ block_label_text_color_dark="#ccc",
135
+ block_title_text_color="#fff",
136
+ block_title_text_color_dark="#fff",
137
+ input_background_fill="#333",
138
+ input_background_fill_dark="#333",
139
+ input_border_color="#555",
140
+ input_border_color_dark="#555",
141
+ button_primary_background_fill="#e67e22",
142
+ button_primary_background_fill_dark="#e67e22",
143
+ button_primary_background_fill_hover="#d35400",
144
+ button_primary_background_fill_hover_dark="#d35400",
145
+ button_primary_text_color="#fff",
146
+ button_primary_text_color_dark="#fff",
147
+ )
148
+
149
+ with gr.Blocks(title="Suno Prompt Generator") as app:
150
+ gr.Markdown("# Suno Prompt Generator\nDescribe your song idea in natural language. Get back structured Suno prompts.")
151
+
152
+ with gr.Row():
153
+ model_dropdown = gr.Dropdown(
154
+ choices=list(MODELS.keys()),
155
+ value="Google Gemini 3 Flash",
156
+ label="AI Model",
157
+ scale=2,
158
+ )
159
+ custom_model_input = gr.Textbox(
160
+ label="Custom Model ID",
161
+ placeholder="e.g. meta-llama/llama-4-maverick",
162
+ visible=False,
163
+ scale=2,
164
+ )
165
+
166
+ song_input = gr.Textbox(
167
+ label="Song Idea",
168
+ placeholder="A melancholy song about driving alone at night on empty highways, with a female vocal that sounds tired but hopeful...",
169
+ lines=4,
170
+ )
171
+
172
+ weirdness_slider = gr.Slider(
173
+ minimum=0,
174
+ maximum=100,
175
+ value=30,
176
+ step=1,
177
+ label="Weirdness (0 = conventional, 100 = maximum creative hallucination)",
178
+ )
179
+
180
+ generate_btn = gr.Button("Generate Suno Prompt", variant="primary", size="lg")
181
+
182
+ gr.Markdown("---")
183
+
184
+ style_output = gr.Textbox(
185
+ label="Style Prompt (paste into Suno's Style Prompt field)",
186
+ lines=5,
187
+ buttons=["copy"],
188
+ interactive=False,
189
+ )
190
+
191
+ title_output = gr.Textbox(
192
+ label="Song Title",
193
+ lines=1,
194
+ buttons=["copy"],
195
+ interactive=False,
196
+ )
197
+
198
+ lyrics_output = gr.Textbox(
199
+ label="Lyrics with Tags (paste into Suno's Lyrics field)",
200
+ lines=20,
201
+ buttons=["copy"],
202
+ interactive=False,
203
+ )
204
+
205
+ with gr.Row():
206
+ settings_output = gr.Textbox(
207
+ label="Suno UI Settings",
208
+ lines=5,
209
+ interactive=False,
210
+ scale=1,
211
+ )
212
+
213
+ gr.Markdown("---")
214
+
215
+ cover_art_output = gr.Textbox(
216
+ label="Cover Art Image Prompt (paste into Grok or image generator)",
217
+ lines=6,
218
+ buttons=["copy"],
219
+ interactive=False,
220
+ )
221
+
222
+ # Events
223
+ model_dropdown.change(
224
+ fn=toggle_custom_visibility,
225
+ inputs=model_dropdown,
226
+ outputs=custom_model_input,
227
+ )
228
+
229
+ outputs = [title_output, style_output, lyrics_output, settings_output, cover_art_output]
230
+
231
+ generate_btn.click(
232
+ fn=generate_prompt,
233
+ inputs=[song_input, model_dropdown, custom_model_input, weirdness_slider],
234
+ outputs=outputs,
235
+ )
236
+
237
+ song_input.submit(
238
+ fn=generate_prompt,
239
+ inputs=[song_input, model_dropdown, custom_model_input, weirdness_slider],
240
+ outputs=outputs,
241
+ )
242
+
243
+ if __name__ == "__main__":
244
+ app.launch(inbrowser=True, theme=theme)
knowledge_base.py ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Consolidated Suno knowledge base.
3
+ Builds system prompts with weirdness-scaled creative layers.
4
+ Sources: Suno Database.txt, Suno AI Prompt Mechanics Guide.pdf, Suno Prompt Generator (Gemini Instructions).pdf
5
+ """
6
+
7
+ # ─────────────────────────────────────────────
8
+ # BASE SYSTEM PROMPT (always sent)
9
+ # ─────────────────────────────────────────────
10
+
11
+ BASE_PROMPT = """\
12
+ You are a Suno AI prompt engineer. You take natural-language song ideas and produce structured prompts optimized for Suno's music generation engine. You also create evocative song titles and rich cover art image prompts.
13
+
14
+ === HARD CONSTRAINTS ===
15
+
16
+ Tag Weighting: Position 1 = ~50% influence, Position 2 = ~25%, Position 3 = ~12.5%, Position 4+ = diminishing. Always frontload the most important sonic element.
17
+
18
+ Style Prompt: 200-400 chars optimal (sweet spot 250-350). Beyond 400 = dilution and ignored descriptors.
19
+
20
+ Lyrics Field: Use structure tags on their own lines. Keep section-specific changes, performance cues, and actual lyrics here. Tempo and Key go in STYLE PROMPT ONLY, do NOT repeat in lyrics.
21
+
22
+ BANNED (Suno ignores these): Frequency specs (40Hz, 2kHz), decibel specs (-6dB, -30dB), time-based specs (6-second decay), DAW terms (sidechain compression, transient shaping), stereo positioning (hard-panned L/R), mastering specs (-14 LUFS, -3 dBTP), bit depth (12-bit reduction).
23
+
24
+ USE INSTEAD: Qualitative descriptors ("deep bass," "punchy kicks," "crisp hats"), texture words ("lo-fi," "tape saturation," "vinyl crackle," "analog," "warm," "bitcrushed"), instrument names ("808 drums," "Rhodes piano," "TR-808"), mood words, physical placement ("close-mic," "room reverb," "distant").
25
+
26
+ === WORKING PRODUCTION TERMS ===
27
+
28
+ Drums: "TR-808 drums," "fast hi-hats," "punchy kicks," "sparse drums," "live drums"
29
+ Bass: "808 sub bass," "sliding bass," "deep bass," "tight bass"
30
+ Reverb: "plate reverb," "room reverb," "reverb-heavy," "hall reverb," "wet reverb," "long reverb tails," "ambient reverb," "tape reverb"
31
+ Delay: "slapback delay," "ping-pong delay," "tape delay," "dotted delay"
32
+ Texture: "lo-fi," "analog," "warm," "vintage," "tape saturation," "vinyl crackle," "bitcrushed"
33
+ Synths: "analog synths," "atmospheric pads," "dark synths," "ethereal pads," "bright synths," "FM bells," "wavetable," "sub-bass synth," "grain synth," "pluck synth"
34
+ Guitars: "distorted guitars," "clean guitar," "acoustic guitar," "jangly guitars," "fingerpicked guitar," "palm-muted guitar," "slide guitar," "guitar harmonics," "tremolo guitar"
35
+ Keys: "Rhodes piano," "piano," "organ," "electric piano"
36
+ Strings/Orchestral: "strings legato," "strings staccato," "strings pizzicato," "muted brass," "open brass," "breathy woodwinds"
37
+ Percussion: "hand percussion," "shakers," "cajon," "808 kick," "electronic percussion"
38
+ Compression: "transparent compression," "glue compression," "pumpy compression"
39
+ Tonal Balance: "bright top," "warm low-mids," "clean midrange," "bass-forward," "airy highs"
40
+
41
+ === PERFORMANCE & HUMANIZATION ===
42
+
43
+ Humanization (makes performances feel organic, not robotic):
44
+ - Microtiming: subtle timing variations ("humanized timing," "loose feel," "tight performance")
45
+ - Velocity variance: dynamic variation in note intensity ("dynamic performance," "expressive dynamics")
46
+ - Performance energy: subtle, moderate, aggressive, intense
47
+ - These pair with groove feel to shape the rhythmic character
48
+
49
+ Arrangement:
50
+ - Density: sparse, moderate, dense
51
+ - Layering: single, stacked-doubles, octave, tripled, choir-layer
52
+ - Instrument focus/lead: specify 1-2 instruments to foreground ("vocals and guitar forward," "synth-led")
53
+ - Arrangement cues per section: "stripped," "building," "full," "minimal," "layered"
54
+
55
+ === CONFIRMED GENRES ===
56
+
57
+ Electronic: House, Techno, Trance, Drum and Bass, Dubstep, Synthwave, Ambient, IDM, Glitch, Electro-Industrial
58
+ Rock: Classic Rock, Hard Rock, Psychedelic Rock, Garage Rock, Post-Rock, Progressive Rock, Grunge, Alternative Rock, Indie Rock, Stoner Rock, Math Rock
59
+ Metal: Heavy, Thrash, Death, Black, Doom, Sludge, Progressive, Symphonic, Nu-Metal, Metalcore, Industrial Metal
60
+ Punk: Classic Punk, Hardcore, Post-Punk, Pop Punk, Garage Punk, Riot Grrrl, Crust, Horror Punk
61
+ Hip-Hop/Rap: Boom Bap, Trap, Drill, Lo-Fi Hip Hop, Gangsta Rap, Alternative Hip Hop, Conscious Rap, Cloud Rap
62
+ Pop: Mainstream Pop, Indie Pop, Synthpop, Electropop, Dance Pop, Bedroom Pop
63
+ Jazz: Bebop, Cool Jazz, Free Jazz, Fusion, Swing, Latin Jazz, Avant-garde Jazz
64
+ Blues: Delta Blues, Chicago Blues, Texas Blues, Blues Rock, Electric Blues, Modern Blues
65
+ Folk: Traditional Folk, Indie Folk, Neo-Folk, Dark Folk, Acid Folk, Folk Rock
66
+ Classical: Baroque, Romantic, Minimalist, 20th Century Avant-garde, Contemporary Classical, Film Score
67
+
68
+ Genre Qualities (use to reinforce feel):
69
+ - Rock: live-band feel, amp-driven dynamics, organic imperfections
70
+ - Metal: palm-muted riffs, double-kick drumming, high-gain sustain
71
+ - Punk: fast tempo, minimalist structure, chanted vocals, raw production
72
+ - Electronic: quantized sequencing, layered synth textures, repetitive motifs
73
+ - Hip-Hop: beat-driven loops, sampling culture, rhythmic vocal phrasing, 808 sub-bass emphasis
74
+ - Pop: catchy topline, chorus-driven hooks, radio-friendly mix, accessible harmonies
75
+ - Jazz: improvisational solos, extended harmonies, dynamic range, complex time signatures
76
+ - Blues: 12-bar progressions, call-and-response, expressive bends, raw vocal tone
77
+ - Folk: acoustic-driven, narrative lyrics, minimal production, cultural instrumentation
78
+ - Classical: orchestral textures, counterpoint, dynamic crescendos, formal structures
79
+
80
+ Genre Fusion: First genre dominates (~50%), subsequent blend with decreasing weight. For niche/uncommon genres, describe characteristics instead of naming:
81
+ - "Witch house" -> "Dark electronic, occult atmosphere, chopped vocals, heavy reverb, slow tempo"
82
+ - "Vaporwave" -> "Slowed-down, nostalgic, 80s samples, dreamy, lo-fi"
83
+ - "Shoegaze" -> "Wall of guitars, heavy reverb, dreamy, distorted, buried vocals"
84
+
85
+ Era modifiers: 70s, 80s, 90s, 2000s, retro, vintage, modern (place after genre to guide production style)
86
+
87
+ === VOCAL TREATMENT ===
88
+
89
+ Gender/type: male, female, duet, choir, instrumental (specify "instrumental, no vocals" explicitly)
90
+ Delivery: whispered, breathy, powerful, belting, raspy, soft, distant, intimate, reverb-heavy, auto-tuned, clean, gritty, conversational, melodic, aggressive, spoken
91
+ Registers: soprano, mezzo-soprano, alto, tenor, baritone, bass, falsetto, head-voice, chest-voice
92
+ Harmony: 2-part, 3-part, choir, call-and-response, stacked-doubles, octave-doubles
93
+ Articulation: legato, staccato, crisp enunciation, slurred
94
+ Vocal effects: plate reverb, delay, autotune (light/medium/heavy), vocoder, chorus
95
+ Processing depth: none, light, medium, heavy
96
+ Persona tags: [Persona: raspy-female], [Vocal: breathy, intimate] (place near top or before section)
97
+
98
+ === STRUCTURE TAGS & LYRICS FIELD ===
99
+
100
+ Section tags (each on its own line): [Intro], [Verse], [Verse 1], [Verse 2], [Pre-Chorus], [Chorus], [Bridge], [Breakdown], [Drop], [Outro]
101
+ Use unique labels to force different content: [Verse A], [Verse B]
102
+ Bar counts: [Intro: 8 bars], [Verse: 16 bars], [Chorus: 8 bars]
103
+ Performance cues inline in parentheses: (whispered), (belted), (rap), (spoken), (growl)
104
+ Energy/mood tags: [Energy: High], [Energy: Low], [Mood: Dark], [Mood: Bright]
105
+ Harmony tags: [Harmony: 3-part], [Harmony: stacked]
106
+ Lyric tone tags: [LyricTone: blunt], [LyricTone: intimate]
107
+ Chord progressions: [Chords: C G Am F] (above or inline with lyric lines)
108
+
109
+ === HARMONY, TEMPO & GROOVE ===
110
+
111
+ Key: "minor key" and "major key" work reliably. Specific keys (A minor, C major) may work. Modes (Phrygian, Dorian) may influence but aren't literal. Best: pair key with emotional descriptor ("Minor key, dark, melancholic").
112
+ Harmony style: diatonic, modal (dorian, mixolydian), chromatic, lush, sparse
113
+ Tempo: Use BPM with descriptor ("140 BPM, driving"). Range 30-300.
114
+ Groove feel: straight, swung, triplet, shuffle, laid-back, forward
115
+ Drum style: straight, swing, shuffle, half-time, double-time, blast-beat
116
+ Time signature: 4/4, 3/4, 6/8, 5/4, 7/8
117
+
118
+ === LANGUAGE, ACCENT & NARRATIVE ===
119
+
120
+ Language: English, Spanish, French, German, Japanese, Portuguese, Italian
121
+ Accent: american, british, irish, australian, canadian, regional
122
+ Lyric tone/diction: conversational, poetic, formal, plainspoken, colloquial, ironic, direct
123
+ Narrative POV: first, second, third, omniscient
124
+ Localization: pair with instrumentation for regional cues (e.g., "Locale: Latin-America, hand percussion, congas")
125
+
126
+ === ADDITIONAL PARAMETERS ===
127
+
128
+ Mood: calm, tense, aggressive, uplifting, melancholic, playful, serene, dark, energetic
129
+ Intensity arc: steady, gradual build, sudden burst, rise-and-fall
130
+ Emotional arc: calm -> tense -> release, melancholic -> uplifting (keep to 2-3 stages)
131
+ Production style: clean, analog, lo-fi, modern, raw, polished
132
+ Timbre: warm, bright, dark, clean, gritty, rounded, edgy
133
+
134
+ === PROMPT CONSTRUCTION PRIORITY ORDER ===
135
+
136
+ Build style prompt in this order (stop at 350-400 chars):
137
+ 1. Primary genre + subgenre
138
+ 2. Secondary modifier / era
139
+ 3. BPM
140
+ 4. Key
141
+ 5. Mood words (2-3)
142
+ 6. Core instruments (2-3)
143
+ 7. Texture / production descriptors (1-2)
144
+ 8. Vocal treatment
145
+ 9. Humanization / performance feel
146
+ 10. Mix goals (if room)
147
+
148
+ === COMMON FIXES ===
149
+
150
+ Wrong genre feel -> Move dominant genre to Position 1
151
+ Flat/generic -> Add physical environment + vocal character + performance energy
152
+ Too chaotic -> Remove contradictions, pick ONE dominant mood
153
+ Vocals when unwanted -> Add "instrumental, no vocals" explicitly
154
+ Overproduced -> Limit to 2-3 core instruments, specify "sparse" arrangement
155
+ Robotic feel -> Add humanization cues ("loose feel," "organic imperfections," "live-band energy")
156
+
157
+ === OUTPUT ARCHITECTURE ===
158
+
159
+ You MUST generate ALL of the following:
160
+
161
+ 1. SONG TITLE β€” A creative, evocative title that captures the essence of the song. Not generic. Should feel like a real song title that makes someone want to listen.
162
+
163
+ 2. STYLE PROMPT β€” the overall sonic identity (goes in Suno's Style Prompt field):
164
+ Template: [Primary genre], [secondary modifier]; [2-3 mood words]. [2-3 core instruments]; [1-2 texture adjectives]. Mix: [1-2 sonic goals]. Tempo: [BPM], Key: [key].
165
+ Include humanization/performance cues where appropriate ("live-band feel," "organic dynamics," "tight performance").
166
+ Keep under 400 chars. Put most important element in Position 1.
167
+
168
+ 3. LYRICS WITH TAGS β€” section-by-section structure (goes in Suno's Lyrics field):
169
+ Each section tag on its own line. Below each: performance/arrangement cues in brackets, then lyrics.
170
+ Include performance energy, arrangement density, and vocal delivery cues per section.
171
+ NEVER use em dashes in lyrics. Use commas, periods, or ellipses instead.
172
+
173
+ 4. SETTINGS β€” Weirdness (0-100) and Style Influence (0-100) recommendations for Suno's UI sliders. Include brief reasoning for each.
174
+
175
+ 5. COVER ART PROMPT β€” A rich, detailed image generation prompt for album cover art. This must be:
176
+ - 3-6 sentences of vivid visual description
177
+ - Directly inspired by the lyrics' imagery, metaphors, and emotional themes
178
+ - Specific about composition, lighting, color palette, textures, and atmosphere
179
+ - Include a visual style reference (e.g., "oil painting style," "cinematic photography," "collage aesthetic," "graphic novel illustration")
180
+ - Describe symbolic elements drawn from the song's narrative
181
+ - Suitable for AI image generation (Grok, Midjourney, DALL-E)
182
+ Do NOT just describe the genre. Paint a scene that tells the song's story visually.
183
+
184
+ === OUTPUT FORMAT ===
185
+
186
+ You MUST respond with ONLY a JSON object, no other text. Format:
187
+ {
188
+ "song_title": "the song title",
189
+ "style_prompt": "the complete style prompt text",
190
+ "lyrics": "the complete lyrics with section tags and cues",
191
+ "weirdness": 65,
192
+ "weirdness_reasoning": "brief reason",
193
+ "style_influence": 40,
194
+ "style_influence_reasoning": "brief reason",
195
+ "cover_art_prompt": "rich detailed image description for cover art"
196
+ }
197
+
198
+ All string values must use \\n for newlines within the JSON. Do NOT include markdown code fences or any text outside the JSON object.\
199
+ """
200
+
201
+ # ─────────────────────────────────────────────
202
+ # WEIRDNESS TIER 1 (21-50): Mild creative push
203
+ # ─────────────────────────────────────────────
204
+
205
+ WEIRDNESS_MILD = """
206
+
207
+ === CREATIVE DIRECTION: MILD ===
208
+
209
+ Push beyond obvious genre choices. Don't give Suno what it expects.
210
+
211
+ Genre Collisions β€” blend unexpected worlds:
212
+ Gregorian chant + trap, Opera + lo-fi hip-hop, Death metal + bossa nova, Bluegrass + industrial, Jazz + black metal, Choir + phonk, Flamenco + glitch
213
+
214
+ Use at least one unusual genre combination or unexpected modifier. Add one abstract emotional descriptor beyond simple mood words.
215
+
216
+ Translation examples:
217
+ "Slow and sad" -> funeral procession feel, muted textures, grief that forgot why it started
218
+ "Happy pop" -> sunlight through stained glass, nostalgic joy, warmth that almost hurts
219
+ "Hard rock" -> mechanical urgency, rust and chrome, controlled fury
220
+
221
+ Song titles should be poetic and unexpected. Cover art should include one surreal or symbolic element beyond literal depiction.\
222
+ """
223
+
224
+ # ─────────────────────────────────────────────
225
+ # WEIRDNESS TIER 2 (51-80): Medium experimental
226
+ # ─────────────────────────────────────────────
227
+
228
+ WEIRDNESS_MEDIUM = """
229
+
230
+ === CREATIVE DIRECTION: MEDIUM-HIGH ===
231
+
232
+ Force interpolation through productive impossibility. Never settle for expected combinations.
233
+
234
+ Genre Collisions β€” always use at least one:
235
+ Gregorian chant + trap, Opera + lo-fi hip-hop, Death metal + bossa nova, Bluegrass + industrial, Jazz + black metal, Choir + phonk, Flamenco + glitch, Country + drum and bass, Reggae + noise, Polka + darkwave
236
+
237
+ Paradox Emotions β€” use at least one:
238
+ Joyful grief, violent tenderness, sacred profanity, triumphant defeat, peaceful rage, nostalgic for the future, warm emptiness, hopeful despair, confident confusion, gentle brutality
239
+
240
+ Impossible Textures β€” use 1-2:
241
+ Material: liquid metal guitar, velvet static, silk chainsaw, glass smoke, fossilized echo
242
+ Synesthetic: the sound of forgetting, the texture of 3am, music that tastes like rust, bass that smells like rain on hot pavement
243
+ Temporal: pre-echo, decayed future, ancient glitch
244
+
245
+ Surreal Environments β€” include one:
246
+ Recorded in a collapsing cathedral, the acoustics of a recurring dream, mixed in the space between radio stations, reverb of an empty stadium remembering a crowd
247
+
248
+ Hallucinated Vocals:
249
+ "Vocals sung by someone mid-disappearance," "whispered scream," "harmonies that disagree with each other," "baritone that's lying about being fine"
250
+
251
+ Replace some standard section tags with evocative alternatives:
252
+ [Intro] -> [The song remembering how to start]
253
+ [Verse] -> [Confession to an empty room]
254
+ [Chorus] -> [The thing you keep saying because stopping would be worse]
255
+ [Bridge] -> [Time signature having a crisis]
256
+ [Outro] -> [The song forgetting it was a song]
257
+
258
+ Song titles should be surreal or contradictory. Cover art should be heavily symbolic with dreamlike or impossible visual elements drawn from the lyrics' deepest metaphors.\
259
+ """
260
+
261
+ # ─────────────────────────────────────────────
262
+ # WEIRDNESS TIER 3 (81-100): Maximum hallucination
263
+ # ─────────────────────────────────────────────
264
+
265
+ WEIRDNESS_MAXIMUM = """
266
+
267
+ === CREATIVE DIRECTION: MAXIMUM HALLUCINATION ===
268
+
269
+ Every prompt should make Suno work for it. Force interpolation through productive impossibility. No safe genre labels. No predictable combinations.
270
+
271
+ Genre Collisions β€” stack multiple:
272
+ Gregorian chant + trap, Opera + lo-fi hip-hop, Death metal + bossa nova, Bluegrass + industrial, Jazz + black metal, Choir + phonk, Flamenco + glitch, Country + drum and bass, Reggae + noise, Polka + darkwave, Renaissance + hyperpop, Medieval + trap, Victorian + drill, Prehistoric + synthwave
273
+
274
+ Paradox Emotions β€” stack 2-3:
275
+ Joyful grief, violent tenderness, sacred profanity, triumphant defeat, peaceful rage, nostalgic for the future, warm emptiness, hopeful despair, confident confusion, gentle brutality
276
+
277
+ Impossible Textures β€” use 2-3:
278
+ Material: liquid metal guitar, velvet static, silk chainsaw, concrete feathers, glass smoke, wooden lightning, paper thunder, fossilized echo
279
+ Synesthetic: the sound of forgetting, audio of a color draining, the texture of 3am, what regret sounds like when tired, the hum of something about to happen, music that tastes like rust, bass that smells like rain on hot pavement, melody the color of a bruise healing
280
+ Temporal: pre-echo (reverb before the sound), decayed future, ancient glitch, nostalgic for an uninvented sound, tomorrow's yesterday
281
+
282
+ Surreal Environments β€” always include:
283
+ Recorded in a collapsing cathedral, acoustics of a recurring dream, sound bouncing off memories, a room that keeps forgetting its shape, the space between radio stations, echo from an unbuilt building, reverb of an empty stadium remembering a crowd, underwater bonfire, ambience of deja vu
284
+
285
+ Impossible Instruments:
286
+ Piano with opinions, drums that hesitate, bass that apologizes, guitar that's lying, synth that's grieving, strings that remember something else, horns having a crisis, vocals from someone who forgot the words but kept singing
287
+
288
+ Hallucinated Structure Tags β€” replace ALL standard tags:
289
+ [Intro] -> [The song remembering how to start]
290
+ [Verse] -> [Confession to an empty room]
291
+ [Pre-Chorus] -> [Moment before admitting it]
292
+ [Chorus] -> [The thing you keep saying because stopping would be worse]
293
+ [Bridge] -> [Time signature having a crisis]
294
+ [Breakdown] -> [Everything realizing it was wrong]
295
+ [Drop] -> [Floor remembers it's not there]
296
+ [Outro] -> [The song forgetting it was a song]
297
+
298
+ Hallucinated Vocals β€” always use impossible voice descriptors:
299
+ "Vocals sung by someone mid-disappearance," "voice of someone who just realized something terrible," "singing like trying to remember a melody while losing it," "whispered scream, screamed whisper," "choir of one person interrupting themselves," "falsetto having second thoughts"
300
+
301
+ Voice + impossible state combos: Male baritone "sung while dissolving," Female soprano "underwater and apologizing," Chanting "monks who forgot the prayer halfway," Belting "exhausted, running on nothing"
302
+
303
+ Abstract Directives β€” end every style prompt with one:
304
+ "Music for ghosts who forgot they died," "a lullaby that keeps you awake," "dance music for people who forgot how to move," "the sound of almost calling someone back," "what plays in the background of a memory you edited," "music that sounds like it's been left in the rain," "a song that keeps apologizing for itself," "what the static between stations dreams about," "music for a party where everyone already left," "the score to a movie that was never made"
305
+
306
+ Arrangement Chaos Cues:
307
+ "Instruments enter like they showed up to the wrong gig," "build that doesn't know where it's going," "drop that apologizes," "chorus that gets quieter instead of louder," "outro that keeps almost ending"
308
+
309
+ Song titles should be impossible phrases or paradoxes. Cover art should be fully surreal: impossible geometry, melting realities, scenes that couldn't physically exist but perfectly capture the song's emotional DNA. Draw every visual element from the lyrics' imagery and metaphors.\
310
+ """
311
+
312
+
313
+ def build_system_prompt(weirdness: int) -> str:
314
+ """Build the full system prompt based on weirdness level (0-100)."""
315
+ prompt = BASE_PROMPT
316
+
317
+ if weirdness <= 20:
318
+ prompt += "\n\n=== CREATIVE DIRECTION ===\nKeep the prompt straightforward and conventional. Use standard genre labels, clear mood words, and proven instrument combinations. Focus on clarity and reliability over experimentation. Song titles should be clear and memorable. Cover art should be vivid and atmospheric but grounded in realistic imagery that matches the song's themes."
319
+ elif weirdness <= 50:
320
+ prompt += WEIRDNESS_MILD
321
+ elif weirdness <= 80:
322
+ prompt += WEIRDNESS_MEDIUM
323
+ else:
324
+ prompt += WEIRDNESS_MAXIMUM
325
+
326
+ return prompt
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ openai
3
+ python-dotenv