ghostai1 commited on
Commit
3da61a1
·
verified ·
1 Parent(s): f386bf3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +51 -51
README.md CHANGED
@@ -10,85 +10,85 @@ pinned: false
10
  license: apache-2.0
11
  short_description: alot of local zero build
12
  ---
 
13
  GhostAI Music Generator
14
 
15
  License: MIT
16
  Python: 3.10
17
  CUDA: 11.8 | 12.1
18
 
19
- The GhostAI Music Generator is a web-based application powered by Meta AI's musicgen-medium model, hosted as a demo in a Hugging Face Space. It creates high-quality instrumental tracks across genres, including Rock, Techno, Jazz, Classical, and Hip-Hop. The tool generates structured compositions with sections such as intros, verses, and choruses, accessible via an intuitive Gradio interface. Outputs are 320 kbps MP3 files with embedded metadata, enhanced by audio processing features like equalization (EQ), chorus effects, and peak limiting for professional-grade sound.
20
 
21
  - License: MIT
22
  - Tags: Python, AI, Music Generation
23
 
24
  Features
25
 
26
- - Genre Versatility: Supports Rock, Techno, Jazz, Classical, and Hip-Hop with customizable prompts.
27
- - Structured Compositions: Generates tracks with dynamic intros, verses, choruses, and outros.
28
  - Audio Enhancements:
29
- - Equalization: Low-pass filter at 6000 Hz, high-pass at 100 Hz.
30
- - Chorus Effect: 20ms delay with -4 dB gain.
31
- - Peak Limiting: Set at -8.0 dB to control peaks.
32
- - Gain Adjustment: +2 dB boost before crossfading.
33
- - Compression: Removed to preserve dynamic range.
34
- - Output: High-quality 320 kbps MP3 files with metadata.
35
  - Interface: Gradio UI for easy interaction in the Hugging Face Space.
36
 
37
- Project Evolution
38
-
39
- The project was optimized for a GPU with 7.69 GiB VRAM by splitting 30-second tracks into two 15-second chunks, reducing memory usage. The Bark model was removed to focus on instrumental generation, and MP3 was standardized for compatibility. Varied prompts (e.g., "dynamic intro and expressive verse" for the first chunk, "powerful chorus and energetic outro" for the second) ensure natural song flow.
40
-
41
- Using the Interface
42
 
43
- In the Hugging Face Space Gradio interface:
44
- - Select a Genre: Choose from Rock, Techno, Jazz, Classical, or Hip-Hop.
45
  - Custom Prompt: Enter a description, e.g.:
46
- Hard rock with a dynamic intro, expressive verse, and powerful chorus, featuring electric guitars, steady heavy drums, and deep bass.
47
  - Adjust Parameters:
48
- - Guidance Scale (CFG): Default is 3.0.
49
- - Top-K Sampling: Default is 300.
50
- - Top-P Sampling: Default is 0.95.
51
- - Temperature: Default is 1.0.
52
- - Total Duration: Set to 30 seconds (range: 10-60).
53
- - Crossfade Duration: Set to 500 ms (range: 100-2000).
54
- - Generate Music: Click "Generate Music" to create the track. The output is saved as output_cleaned.mp3 and playable in the interface.
55
-
56
- Troubleshooting and Customization
57
-
58
- - Quiet Spots in Waveform: Increase gain before crossfading by modifying app.py:
 
 
 
 
 
 
 
 
 
59
  python
60
- next_segment = next_segment + 3
61
- Use audio tools like Audacity to inspect the waveform.
62
-
63
- - Enhancing the Chorus: Modify the second chunk prompt in the interface to:
64
- explosive chorus with soaring guitars and pounding drums
65
- Or increase temperature to 1.2 and top_k to 350.
66
-
67
- - Audio Distortion: Reduce chorus effect gain in app.py:
68
  python
69
- delayed = segment - 6
70
- Adjust EQ settings in apply_eq with high-pass at 80 Hz and low-pass at 5000 Hz.
71
 
72
- - Use a Smaller Model: For lower resource use, switch to musicgen-small in app.py:
73
  python
74
  musicgen_model = MusicGen.get_pretrained('facebook/musicgen-small', device=device)
75
 
76
- - Add New Genres: Define a new genre prompt in app.py:
77
- python
78
- def set_pop_prompt():
79
- return "Pop with a catchy intro, upbeat verse, and anthemic chorus, featuring bright synths, punchy drums, and groovy bass"
80
- Add a button:
81
- python
82
- pop_btn = gr.Button("Pop", elem_classes="genre-btn")
83
- pop_btn.click(set_pop_prompt, inputs=None, outputs=[instrumental_prompt])
84
 
85
  Acknowledgments
86
 
87
- Special thanks to:
88
  - Meta AI for musicgen-medium and Audiocraft.
89
  - Hugging Face for hosting and CLI tools.
90
  - Gradio for the web interface.
91
- - pydub for audio processing and MP3 export.
92
- - xAI for their support.
93
 
94
- Enjoy creating music! For questions or suggestions, open an issue in the repository.
 
10
  license: apache-2.0
11
  short_description: alot of local zero build
12
  ---
13
+
14
  GhostAI Music Generator
15
 
16
  License: MIT
17
  Python: 3.10
18
  CUDA: 11.8 | 12.1
19
 
