MidiPilot — Your AI Copilot

MidiPilot is the AI brain embedded directly in MidiEditor AI. Open the sidebar panel, type what you want in plain English, and watch it compose, edit, transform, and analyze your MIDI data automatically.

MidiPilot Agent mode in action
MidiPilot Agent mode composing a full arrangement from a single prompt

Key Features

🎯 Agent Mode

Multi-step agentic loop — the AI calls tools iteratively, inspecting results between steps to build complex compositions from a single prompt.

Learn more →

💬 Simple Mode

Single request/response for quick edits, small transformations, and focused tasks without the overhead of multi-step planning.

Learn more →

🎮 FFXIV Bard Mode

Enforces Final Fantasy XIV Performance constraints — 8 tracks, monophonic, C3–C6 range, tonal drum conversion for MidiBard2 octets.

Learn more →

🔌 Multi-Provider

OpenAI, OpenRouter, Google Gemini, or any OpenAI-compatible endpoint. Bring your own API key.

Learn more →

🧠 Reasoning Support

Toggle thinking/reasoning for o-series and GPT-5.x models. Configurable effort from None to Extra High.

Learn more →

✏️ Custom System Prompts

Edit AI behavior per mode via the built-in editor. Export/import as JSON — no recompiling needed.

Learn more →

📜 Conversation History

Conversations auto-saved as JSON. Browse, search, and resume past sessions from the history menu.

Learn more →

⚡ Response Streaming

Simple mode streams text in real time via SSE. Watch the response appear word by word instead of waiting.

Learn more →

💾 Per-File AI Presets

Save model, provider, mode, and custom instructions per MIDI file. Auto-loaded when you open the file.

Learn more →

Chat Panel

The MidiPilot panel features a clean chat interface with context-aware track info, mode selection (Agent / Simple), and model switching — all accessible without leaving the editor.

MidiPilot chat panel MidiPilot with different provider
Docked panel with Gemini 2.5 Flash (left) — Gemini 3.1 Pro (right)

The input bar at the bottom provides quick access to everything you need:

MidiPilot input bar close-up
Agent/Simple mode toggle · FFXIV checkbox · Model selector · Reasoning level

Simple Mode (One-Shot)

Simple mode sends a single API call to the AI model containing your instruction, the current editor state, selected events, and surrounding musical context. The model responds with one complete answer — no follow-up calls, no iterative loop.

How It Works

  1. Your prompt is bundled with a JSON snapshot of the editor (cursor position, active track, tempo, time signature, selection, and ±5 measures of surrounding events)
  2. Everything is sent as one request to the model
  3. The model returns a single JSON response with one or more actions (edit, delete, create_track, set_tempo, etc.)
  4. MidiEditor executes all actions from that response at once

When to Use Simple Mode

Limitations

If MidiPilot detects a truncated response (finish_reason: "length"), it will display a warning suggesting you switch to Agent mode for the task.


Agent Mode (Multi-Step)

Agent mode is the powerhouse for complex compositions and large-scale edits. Instead of squeezing everything into one response, the AI works iteratively — planning, executing, inspecting, and adjusting across multiple API calls until the task is complete.

How It Works

  1. Your prompt is sent along with the system prompt and a set of 15 tools the model can call
  2. The model responds with one or more tool calls (e.g., create_track, insert_events, get_editor_state)
  3. MidiEditor executes each tool call and sends the results back to the model
  4. The model reviews the results, decides the next step, and issues more tool calls
  5. This loop continues until the model decides the task is complete (or the max steps limit is reached)

Why This Matters

Agent Steps Panel

During an Agent run, a collapsible Agent Steps panel appears below the chat showing real-time progress: each tool call, its parameters, and results. Step indicators use theme-aware colors that adapt to dark and light mode (⏳ pending, 🔄 active, ✅ done, ⚠ retrying, ❌ failed).

When to Use Agent Mode

Configuration

SettingDescription
Agent Max StepsMaximum tool calls per request (5–100, default 50). Increase for very large compositions.
Token LimitOptional output cap. Agent mode is less sensitive to this since each call is smaller, but very low limits can still truncate individual steps.

