Simple, clean instrumental music generation with MusicGen
Project description
MusicGen Unified - v2.0
A clean, focused implementation of Facebook's MusicGen for instrumental music generation.
What This Is
- Simple: Just music generation, no unnecessary complexity
- Fast: GPU-optimized for 10x realtime generation
- Practical: CLI, API, and web interface included
- Deployable: One-click AWS deployment
What This Isn't
- Not for vocal/singing generation (MusicGen doesn't support it)
- Not a microservices architecture (it's a simple tool)
- Not a research framework (it's for practical use)
Quick Start
# Install
pip install musicgen-unified
# Generate music
musicgen generate "upbeat jazz piano" --duration 30
# Start web interface
musicgen serve
# Start API
musicgen api
Features
- ✅ Text-to-music generation
- ✅ Extended generation (>30 seconds)
- ✅ Batch processing from CSV
- ✅ GPU acceleration
- ✅ Web interface
- ✅ REST API
- ✅ AWS deployment ready
Installation
# Basic installation
pip install musicgen-unified
# With GPU support
pip install musicgen-unified[gpu]
# Development
git clone https://github.com/yourusername/musicgen-unified
cd musicgen-unified
pip install -e ".[dev]"
Usage
Command Line
# Basic generation
musicgen generate "smooth jazz saxophone" -o jazz.mp3
# Extended generation
musicgen generate "epic orchestral" --duration 120 -o epic.mp3
# Batch processing
musicgen batch playlist.csv --output-dir music/
Python API
from musicgen import MusicGenerator
# Initialize
generator = MusicGenerator(device="cuda")
# Generate music
audio, sample_rate = generator.generate(
"ambient electronic",
duration=30.0
)
# Save
generator.save_audio(audio, sample_rate, "output.mp3")
Web Interface
musicgen serve --port 8080
# Open http://localhost:8080
REST API
musicgen api --port 8000
# Generate music
curl -X POST http://localhost:8000/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "classical piano", "duration": 30}'
Deployment
Docker
docker build -t musicgen .
docker run -p 8080:8080 --gpus all musicgen
AWS
# Configure AWS credentials
aws configure
# Deploy
./deployment/deploy_aws.sh
Architecture
musicgen-unified/
├── musicgen/
│ ├── generator.py # Core generation with GPU optimization
│ ├── batch.py # Batch processing
│ ├── prompt.py # Prompt engineering
│ ├── api.py # FastAPI server
│ ├── cli.py # CLI interface
│ └── utils.py # Utilities
├── static/ # Web UI files
├── tests/ # Test suite
└── deployment/ # Deployment scripts
Performance
- GPU: 10x faster than realtime
- CPU: 1x realtime (approximate)
- Memory: <1GB base, ~4GB with large model
- Startup: <10 seconds
Models
small: Fast, lower quality (300M parameters)medium: Balanced (1.5B parameters)large: Best quality (3.3B parameters)
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE file for details.
Acknowledgments
- Facebook Research for MusicGen
- The open source community
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@example.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
musicgen_unified-2.0.0.tar.gz
(31.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file musicgen_unified-2.0.0.tar.gz.
File metadata
- Download URL: musicgen_unified-2.0.0.tar.gz
- Upload date:
- Size: 31.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ce71f9581d34ef5df55b4ef68434075d74a81c120d792fd408149c85bef624e
|
|
| MD5 |
f6c8ae37aff8010f6f1df09ecd956a49
|
|
| BLAKE2b-256 |
8ca336da10359fa3ca0b2728981b87f14e8b48ef9011021a735e9131baf3d9bd
|
File details
Details for the file musicgen_unified-2.0.0-py3-none-any.whl.
File metadata
- Download URL: musicgen_unified-2.0.0-py3-none-any.whl
- Upload date:
- Size: 32.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa64c7b0f2c65100785f5fcb2a5d4b151525e898f390bbdac09359ef9825fa1a
|
|
| MD5 |
086753055670488d04610ee62cc384dc
|
|
| BLAKE2b-256 |
0ab3950f42a7e1b229973ff4e09100b46fcb268655085d09876edbc9f850591b
|