20
+ The GhostAI Music Generator is a web-based demo hosted in a Hugging Face Space, powered by Meta AI's facebook/musicgen-medium model. It creates high-quality instrumental tracks across genres like Red Hot Chili Peppers-inspired funk rock, Nirvana-style grunge, Detroit techno, and more. Tracks are generated with structured sections (intros, verses, choruses) and delivered as 128 kbps MP3 files with metadata. Audio enhancements include equalization and fade effects for a polished sound. The demo runs in a pre-configured Gradio interface within a container, requiring no local setup.
21
 
22
  - License: MIT
23
  - Tags: Python, AI, Music Generation
24
 
25
  Features
26
 
27
+ - Genre Versatility: Supports funk rock, grunge, techno, house, and more with customizable prompts.
28
+ - Structured Compositions: Generates tracks with dynamic intros, verses, and choruses.
29
  - Audio Enhancements:
30
+ - Equalization: Low-pass at 8000 Hz, high-pass at 80 Hz.
31
+ - Fade Effects: 1000ms fade-in and fade-out.
32
+ - Normalization: Headroom set to -9.0 dB.
33
+ - Output: 128 kbps MP3 files with metadata.
 
 
34
  - Interface: Gradio UI for easy interaction in the Hugging Face Space.
35
 
36
+ Using the Demo
 
 
 
 
37
 
38
+ In the Gradio interface:
39
+ - Select a Genre: Choose from Red Hot Chili Peppers, Nirvana, Pearl Jam, Foo Fighters, Detroit Techno, Deep House, etc.
40
  - Custom Prompt: Enter a description, e.g.:
41
+ Instrumental funk rock, Red Hot Chili Peppers-inspired vibe with groovy basslines, syncopated guitar riffs, and funky breakdowns at 120 BPM.
42
  - Adjust Parameters:
43
+ - CFG Scale: Default 3.0 (1.0-10.0, controls prompt adherence).
44
+ - Top-K Sampling: Default 250 (10-500, limits token sampling).
45
+ - Top-P Sampling: Default 0.9 (0.0-1.0, controls probability threshold).
46
+ - Temperature: Default 1.0 (0.1-2.0, adjusts randomness).
47
+ - Song Length: Default 30 seconds (30, 60, 90, or 120 seconds).
48
+ - Chunk Duration: Default 10 seconds (5-15 seconds, for memory optimization).
49
+ - Crossfade Duration: Default 1000 ms (100-2000 ms, for smooth transitions).
50
+ - Tempo (BPM): Default 120 (60-180, sets track tempo).
51
+ - Drum Beat, Synthesizer, Rhythmic Steps, Bass Style, Guitar Style: Customize with dropdowns (e.g., "slap bass", "distorted guitar").
52
+ - Generate Music: Click "Generate Music" to create the track. Output is saved as output_cleaned.mp3 and playable in the interface.
53
+
54
+ Troubleshooting
55
+
56
+ - No Output: Ensure a valid prompt is entered. Check status messages for errors.
57
+ - Poor Quality: Adjust temperature (e.g., 1.2 for more variety) or top_k (e.g., 300) in the interface.
58
+ - Choppy Transitions: Increase crossfade duration (e.g., 1500 ms) or reduce chunk duration (e.g., 8 seconds).
59
+
60
+ Customization
61
+
62
+ To add a new genre, modify app.py:
63
  python
64
+ def set_new_genre_prompt(bpm, drum_beat, synthesizer, rhythmic_steps, bass_style, guitar_style):
65
+ rhythm = f" with {rhythmic_steps}" if rhythmic_steps != "none" else "steady rhythmic flow"
66
+ drum = f", {drum_beat} drums" if drum_beat != "none" else ""
67
+ synth = f", {synthesizer} accents" if synthesizer != "none" else ""
68
+ bass = f", {bass_style}" if bass_style != "none" else ", deep bass"
69
+ guitar = f", {guitar_style} guitars" if guitar_style != "none" else ", clean guitars"
70
+ return f"Instrumental new genre{bass}{guitar}{drum}{synth}, inspired vibe, {rhythm} at {bpm} BPM."
71
+ Add a button:
72
  python
73
+ new_genre_btn = gr.Button("New Genre", elem_classes="genre-btn")
74
+ new_genre_btn.click(set_new_genre_prompt, inputs=[bpm, drum_beat, synthesizer, rhythmic_steps, bass_style, guitar_style], outputs=instrumental_prompt)
75
 
76
+ To use a smaller model for faster generation, update app.py:
77
  python
78
  musicgen_model = MusicGen.get_pretrained('facebook/musicgen-small', device=device)
79
 
80
+ Environment Setup
81
+
82
+ The demo requires a Hugging Face token for model access:
83
+ - Set the HF_TOKEN environment variable in the Hugging Face Space settings with your token from https://huggingface.co/settings/tokens.
84
+ - Ensure access to facebook/musicgen-medium is granted via your Hugging Face account.
 
 
 
85
 
86
  Acknowledgments
87
 
 
88
  - Meta AI for musicgen-medium and Audiocraft.
89
  - Hugging Face for hosting and CLI tools.
90
  - Gradio for the web interface.
91
+ - pydub for audio processing.
92
+ - xAI for support.
93
 
94
+ For issues or suggestions, open an issue in the repository.