- Python 3.10+: Ensure Python is installed and accessible in your system
PATH. - FluidSynth (System Audio Library): REQUIRED for MIDI-to-Audio background rendering. You must install the system-level C library, not just the python package:
- macOS:
brew install fluidsynth(Note for Apple Silicon/M1+ users: Homebrew installs to/opt/homebrew/lib. If you run scripts outside ofapp.py, you may need to addexport DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/libto your~/.zshrcso Python can find it.) - Linux:
sudo apt install fluidsynth - Windows: Download the compiled release and add the
bindirectory to your SystemPATH.
- macOS:
- Google Gemini API Key: Visit the Google AI Studio to obtain an API key for access to
gemini-3.1-pro-previewandgemini-3.1-flash-lite-preview.
- Clone the repository.
- Create a virtual environment:
python -m venv .venv
- Activate the virtual environment:
- Windows (PowerShell):
.\.venv\Scripts\Activate.ps1
- macOS/Linux:
source .venv/bin/activate - Install Requirements:
Note: Ensure
pip install -r requirements.txt
musicpy,google-genai,flask,flask-cors,flasgger,pretty_midi, andaudioop-lts(for Python 3.13+ compatibility) are installed.
Set the GEMINI_API_KEY system environment variable before starting the app.
- Windows:
$env:GEMINI_API_KEY="YOUR_API_KEY_HERE"
- macOS/Linux:
export GEMINI_API_KEY="YOUR_API_KEY_HERE"
Soundfont Note:
The audio export mechanism relies on an .sf2 soundfont provided by pretty_midi. The system automatically resolves its dynamic path (e.g. pretty_midi/TimGM6mb.sf2) directly from the installed package.
Start the Flask development server from the root directory:
python app.pyWait a few seconds for the application bundle to load. Open a web browser and navigate directly to:
- Main App Interface:
http://127.0.0.1:8080/(Served dynamically by the Flask root route, no need for separate file hosting!) - Interactive API Docs (Swagger):
http://127.0.0.1:8080/apidocs/
