Local Python runs on the same computer as your browser. Follow the macOS, Windows (PowerShell), or Linux instructions below. Set it up once; if already installed, jump to step 3.
How the browser communicates with Python
Uvicorn runs the local FastAPI HTTP service. The browser sends audio with POST /api/analyze (multipart/form-data), receives JSON results, then downloads MIDI with GET /api/download/{token}. Audio is sent only to the service on this computer.
1. Prepare your project folder
Download or clone the complete project, including web_app.py and requirements.txt. Open Terminal on macOS/Linux or PowerShell on Windows, then run cd "path/to/music-detection" with your actual folder path. Run all commands from that folder.
2. Install Python dependencies once
Choose your operating system below. Use Python 3.12 in the project's .venv; these commands preserve an existing environment. Wait for installation to finish. After installing tools, reopen your terminal and return to the project folder before continuing.
macOS
With Homebrew installed, install the required tools:
brew install uv ffmpeg git
Homebrew installation guide ↗Reopen your terminal, return to the project folder, then run:
uv python install 3.12
test -d .venv || uv venv --python 3.12 .venv
uv pip install --python .venv/bin/python -r requirements.txt
Windows 10/11 · PowerShell
Install uv, Git, and FFmpeg with WinGet. If winget is unavailable, install or update App Installer using the Microsoft guide below.
winget install --id astral-sh.uv -e
winget install --id Git.Git -e
winget install --id Gyan.FFmpeg -e
Microsoft / WinGet ↗Reopen your terminal, return to the project folder, then run:
uv python install 3.12
if (-not (Test-Path .venv)) { uv venv --python 3.12 .venv }
uv pip install --python .\.venv\Scripts\python.exe -r requirements.txt
Linux · Ubuntu / Debian
These commands are for Ubuntu/Debian. On other distributions, install git, curl, and ffmpeg with your package manager, then install uv.
sudo apt update
sudo apt install -y git curl ffmpeg
curl -LsSf https://astral.sh/uv/install.sh | sh
Reopen your terminal, return to the project folder, then run:
uv python install 3.12
test -d .venv || uv venv --python 3.12 .venv
uv pip install --python .venv/bin/python -r requirements.txt
uv / Python ↗
3. Start the local service
Run the command for your operating system. On macOS you can also double-click start_ui.command in Finder. You only need to start the service each time; no dependency reinstall or virtual environment activation is required.
macOS / Linux
.venv/bin/python -m uvicorn web_app:app --host 127.0.0.1 --port 8765
Windows · PowerShell
.\.venv\Scripts\python.exe -m uvicorn web_app:app --host 127.0.0.1 --port 8765
The service is ready when Terminal shows:
Uvicorn running on http://127.0.0.1:8765
Keep that Terminal window open while analyzing. Press Control + C in that window when you want to stop the service.
4. Return here and analyze
Select Local Python and add an audio file to start whole-track analysis automatically. To analyze a clip, adjust the range and press Analyze selected range. Switching engines analyzes the current range. After starting the service, press Analyze again to retry a failed attempt.
Beat/key weights download on first use. Standard mode uses the bundled GAME Small model. Enabling enhanced mode downloads htdemucs and GAME Large (about 568 MB extra). After updating, reinstall requirements.txt and restart FastAPI. Temporary audio is deleted after analysis; MIDI downloads last up to one hour.
Open the local service page ↗That page also defaults to Browser ONNX. Select Local Python there if you want to use the Python service.
The service has been tested locally on macOS. These Windows and Linux setup instructions have not yet been verified end to end on those systems.
Still unable to connect?
- Connection failed: check that the service is running on this computer at port 8765. Open the local service page above. If it does not open, check the Terminal error first. You can switch to Browser ONNX while resolving the issue.
- ModuleNotFoundError or a missing .venv: complete step 2. Use .venv/bin/python on macOS/Linux or .\.venv\Scripts\python.exe on Windows. If requirements.txt is missing, return to the project folder in step 1.
- FFmpeg not found: install it using the commands for your OS in step 2, reopen the terminal, and check ffmpeg -version. Address already in use means port 8765 is occupied; use the running service or stop its terminal session with Control + C before restarting.
Connecting from GitHub Pages or another website
Allow your site's exact origin when starting the local service. Replace YOUR-NAME with your GitHub account; do not include the repository path. If the service is already running, stop it first and restart with this setting.
macOS / Linux
TEMPO_ALLOWED_ORIGINS=https://YOUR-NAME.github.io .venv/bin/python -m uvicorn web_app:app --host 127.0.0.1 --port 8765
Windows · PowerShell
$env:TEMPO_ALLOWED_ORIGINS="https://YOUR-NAME.github.io"
.\.venv\Scripts\python.exe -m uvicorn web_app:app --host 127.0.0.1 --port 8765
Your browser may restrict access from a website to a local service. If blocked, use the local service page or Browser ONNX. Online GitHub Pages access has not been verified for this project.