# MIDI Tools A web-based MIDI processing suite for analyzing, editing, and transforming MIDI files. Upload a MIDI file and apply various tools through an intuitive browser interface with full undo support. ## Features - **File Analysis** — Automatic breakdown of tracks, channels, tempo, time signature, and note/event counts - **Piano Roll** — Visual note display when clicking a track - **MIDI Playback** — In-browser playback with SoundFont support - **Track Editing** — Change channel assignment and instrument per track - **Track Management** — Delete or merge tracks - **Processing Tools:** - **Bake Tempo** — Flatten tempo changes into a fixed BPM - **Monofy** — Split polyphonic tracks into separate monophonic tracks - **Remove Redundancy** — Strip duplicate control changes and redundant messages - **Velocity Fix** — Remap note velocities into a target min/max range - **Convert to Type 0** — Merge all tracks into a single Type 0 MIDI file - **Undo History** — Every operation is undoable - **Download** — Export the edited MIDI file at any point ## Deploying with Docker ### Prerequisites - [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) ### Quick Start ```bash cd server docker compose up -d ``` The application will be available at **http://localhost:8000**. ### Build and Run Manually ```bash cd server docker build -t midiedit . docker run -d -p 8000:8000 --restart unless-stopped --name midiedit midiedit ``` ### Configuration | Variable | Default | Description | |----------|---------|-------------| | Port mapping | `8000:8000` | Change the first port to serve on a different host port (e.g. `80:8000`) | To change the port in `docker-compose.yml`: ```yaml services: midiedit: build: . ports: - "80:8000" restart: unless-stopped ``` ## Running without Docker ### Prerequisites - Python 3.10+ ### Setup ```bash cd server pip install -r requirements.txt uvicorn app.main:app --host 0.0.0.0 --port 8000 ``` ## Project Structure ``` server/ ├── Dockerfile ├── docker-compose.yml ├── requirements.txt └── app/ ├── main.py # FastAPI application entry point ├── routers/ │ └── session.py # Session-based API endpoints ├── core/ │ ├── analyze.py # MIDI file analysis │ ├── track_detail.py # Track detail + note extraction │ ├── baketempo.py # Bake tempo processor │ ├── monofy.py # Polyphonic-to-monophonic splitter │ ├── reduncheck.py # Redundancy removal │ ├── velfix.py # Velocity range remapper │ ├── type0.py # Type 0 converter │ ├── file_handling.py # MIDI load/save utilities │ └── midi_utils.py # Shared MIDI helpers └── static/ ├── index.html # Single-page application ├── app.js # Frontend logic └── style.css # Styles midi-tools/ # Original standalone CLI scripts ```