This is a basic starter application for uploading an MP3 and getting an initial "rock-oriented" guitar output:
- Chord progression
- Riff note suggestions
- Simple tab-like mapping (string/fret pairs)
Analysis uses librosa (tempo, key, chords), onset + pitch tracking for riff notes, 16th-note quantization on the beat grid, and a global DP mapper with a user-selectable riff preset. A fallback path remains if decoding fails.
backend/- FastAPI service and upload analysis endpointfrontend/- static web UI for file upload and result display
- Create and activate a Python virtual environment.
- Install dependencies:
pip install -r backend/requirements.txt- Run the API server:
uvicorn backend.app.main:app --reload- Open the frontend in your browser:
- Option A: directly open
frontend/index.html - Option B: serve it locally using a static server
By default, the frontend calls http://127.0.0.1:8000.
This stack is a long-lived Python process with CPU-heavy analysis (librosa, NumPy, SciPy). A small EC2 or Lightsail VM is the straightforward option. AWS Lambda is a poor fit for multi‑MB uploads and multi‑second analysis jobs.
-
Instance — Ubuntu LTS or Amazon Linux 2023; t3.small or larger is a reasonable starting point. Open inbound 80 and 443 (or 8000 only while testing).
-
App — Clone the repo on the instance, create a virtual environment, then
pip install -r backend/requirements.txtfrom the project root. If wheels fail, you may need build tools (for examplecmake); see your platform’s Python packaging notes. -
Run — From the repository root:
uvicorn backend.app.main:app --host 0.0.0.0 --port 8000
Keep this running with systemd or another process supervisor (ad‑hoc: tmux / screen). The API serves the UI at
/(redirects to/frontend/index.html) and under/frontend/. -
HTTPS (recommended) — Put nginx, Caddy, or an Application Load Balancer in front and reverse‑proxy to
http://127.0.0.1:8000. -
Frontend API URL — In
frontend/index.html, setAPI_BASEto your public site origin (for examplehttps://your-domain.com). If the browser loads the UI from the same host and port as the API, you can usewindow.location.origininstead so you do not hardcode a URL. -
Persistence — Uploaded MP3s are stored under
backend/uploads/, and upload history SQLite lives underbackend/data/. Ensure the instance volume is large enough and backed up if you need uploads to survive redeploys.
Health check: GET /api/health returns {"status":"ok"}.
POST /api/upload
- Form-data field:
file(MP3 file) - Returns: JSON containing
file_id,filename,size_bytes
POST /api/analyze?file_id=<uploaded-id>&riff_preset=<preset>
- Analyzes a previously uploaded MP3 by
file_id - Optional
riff_preset:low_string_rock|mid_neck_rock|lead_solo(default:mid_neck_rock) - Returns: JSON including
tempo_bpm,key,chords,riff_notes,tab_suggestions,riff_preset, anddebugmetadata.
- Add job queue for larger files.
- Add editor UI for manually correcting tab suggestions.