FFXIV Bard Mode

When the FFXIV checkbox is enabled, MidiPilot appends additional constraints to the system prompt that enforce Final Fantasy XIV Bard Performance rules. This works with both Simple and Agent mode.

Enforced Rules Overview

See FFXIV Prompt Examples for tested prompts.


Fix X|V Channels

The Fix X|V Channels tool provides a one-click, deterministic channel fixer that sets up the complete MidiBard2 channel mapping — no AI calls needed. Find it in the toolbar or via Tools → Fix X|V Channels.

👉 Full documentation: Fix X|V Channels — the 5-step algorithm, Rebuild vs Preserve modes, supported instruments, guitar variant switching, before/after screenshots, and tips.


Mode Comparison

FeatureSimple ModeAgent Mode
API Calls1 (one-shot)Multiple (iterative loop)
Tool AccessNone15 tools
Self-CorrectionNoYes — can inspect and fix
Token Limit RiskHigh for complex tasksLow — work is split
Truncation HandlingWarns, suggests Agent modePer-step, can continue
SpeedFast (single round-trip)Slower (multiple round-trips)
UI FeedbackStreaming text (real-time)Agent Steps panel (live)
UndoPer actionGranular — one Ctrl+Z per tool call
Ideal ForQuick edits, small changesComplex compositions, multi-track

Token Tracking & Context Window

MidiPilot tracks token usage per API call and per session, with automatic normalization across providers (OpenAI, Anthropic, Gemini). The token counter is displayed at the bottom of the chat panel:

<last call> | <session total>🔥 / <context window> [<limit>✂]

Context Window Management

When conversations grow long, MidiPilot automatically manages context to prevent exceeding the model’s limit:

Multi-Provider Token Normalization

Different providers report token usage in different formats. MidiPilot normalizes all of them:


AI Settings

Configure your AI connection from Settings → MidiPilot AI. Select a provider, enter your API key, choose a model, and customize behavior.

MidiPilot AI settings Connection test successful
Provider configuration — Connection test: ✅ Model: gemini-2.5-flash
SettingDescription
ProviderOpenAI, OpenRouter, Google Gemini, or Custom
Base URLAuto-filled per provider, or enter your own endpoint
API KeyYour provider API key — get one from OpenAI, OpenRouter, or Google Gemini
ModelDropdown of popular models + custom entry
Token LimitOptional cap on output tokens to control costs
ThinkingEnable reasoning for o-series and GPT-5.x models
Reasoning EffortNone / Low / Medium / High / Extra High
Context RangeMeasures before/after cursor sent as musical context (0–50)
FFXIV ModeEnable Bard Performance rule enforcement
Agent Max StepsMaximum tool calls per Agent request (5–100)
Test ConnectionVerify your API key and model work correctly

Custom System Prompts

Click Edit System Prompts… in settings to open the built-in editor. Each mode (Simple, Agent, FFXIV, FFXIV Compact) has its own tab with fully customizable instructions.

System Prompt Editor
Built-in System Prompt Editor with tab-based mode selection

Prompts are saved as system_prompts.json in the application directory. If no custom file exists, MidiPilot uses the hardcoded defaults.


Auto-Save

MidiEditor AI automatically saves a backup copy of your work at regular intervals, so you never lose progress to a crash or accidental close. Your original file is never overwritten — the backup is stored as a separate .autosave sidecar file alongside your MIDI file.

How It Works

Crash Recovery

Settings

Auto-save options are in Settings → System & Performance:

Auto-Save settings in System & Performance
Auto-Save settings with enable toggle and interval configuration
SettingDescription
Enable auto-saveToggle automatic backups on or off (default: on)
Save after idle (seconds)Seconds of inactivity before a backup is written (30–600, default: 120)

AI Tools Reference

In Agent mode, the AI has access to 15 tools (12 base + 3 FFXIV-specific) for inspecting and modifying MIDI files:

