Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
@@ -10,5 +10,85 @@ pinned: false
|
|
10 |
license: apache-2.0
|
11 |
short_description: alot of local zero build
|
12 |
---
|
|
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|