root commited on
Commit
19c0923
Β·
1 Parent(s): 14555be
Files changed (2) hide show
  1. README.md +94 -25
  2. app.py +108 -40
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Music Genre Classifier & Lyrics Generator
3
  emoji: 🎡
4
  colorFrom: indigo
5
  colorTo: purple
@@ -8,40 +8,109 @@ sdk_version: 5.22.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
- short_description: AI music genre detection and lyrics generation
12
  ---
13
 
14
- # Music Genre Classifier & Lyrics Generator
15
 
16
- This Hugging Face Space application provides two AI-powered features:
17
 
18
- 1. **Music Genre Classification**: Upload a music file and get an analysis of its genre using the [dima806/music_genres_classification](https://huggingface.co/dima806/music_genres_classification) model.
19
 
20
- 2. **Lyrics Generation**: Based on the detected genre, the app generates original lyrics using [Qwen/QwQ-32B](https://huggingface.co/Qwen/QwQ-32B) that match both the style of the genre and approximate length of the song.
 
 
 
 
 
 
21
 
22
- ## Features
 
 
 
 
 
 
23
 
24
- - Upload any music file for instant genre classification
25
- - Receive genre predictions with confidence scores
26
- - Get AI-generated lyrics tailored to the detected music genre
27
- - Lyrics length is automatically adjusted based on the song duration
28
- - Simple and intuitive user interface
29
 
30
- ## Usage
31
 
32
- 1. Visit the live application on Hugging Face Spaces
33
- 2. Upload your music file using the provided interface
34
- 3. Click "Analyze & Generate" to process the audio
35
- 4. View the detected genre and generated lyrics in the output panels
 
 
 
 
 
 
 
 
 
 
36
 
37
- ## Technical Details
38
 
39
- - Uses MFCC features extraction from audio for genre classification
40
- - Leverages 4-bit quantization for efficient LLM inference on T4 GPU
41
- - Implements a specialized prompt engineering approach to generate genre-specific lyrics
42
- - Automatically scales lyrics length based on audio duration
 
 
43
 
44
- ## Links
45
 
46
- - [Music Genre Classification Model](https://huggingface.co/dima806/music_genres_classification)
47
- - [Qwen QwQ-32B Model](https://huggingface.co/Qwen/QwQ-32B)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Advanced Music Analysis & Beat-Matched Lyrics Generator
3
  emoji: 🎡
4
  colorFrom: indigo
5
  colorTo: purple
 
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
+ short_description: AI-powered music analysis with beat-synchronized lyrics generation
12
  ---
13
 
14
+ # Advanced Music Analysis & Beat-Matched Lyrics Generator
15
 
16
+ This comprehensive AI-powered application provides advanced music analysis and generates perfectly synchronized lyrics that match the musical structure, rhythm, and emotional content of your audio files.
17
 
18
+ ## 🎯 Key Features
19
 
20
+ ### 🎼 **Comprehensive Music Analysis**
21
+ - **Genre Classification**: Automatic detection using [dima806/music_genres_classification](https://huggingface.co/dima806/music_genres_classification)
22
+ - **Tempo & Time Signature Detection**: Advanced multi-method analysis (4/4, 3/4, 6/8)
23
+ - **Emotional Analysis**: 8-dimensional emotion detection (happy, sad, excited, calm, etc.)
24
+ - **Thematic Analysis**: Identifies musical themes (love, triumph, loss, adventure, etc.)
25
+ - **Tonal Analysis**: Key detection, mode analysis (major/minor), harmonic complexity
26
+ - **Beat Pattern Analysis**: Precise beat tracking and stress pattern identification
27
 
28
+ ### 🎀 **Beat-Synchronized Lyrics Generation**
29
+ - **Rhythm-Matched Lyrics**: Each line perfectly aligns with musical phrases and beat patterns
30
+ - **Syllable-to-Beat Mapping**: Precise syllable counting and stress pattern matching
31
+ - **Custom Requirements Integration**: Add your own creative directions and themes
32
+ - **Genre-Specific Optimization**: Tailored for Pop, Rock, Country, Disco, and Metal
33
+ - **Flow Analysis**: Ensures natural sentence flow across multiple lines
34
+ - **Quality Metrics**: Detailed beat matching and syllable accuracy analysis
35
 
36
+ ### 🎨 **Personalization Features**
37
+ - **Custom Prompt Input**: Specify themes, imagery, perspective, style, or content requirements
38
+ - **Intelligent Blending**: Merges your requirements with detected musical characteristics
39
+ - **Flexible Creative Control**: From simple themes to complex narrative directions
 
40
 
41
+ ## πŸš€ How It Works
42
 
43
+ 1. **Upload Audio**: Support for various audio formats, or record directly
44
+ 2. **Add Custom Requirements** (Optional): Specify your creative vision
45
+ 3. **Advanced Analysis**: Multi-layered analysis of musical characteristics:
46
+ - Rhythm and tempo analysis
47
+ - Time signature detection using autocorrelation, pattern matching, and spectral analysis
48
+ - Emotional profiling using valence-arousal mapping
49
+ - Thematic classification based on musical features
50
+ - Beat pattern extraction and stress analysis
51
+ 4. **Lyrics Generation**: AI creates lyrics using [Qwen/QwQ-32B](https://huggingface.co/Qwen/QwQ-32B) that:
52
+ - Match the detected beat patterns and time signature
53
+ - Incorporate detected emotions and themes
54
+ - Follow your custom creative requirements
55
+ - Maintain proper syllable-to-beat ratios for the genre
56
+ 5. **Quality Analysis**: Comprehensive beat matching analysis with accuracy metrics
57
 
58
+ ## 🎡 Supported Genres for Lyrics Generation
59
 
60
+ **Full Support** (Analysis + Beat-Matched Lyrics):
61
+ - **Pop**: Optimized syllable patterns and emotional expression
62
+ - **Rock**: Energetic phrasing with strong beat emphasis
63
+ - **Country**: Narrative flow with authentic storytelling patterns
64
+ - **Disco**: Rhythmic momentum with dance-friendly phrasing
65
+ - **Metal**: Intense expression with dramatic beat alignment
66
 
67
+ **Analysis Only**: All other genres receive comprehensive musical analysis without lyrics generation.
68
 
69
+ ## πŸ› οΈ Technical Features
70
+
71
+ ### Advanced Analysis Algorithms
72
+ - **Multi-Method Time Signature Detection**: Combines autocorrelation, pattern matching, spectral analysis, note density analysis, and tempo-based estimation
73
+ - **Emotion Mapping**: 8-dimensional emotion space with valence-arousal coordinates
74
+ - **Beat Strength Analysis**: Onset detection with energy and spectral flux analysis
75
+ - **Syllable Stress Matching**: CMU Dictionary integration with rule-based fallback
76
+
77
+ ### AI-Powered Generation
78
+ - **4-bit Quantization**: Efficient inference on T4 GPU using BitsAndBytesConfig
79
+ - **Specialized Prompting**: Genre-aware prompt engineering for optimal results
80
+ - **Quality Enforcement**: Automatic syllable limit enforcement and line count validation
81
+ - **Flow Optimization**: Sentence continuation analysis for natural lyrical flow
82
+
83
+ ## πŸ“Š Analysis Outputs
84
+
85
+ ### Musical Analysis
86
+ - Tempo (BPM) and time signature with confidence scores
87
+ - Primary and secondary emotions with confidence percentages
88
+ - Musical themes and their relevance scores
89
+ - Key signature and mode detection
90
+ - Beat pattern visualization
91
+
92
+ ### Lyrics Quality Metrics
93
+ - Syllable-to-beat match accuracy
94
+ - Stress pattern alignment scores
95
+ - Sentence flow quality assessment
96
+ - Genre-appropriate range compliance
97
+ - Overall rhythmic accuracy percentage
98
+
99
+ ## 🎯 Custom Requirements Examples
100
+
101
+ **Themes**: "Write about a journey through mountains", "Focus on urban nightlife"
102
+ **Imagery**: "Use ocean metaphors", "Include references to light and shadow"
103
+ **Perspective**: "From a child's viewpoint", "Nostalgic memories", "Future aspirations"
104
+ **Style**: "Conversational tone", "Include internal rhymes", "Simple everyday language"
105
+ **Content**: "Avoid melancholy", "Include words 'freedom' and 'horizon'", "Focus on resilience"
106
+
107
+ ## πŸ”— Model Credits
108
+
109
+ - **Genre Classification**: [dima806/music_genres_classification](https://huggingface.co/dima806/music_genres_classification)
110
+ - **Lyrics Generation**: [Qwen/QwQ-32B](https://huggingface.co/Qwen/QwQ-32B) with 4-bit quantization
111
+ - **Audio Processing**: librosa, scipy, numpy for advanced signal processing
112
+ - **Linguistic Analysis**: NLTK CMU Dictionary for syllable counting and stress analysis
113
+
114
+ ## πŸŽͺ Try It Now
115
+
116
+ Experience the future of AI-powered music analysis and lyrics generation. Upload your music and watch as the system creates perfectly synchronized, emotionally resonant lyrics tailored to your creative vision!
app.py CHANGED
@@ -87,7 +87,7 @@ except Exception as e:
87
  music_analyzer = MusicAnalyzer()
88
 
89
  # Process uploaded audio file
90
- def process_audio(audio_file):
91
  if audio_file is None:
92
  return "No audio file provided", None, None, None, None, None, None, None, None, None
93
 
@@ -200,7 +200,7 @@ def process_audio(audio_file):
200
 
201
  # Generate lyrics only for supported genres
202
  if genre_supported:
203
- lyrics = generate_lyrics(music_analysis, primary_genre, duration)
204
  beat_match_analysis = analyze_lyrics_rhythm_match(lyrics, lyric_templates, primary_genre)
205
  else:
206
  supported_genres_str = ", ".join([genre.capitalize() for genre in beat_analyzer.supported_genres])
@@ -214,7 +214,7 @@ def process_audio(audio_file):
214
  print(error_msg)
215
  return error_msg, None, None, None, None, None, None, None, None, None
216
 
217
- def generate_lyrics(music_analysis, genre, duration):
218
  try:
219
  # Extract meaningful information for context
220
  tempo = music_analysis["rhythm_analysis"]["tempo"]
@@ -242,7 +242,8 @@ def generate_lyrics(music_analysis, genre, duration):
242
  min_syl_for_prompt = 2
243
  max_syl_for_prompt = 7
244
 
245
- prompt = (f'''You are a professional songwriter. Write song lyrics for a {genre} song.
 
246
 
247
  SONG DETAILS:
248
  - Key: {key} {mode}
@@ -250,7 +251,18 @@ SONG DETAILS:
250
  - Primary emotion: {primary_emotion}
251
  - Secondary emotion: {secondary_emotion}
252
  - Primary theme: {primary_theme}
253
- - Secondary theme: {secondary_theme}
 
 
 
 
 
 
 
 
 
 
 
254
 
255
  CRITICAL REQUIREMENTS (MOST IMPORTANT):
256
  - You MUST write EXACTLY {num_phrases_for_prompt} lines of lyrics.
@@ -288,14 +300,15 @@ Under the "LYRICS:" heading, provide exactly {num_phrases_for_prompt} numbered l
288
  LYRICS:
289
  (Your {num_phrases_for_prompt} numbered lyric lines go here, each starting with its number, a period, and a space)
290
 
291
- Remember: Output EXACTLY {num_phrases_for_prompt} numbered lyric lines. Each line's content (after removing the number) must be {min_syl_for_prompt}-{max_syl_for_prompt} syllables.''')
292
  else:
293
  # Calculate the typical syllable range for this genre
294
  num_phrases_for_prompt = len(lyric_templates)
295
  max_syl_for_prompt = max([t.get('max_expected', 7) for t in lyric_templates]) if lyric_templates and lyric_templates[0].get('max_expected') else 7
296
  min_syl_for_prompt = min([t.get('min_expected', 2) for t in lyric_templates]) if lyric_templates and lyric_templates[0].get('min_expected') else 2
297
 
298
- prompt = (f'''You are a professional songwriter. Write song lyrics for a {genre} song.
 
299
 
300
  SONG DETAILS:
301
  - Key: {key} {mode}
@@ -303,7 +316,18 @@ SONG DETAILS:
303
  - Primary emotion: {primary_emotion}
304
  - Secondary emotion: {secondary_emotion}
305
  - Primary theme: {primary_theme}
306
- - Secondary theme: {secondary_theme}
 
 
 
 
 
 
 
 
 
 
 
307
 
308
  CRITICAL REQUIREMENTS (MOST IMPORTANT):
309
  - You MUST write EXACTLY {num_phrases_for_prompt} lines of lyrics.
@@ -341,7 +365,7 @@ Under the "LYRICS:" heading, provide exactly {num_phrases_for_prompt} numbered l
341
  LYRICS:
342
  (Your {num_phrases_for_prompt} numbered lyric lines go here, each starting with its number, a period, and a space)
343
 
344
- Remember: Output EXACTLY {num_phrases_for_prompt} numbered lyric lines. Each line's content (after removing the number) must be {min_syl_for_prompt}-{max_syl_for_prompt} syllables.''')
345
  # Generate with optimized parameters for QwQ model
346
  messages = [
347
  {"role": "user", "content": prompt}
@@ -832,46 +856,55 @@ def enforce_syllable_limits(lines, max_syllables=6):
832
 
833
  # Create Gradio interface
834
  def create_interface():
835
- with gr.Blocks(title="Music Analysis & Lyrics Generator") as demo:
836
- gr.Markdown("# Music Analysis & Lyrics Generator")
837
- gr.Markdown("Upload a music file or record audio to analyze it and generate matching lyrics")
838
 
839
  with gr.Row():
840
  with gr.Column(scale=1):
841
  audio_input = gr.Audio(
842
- label="Upload or Record Audio",
843
  type="filepath",
844
  sources=["upload", "microphone"]
845
  )
846
- analyze_btn = gr.Button("Analyze and Generate Lyrics", variant="primary")
 
 
 
 
 
 
 
 
 
847
 
848
  with gr.Column(scale=2):
849
- with gr.Tab("Analysis"):
850
- analysis_output = gr.Textbox(label="Music Analysis Results", lines=10)
851
 
852
  with gr.Row():
853
- tempo_output = gr.Number(label="Tempo (BPM)")
854
- time_sig_output = gr.Textbox(label="Time Signature")
855
 
856
  with gr.Row():
857
- primary_emotion_output = gr.Textbox(label="Primary Emotion")
858
- secondary_emotion_output = gr.Textbox(label="Secondary Emotion")
859
 
860
  with gr.Row():
861
- primary_theme_output = gr.Textbox(label="Primary Theme")
862
- secondary_theme_output = gr.Textbox(label="Secondary Theme")
863
- genre_output = gr.Textbox(label="Primary Genre")
864
 
865
- with gr.Tab("Generated Lyrics"):
866
- lyrics_output = gr.Textbox(label="Generated Lyrics", lines=20)
867
 
868
- with gr.Tab("Beat Matching"):
869
- beat_match_output = gr.Markdown(label="Beat & Syllable Matching Analysis")
870
 
871
  # Set up event handlers
872
  analyze_btn.click(
873
  fn=process_audio,
874
- inputs=[audio_input],
875
  outputs=[
876
  analysis_output, lyrics_output, tempo_output, time_sig_output,
877
  primary_emotion_output, secondary_emotion_output,
@@ -881,22 +914,57 @@ def create_interface():
881
  )
882
 
883
  # Format supported genres for display
884
- supported_genres_md = "\n".join([f"- {genre.capitalize()}" for genre in beat_analyzer.supported_genres])
885
 
886
  gr.Markdown(f"""
887
- ## How it works
888
- 1. Upload or record a music file
889
- 2. The system analyzes tempo, beats, time signature and other musical features
890
- 3. It detects emotions, themes, and music genre
891
- 4. Using beat patterns and syllable stress analysis, it generates perfectly aligned lyrics
892
- 5. Each line of the lyrics is matched to the beat pattern of the corresponding musical phrase
893
-
894
- ## Supported Genres
895
- **Note:** Lyrics generation is currently only supported for the following genres:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
896
  {supported_genres_md}
897
 
898
- These genres have consistent syllable-to-beat patterns that work well with our algorithm.
899
- For other genres, only music analysis will be provided.
 
 
 
 
 
 
 
 
 
 
900
  """)
901
 
902
  return demo
 
87
  music_analyzer = MusicAnalyzer()
88
 
89
  # Process uploaded audio file
90
+ def process_audio(audio_file, custom_prompt=""):
91
  if audio_file is None:
92
  return "No audio file provided", None, None, None, None, None, None, None, None, None
93
 
 
200
 
201
  # Generate lyrics only for supported genres
202
  if genre_supported:
203
+ lyrics = generate_lyrics(music_analysis, primary_genre, duration, custom_prompt)
204
  beat_match_analysis = analyze_lyrics_rhythm_match(lyrics, lyric_templates, primary_genre)
205
  else:
206
  supported_genres_str = ", ".join([genre.capitalize() for genre in beat_analyzer.supported_genres])
 
214
  print(error_msg)
215
  return error_msg, None, None, None, None, None, None, None, None, None
216
 
217
+ def generate_lyrics(music_analysis, genre, duration, custom_prompt=""):
218
  try:
219
  # Extract meaningful information for context
220
  tempo = music_analysis["rhythm_analysis"]["tempo"]
 
242
  min_syl_for_prompt = 2
243
  max_syl_for_prompt = 7
244
 
245
+ # Build the base prompt
246
+ base_prompt = f'''You are a professional songwriter. Write song lyrics for a {genre} song.
247
 
248
  SONG DETAILS:
249
  - Key: {key} {mode}
 
251
  - Primary emotion: {primary_emotion}
252
  - Secondary emotion: {secondary_emotion}
253
  - Primary theme: {primary_theme}
254
+ - Secondary theme: {secondary_theme}'''
255
+
256
+ # Add custom requirements if provided
257
+ custom_requirements = ""
258
+ if custom_prompt and custom_prompt.strip():
259
+ custom_requirements = f'''
260
+
261
+ SPECIAL REQUIREMENTS FROM USER:
262
+ {custom_prompt.strip()}
263
+ Please incorporate these requirements while still following all the technical constraints below.'''
264
+
265
+ prompt = base_prompt + custom_requirements + f'''
266
 
267
  CRITICAL REQUIREMENTS (MOST IMPORTANT):
268
  - You MUST write EXACTLY {num_phrases_for_prompt} lines of lyrics.
 
300
  LYRICS:
301
  (Your {num_phrases_for_prompt} numbered lyric lines go here, each starting with its number, a period, and a space)
302
 
303
+ Remember: Output EXACTLY {num_phrases_for_prompt} numbered lyric lines. Each line's content (after removing the number) must be {min_syl_for_prompt}-{max_syl_for_prompt} syllables.'''
304
  else:
305
  # Calculate the typical syllable range for this genre
306
  num_phrases_for_prompt = len(lyric_templates)
307
  max_syl_for_prompt = max([t.get('max_expected', 7) for t in lyric_templates]) if lyric_templates and lyric_templates[0].get('max_expected') else 7
308
  min_syl_for_prompt = min([t.get('min_expected', 2) for t in lyric_templates]) if lyric_templates and lyric_templates[0].get('min_expected') else 2
309
 
310
+ # Build the base prompt
311
+ base_prompt = f'''You are a professional songwriter. Write song lyrics for a {genre} song.
312
 
313
  SONG DETAILS:
314
  - Key: {key} {mode}
 
316
  - Primary emotion: {primary_emotion}
317
  - Secondary emotion: {secondary_emotion}
318
  - Primary theme: {primary_theme}
319
+ - Secondary theme: {secondary_theme}'''
320
+
321
+ # Add custom requirements if provided
322
+ custom_requirements = ""
323
+ if custom_prompt and custom_prompt.strip():
324
+ custom_requirements = f'''
325
+
326
+ SPECIAL REQUIREMENTS FROM USER:
327
+ {custom_prompt.strip()}
328
+ Please incorporate these requirements while still following all the technical constraints below.'''
329
+
330
+ prompt = base_prompt + custom_requirements + f'''
331
 
332
  CRITICAL REQUIREMENTS (MOST IMPORTANT):
333
  - You MUST write EXACTLY {num_phrases_for_prompt} lines of lyrics.
 
365
  LYRICS:
366
  (Your {num_phrases_for_prompt} numbered lyric lines go here, each starting with its number, a period, and a space)
367
 
368
+ Remember: Output EXACTLY {num_phrases_for_prompt} numbered lyric lines. Each line's content (after removing the number) must be {min_syl_for_prompt}-{max_syl_for_prompt} syllables.'''
369
  # Generate with optimized parameters for QwQ model
370
  messages = [
371
  {"role": "user", "content": prompt}
 
856
 
857
  # Create Gradio interface
858
  def create_interface():
859
+ with gr.Blocks(title="Advanced Music Analysis & Beat-Matched Lyrics Generator") as demo:
860
+ gr.Markdown("# 🎡 Advanced Music Analysis & Beat-Matched Lyrics Generator")
861
+ gr.Markdown("**Upload music to get comprehensive analysis and generate perfectly synchronized lyrics that match the rhythm, emotion, and structure of your audio**")
862
 
863
  with gr.Row():
864
  with gr.Column(scale=1):
865
  audio_input = gr.Audio(
866
+ label="🎧 Upload or Record Audio",
867
  type="filepath",
868
  sources=["upload", "microphone"]
869
  )
870
+
871
+ # Add custom prompt input
872
+ custom_prompt_input = gr.Textbox(
873
+ label="🎨 Custom Lyrics Requirements (Optional)",
874
+ placeholder="e.g., 'Write about a rainy day in the city' or 'Include metaphors about flying' or 'Make it about overcoming challenges'",
875
+ lines=3,
876
+ info="Add any specific requirements, themes, or creative directions for the lyrics. This will be merged with the music analysis to create personalized lyrics."
877
+ )
878
+
879
+ analyze_btn = gr.Button("πŸš€ Analyze Music & Generate Lyrics", variant="primary", size="lg")
880
 
881
  with gr.Column(scale=2):
882
+ with gr.Tab("πŸ“Š Music Analysis"):
883
+ analysis_output = gr.Textbox(label="Comprehensive Music Analysis Results", lines=10)
884
 
885
  with gr.Row():
886
+ tempo_output = gr.Number(label="πŸ₯ Tempo (BPM)")
887
+ time_sig_output = gr.Textbox(label="⏱️ Time Signature")
888
 
889
  with gr.Row():
890
+ primary_emotion_output = gr.Textbox(label="😊 Primary Emotion")
891
+ secondary_emotion_output = gr.Textbox(label="😌 Secondary Emotion")
892
 
893
  with gr.Row():
894
+ primary_theme_output = gr.Textbox(label="🎭 Primary Theme")
895
+ secondary_theme_output = gr.Textbox(label="πŸŽͺ Secondary Theme")
896
+ genre_output = gr.Textbox(label="🎼 Primary Genre")
897
 
898
+ with gr.Tab("🎀 Generated Lyrics"):
899
+ lyrics_output = gr.Textbox(label="Beat-Synchronized Lyrics", lines=20)
900
 
901
+ with gr.Tab("🎯 Beat Matching Analysis"):
902
+ beat_match_output = gr.Markdown(label="Rhythm & Syllable Synchronization Analysis")
903
 
904
  # Set up event handlers
905
  analyze_btn.click(
906
  fn=process_audio,
907
+ inputs=[audio_input, custom_prompt_input],
908
  outputs=[
909
  analysis_output, lyrics_output, tempo_output, time_sig_output,
910
  primary_emotion_output, secondary_emotion_output,
 
914
  )
915
 
916
  # Format supported genres for display
917
+ supported_genres_md = "\n".join([f"- **{genre.capitalize()}**: Optimized for {genre} music patterns" for genre in beat_analyzer.supported_genres])
918
 
919
  gr.Markdown(f"""
920
+ ## πŸš€ How It Works
921
+
922
+ 1. **🎧 Upload Audio**: Support for various formats (MP3, WAV, etc.) or record directly in your browser
923
+ 2. **🎨 Add Custom Requirements** (Optional): Specify your creative vision, themes, or style preferences
924
+ 3. **πŸ” Advanced Analysis**: Multi-layered analysis including:
925
+ - **Tempo & Time Signature**: Advanced detection using multiple algorithms
926
+ - **Emotional Profiling**: 8-dimensional emotion mapping (happy, sad, excited, calm, etc.)
927
+ - **Thematic Analysis**: Musical themes (love, triumph, adventure, reflection, etc.)
928
+ - **Beat Pattern Extraction**: Precise rhythm and stress pattern identification
929
+ - **Genre Classification**: AI-powered genre detection with confidence scores
930
+ 4. **🎀 Lyrics Generation**: AI creates perfectly synchronized lyrics that:
931
+ - **Match Beat Patterns**: Each line aligns with musical phrases and rhythm
932
+ - **Follow Syllable Constraints**: Precise syllable-to-beat mapping for natural flow
933
+ - **Incorporate Emotions & Themes**: Blend detected musical characteristics
934
+ - **Include Your Requirements**: Merge your creative directions seamlessly
935
+ 5. **πŸ“Š Quality Analysis**: Comprehensive metrics showing beat matching accuracy and flow quality
936
+
937
+ ## 🎨 Custom Requirements Examples
938
+
939
+ **🌟 Themes**: "Write about nature and freedom", "Focus on urban nightlife", "Tell a story about friendship"
940
+
941
+ **πŸ–ΌοΈ Imagery**: "Use ocean metaphors", "Include references to stars and sky", "Focus on light and shadow"
942
+
943
+ **πŸ‘οΈ Perspective**: "From a child's viewpoint", "Make it nostalgic", "Focus on hope and resilience"
944
+
945
+ **✍️ Style**: "Use simple everyday language", "Include some rhyming", "Make it conversational"
946
+
947
+ **πŸ“ Content**: "Avoid sad themes", "Include words 'journey' and 'home'", "Focus on personal growth"
948
+
949
+ The system intelligently blends your requirements with detected musical characteristics to create personalized, rhythm-perfect lyrics.
950
+
951
+ ## 🎡 Supported Genres for Full Lyrics Generation
952
+
953
+ **βœ… Full Support** (Complete Analysis + Beat-Matched Lyrics):
954
  {supported_genres_md}
955
 
956
+ These genres have consistent syllable-to-beat patterns that work optimally with our advanced rhythm-matching algorithm.
957
+
958
+ **πŸ“Š Analysis Only**: All other genres receive comprehensive musical analysis (tempo, emotion, themes, etc.) without lyrics generation.
959
+
960
+ ## πŸ› οΈ Advanced Features
961
+
962
+ - **🎯 Beat Synchronization**: Syllable-perfect alignment with musical phrases
963
+ - **🧠 Emotion Integration**: Lyrics reflect detected emotional characteristics
964
+ - **🎭 Theme Incorporation**: Musical themes guide lyrical content
965
+ - **πŸ“ Quality Metrics**: Detailed analysis of rhythm matching accuracy
966
+ - **πŸ”„ Flow Optimization**: Natural sentence continuation across lines
967
+ - **βš™οΈ Genre Optimization**: Tailored patterns for different musical styles
968
  """)
969
 
970
  return demo