ToolDescription
get_editor_stateRead file info, tracks, tempo, time signature, cursor position
get_track_infoGet detailed info for a specific track (channel, event count, note range)
create_trackCreate a new MIDI track
rename_trackRename an existing track
set_channelSet the MIDI channel for a track
insert_eventsAdd new MIDI events (notes, control changes, etc.)
replace_eventsModify existing events in a range
delete_eventsRemove events by index
query_eventsRead events in a tick range on a track
move_events_to_trackMove events between tracks
set_tempoChange the tempo (BPM)
set_time_signatureChange the time signature
setup_channel_patternAuto-configure MidiBard2 channel mapping (FFXIV)
convert_drums_ffxivConvert GM drum kit to FFXIV-compatible tone-mapped notes
validate_ffxivCheck FFXIV Bard Performance rule compliance

Supported Providers

ProviderBase URLAPI KeyFree Tier
OpenAIapi.openai.com/v1Get API Key →Limited
OpenRouteropenrouter.ai/api/v1Get API Key →Free models available
Google Geminigenerativelanguage.googleapis.comGet API Key →15 RPM, 1M TPM
CustomUser-specifiedUser-specifiedVaries

Getting Started

  1. Open Settings (gear icon or Edit → Settings) and click the MidiPilot AI tab
  2. Select your Provider (Google Gemini is a great free option)
  3. Enter your API Key (get one from OpenAI, OpenRouter, or Google Gemini)
  4. Choose a Model (e.g., gemini-2.5-flash)
  5. Click Test Connection to verify everything works
  6. Close settings and open the MidiPilot panel from the sidebar
  7. Type a prompt and press Enter:
"Create an 8-bar jazz waltz in Bb major with piano, bass, and drums"

The AI will compose the requested music directly into the editor using its built-in tools. In Agent mode, it works iteratively — creating tracks, setting tempo, inserting notes, and validating the result step by step.

See Prompt Examples for more real-world prompts and a full demo.


Conversation History

MidiPilot automatically saves every conversation as a JSON file. You can browse, search, and resume past sessions at any time.

How It Works

Conversation File Format

Each conversation is stored as a single JSON file containing the full message history, model/provider info, token usage, and the associated MIDI file path. Files are human-readable and can be exported or shared.

Conversation history dropdown menu

Response Streaming

In Simple mode, MidiPilot uses Server-Sent Events (SSE) to stream text responses in real time. Instead of waiting for the entire response to complete, you see text appear word by word as the model generates it.

How It Works

When Streaming Is Used

ModeStreamingReason
Simple — text response✅ YesReduces perceived latency
Simple — JSON actions❌ NoNeeds complete JSON to execute
Agent — tool calls❌ NoTool call JSON must be complete
Streaming response in action

Per-File AI Presets

Different MIDI files may need different AI settings. A 16-track orchestral arrangement needs different guidance than a 3-track FFXIV bard song. Per-file presets let you save and auto-load settings for each file.

What’s Saved

How to Use

  1. Click the ⚙ gear button in the MidiPilot footer
  2. Select “Save AI preset for this file”
  3. The current settings are saved as a .midipilot.json sidecar file next to your MIDI file
  4. Next time you open that MIDI file, the preset is auto-loaded
Gear menu with Save AI preset option
Preset saved confirmation Preset auto-loaded on file reopen

Sidecar File

Presets are stored as <filename>.midipilot.json next to the MIDI file. For example:

Sweet Child O Mine.mid
Sweet Child O Mine.mid.midipilot.json   ← preset

The preset file is a simple JSON object. All fields are optional — any field not present falls back to the global default.


API Log

MidiPilot writes every API request and response to a log file for debugging and transparency. The log is saved as midipilot_api.log in the same directory as the MidiEditor AI executable.

DetailDescription
Locationmidipilot_api.log next to the .exe
FormatISO-8601 timestamp + direction ([REQUEST] / [RESPONSE]) + JSON body
Cleared onStarting a new chat or loading a different MIDI file — the previous log is overwritten
Manual clearDelete the file — it will be recreated on the next API call

If the AI produces unexpected results, open the log to inspect the raw JSON sent to and received from the provider. This is especially useful for debugging tool-call sequences in Agent mode.