An intelligent music mixing tool that uses AI to discover, analyze, and blend royalty-free music into seamless mixes. Perfect for content creators, DJs, and music enthusiasts who want to create professional-quality mixes without manual effort.
- π€ AI-Powered: Uses GPT-4 to understand your mix requirements and make creative decisions
- π΅ Music Discovery: Automatically finds royalty-free tracks from multiple sources
- π Audio Analysis: Analyzes tempo, key, mood, and optimal mixing points
- ποΈ Smart Mixing: Creates seamless transitions with crossfading and beat matching
- π Iterative Improvement: Gets AI feedback and automatically improves mixes
- π¦ Complete Export: Generates final mix with metadata, reports, and reproducible code
git clone https://github.com/yourusername/ai-music-mixer.git
cd ai-music-mixer
chmod +x setup.sh
./setup.sh
- Edit
.env
file and add your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_here
- Optionally add music service API keys for more sources:
JAMENDO_CLIENT_ID=your_jamendo_client_id
FREESOUND_API_KEY=your_freesound_api_key
# Create a mix from a description
python cli.py "Create a dreamy ambient mix for sunset meditation"
# Specify duration
python cli.py "Upbeat electronic workout mix" --duration 10
# Interactive mode
python cli.py --interactive
# Get suggestions
python cli.py --suggest --mood "chill" --genre "lofi"
from agent.orchestrator import create_music_mix
result = create_music_mix(
prompt="Create a progressive house mix with building energy",
max_duration_minutes=8
)
if result['status'] == 'completed':
print("Mix created successfully!")
-
Understanding: AI analyzes your prompt to understand mood, genre, energy, and style requirements
-
Discovery: Searches royalty-free music APIs for suitable tracks based on your requirements
-
Analysis: Uses librosa and custom algorithms to analyze:
- Tempo and beat structure
- Musical key and harmony
- Energy levels and mood
- Optimal mixing points
-
Generation: Creates initial mix using PyDub with:
- Smart track ordering
- Crossfading and beat matching
- EQ adjustments
- Volume normalization
-
Improvement: AI reviews the mix and applies improvements:
- Analyzes transition quality
- Adjusts timing and levels
- Refines overall flow
-
Export: Produces final package with:
- High-quality MP3/WAV file
- Detailed metadata
- Generation report
- Reproducible PyDub script
ai-music-mixer/
βββ agent/
β βββ orchestrator.py # Main AI orchestration
βββ tools/
β βββ music_discovery.py # Music search and download
β βββ audio_analysis.py # Audio feature extraction
β βββ mix_generation.py # PyDub mixing engine
β βββ iterative_feedback.py # AI feedback system
β βββ final_export.py # Export and packaging
βββ config.py # Configuration management
βββ cli.py # Command line interface
βββ main.py # Entry point
OPENAI_API_KEY
- Required for AI functionalityJAMENDO_CLIENT_ID
- Optional, for Jamendo music sourceFREESOUND_API_KEY
- Optional, for Freesound effectsMUSIC_DIR
- Directory for downloaded music (default: ./music_files)EXPORTS_DIR
- Directory for final exports (default: ./exports)TEMP_DIR
- Temporary files directory (default: ./temp)
Default settings in config.py
:
- Sample Rate: 44.1kHz
- Channels: Stereo
- Export Format: MP3 320kbps
- Analysis Window: 2048 samples
python cli.py "Create an intense 45-minute workout mix starting with warm-up beats, building to high-energy electronic, and ending with cool-down ambient"
python cli.py "Peaceful lo-fi hip hop mix for 2-hour study session with consistent energy and no jarring transitions"
python cli.py "Upbeat dance mix for house party - progressive energy, crowd favorites, seamless mixing" --duration 30
Creates a complete mix from a text description.
Generates creative mix prompt suggestions.
music_discovery_tool()
- Search and download musicaudio_analysis_tool()
- Analyze single audio filebatch_audio_analysis_tool()
- Analyze multiple filesmix_generation_tool()
- Generate mix with PyDubiterative_feedback_tool()
- Get AI feedbackfinal_mix_export_tool()
- Export with metadata
-
"No OpenAI API key"
- Add your API key to
.env
file - Ensure you have credits in your OpenAI account
- Add your API key to
-
"No music found"
- Try different search terms
- Add music service API keys for more sources
- Check internet connection
-
"Audio analysis failed"
- Ensure audio files are valid
- Install additional audio codecs if needed
- Check file permissions
-
"Mix generation failed"
- Verify PyDub installation
- Check available disk space
- Ensure temp directory is writable
If you encounter issues with audio processing:
# Ubuntu/Debian
sudo apt-get install ffmpeg libsndfile1
# macOS
brew install ffmpeg libsndfile
# Windows
# Download ffmpeg and add to PATH
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details.
- OpenAI for GPT-4 API
- PyDub for audio processing
- Librosa for audio analysis
- Jamendo and Freesound for royalty-free music
- π§ Email: [email protected]
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Wiki: GitHub Wiki
Happy Mixing! π΅# aidj