SA
Sami210105/moodify-ai
AI-based music mood generation and remix system using MusicGen
๐ต Moodify AI
AI-powered music generation and remixing platform that creates and transforms audio based on moods and genres.
โจ Features
- ๐ผ Generate Music - Create original tracks from mood, genre, and text prompts
- ๐ Remix Audio - Transform existing audio to match different moods
- ๐ Analyze Audio - Extract detailed audio features and characteristics
- ๐จ Beautiful UI - Intuitive Streamlit interface with custom styling
๐ Quick Start
# Clone and setup
git clone https://github.com/yourusername/moodify-ai.git
cd moodify-ai
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
# Terminal 1 - Start Backend
cd backend
uvicorn main:app --reload --host 127.0.0.1 --port 8000
# Terminal 2 - Start Frontend
cd frontend
streamlit run app.pyOpen http://localhost:8501 in your browser.
๐ Project Structure
moodify-ai/
โโโ backend/
โ โโโ main.py # FastAPI server
โ โโโ requirements.txt #backend-only
โโโ frontend/
โ โโโ app.py # Streamlit UI
โโโ requirements.txt # Dependencies frontend-only
โโโ venv/ # Virtual environment
๐ง Tech Stack
- Backend: FastAPI, PyTorch, Transformers (MusicGen), Librosa
- Frontend: Streamlit, Matplotlib
- Audio: Librosa, SoundFile, NumPy
๐ก API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/generate |
POST | Generate new music |
/remix |
POST | Remix existing audio |
/analyze |
POST | Analyze audio features |
/moods |
GET | List available moods |
API docs: http://localhost:8000/docs
๐ฎ Usage
Generate Music:
- Select mood and genre
- Add text description (optional)
- Set duration (5-30 seconds)
- Click "Generate Music"
Remix Audio:
- Upload audio file (WAV/MP3/OGG)
- Choose target mood
- Click "Remix Audio"
Analyze Audio:
- Upload audio file
- Click "Analyze Audio"
- View extracted features
โ ๏ธ Important Notes
- First run downloads MusicGen model (~2.5 GB) - cached for reuse
- Backend must run before frontend
- FFmpeg required for audio processing
- GPU recommended for faster generation
๐ Troubleshooting
Connection refused: Ensure backend is running on port 8000
Module not found: Activate venv and reinstall: pip install -r requirements.txt
Slow generation: Normal on CPU (2-5 min). Use GPU for faster results (10-30s)
Requirements Structure
The project uses separate dependency files for frontend and backend.
- Root
requirements.txtโ Frontend (Streamlit Cloud) backend/requirements.txtโ Backend (FastAPI + MusicGen)
This separation avoids cloud deployment limitations and follows standard ML system design.
For technical documentation, see DOCUMENTATION.md