Spaces:
Runtime error
Runtime error
Update README.md
Browse files
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
|
20 |
|
21 |
- License: MIT
|
22 |
- Tags: Python, AI, Music Generation
|
23 |
|
24 |
Features
|
25 |
|
26 |
-
- Genre Versatility: Supports
|
27 |
-
- Structured Compositions: Generates tracks with dynamic intros, verses,
|
28 |
- Audio Enhancements:
|
29 |
-
- Equalization: Low-pass
|
30 |
-
-
|
31 |
-
-
|
32 |
-
|
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 |
-
|
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
|
44 |
-
- Select a Genre: Choose from
|
45 |
- Custom Prompt: Enter a description, e.g.:
|
46 |
-
|
47 |
- Adjust Parameters:
|
48 |
-
-
|
49 |
-
- Top-K Sampling: Default
|
50 |
-
- Top-P Sampling: Default
|
51 |
-
- Temperature: Default
|
52 |
-
-
|
53 |
-
-
|
54 |
-
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
python
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
python
|
69 |
-
|
70 |
-
|
71 |
|
72 |
-
|
73 |
python
|
74 |
musicgen_model = MusicGen.get_pretrained('facebook/musicgen-small', device=device)
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
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
|
92 |
-
- xAI for
|
93 |
|
94 |
-
|
|
|
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.
|