Skip to main content
Glama
README.md
# FL Studio AI Assistant β€” Claude & Antigravity MCP Server, Voice Control, Vocal Coach and Mix Analyzer for FL Studio

**Control FL Studio with AI.** Talk to FL Studio hands-free ("Hey Studio, record track 2"), let Claude or Antigravity drive the mixer, plugins and Channel Rack through MCP, get a singing **timing and pitch coach**, check your mix against **Spotify / Apple Music / YouTube loudness (LUFS)**, and build **beats, chords and melodies as MIDI**. It's free, it runs locally on Windows, and the router handles common commands without using any AI tokens.

![Python](https://img.shields.io/badge/python-3.11%2B-blue)
![Platform](https://img.shields.io/badge/platform-Windows%2010%20%7C%2011-lightgrey)
![MCP](https://img.shields.io/badge/MCP-Claude%20%7C%20Antigravity%20%7C%20Cursor-purple)
![FL Studio](https://img.shields.io/badge/FL%20Studio-MIDI%20scripting-orange)

> **In one sentence:** a local Python bridge that connects AI assistants (Claude Desktop, Claude Code, Antigravity, Cursor, ChatGPT actions, or any CLI agent) to **FL Studio** over virtual MIDI (loopMIDI), with audio analysis and music tools built in.

---

## Table of Contents
- [Features](#features)
- [Requirements](#requirements)
- [Quick Install (1 click)](#quick-install-1-click)
- [Manual Install](#manual-install)
- [FL Studio Setup (5 minutes)](#fl-studio-setup-5-minutes)
- [Connect Claude, Antigravity or Cursor (MCP)](#connect-claude-antigravity-or-cursor-mcp)
- [How to Use](#how-to-use)
  - [Web dashboard](#1-web-dashboard)
  - [Voice control: "Hey Studio"](#2-voice-control-hey-studio)
  - [Talk to Claude / Antigravity](#3-talk-to-claude--antigravity)
  - [Command line (CLI)](#4-command-line-cli)
  - [REST API & WebSocket](#5-rest-api--websocket)
- [Recipes](#recipes)
- [Safety](#safety)
- [Troubleshooting & FAQ](#troubleshooting--faq)
- [How It Works](#how-it-works)
- [Disclaimer](#disclaimer)

---

## Features

**πŸŽ›οΈ FL Studio control (two-way, live)**
- Transport: play, stop, record, undo, save, metronome, count-in, loop mode, song position, pattern jump, **replay from the start**.
- Mixer: select, arm, mute, solo, volume, pan and routing for any of the 126 inserts. Channel Rack: select, mute, solo, volume, pan.
- **Live FL state** (tempo, time signature, playing/recording, track, pattern, peaks) streamed back from FL Studio over SysEx.
- `record`, `undo` and `save` always ask for confirmation first.

**🎚️ Stock plugin control by name**
- Say what you mean instead of guessing parameter numbers: *"cut 300 Hz by βˆ’3 dB on Parametric EQ 2"*, *"Maximus low band mono"*, *"Limiter ceiling βˆ’1 dB"*, *"Reeverb 2 pre-delay 30 ms"*.
- Supports **Fruity Parametric EQ 2, Fruity Limiter, Maximus, Fruity Reeverb 2 and WaveShaper**. It reads the real parameter names from FL and calibrates values against FL's own display.

**🎀 Singing coach (any time signature)**
- Separates **recording latency** (the whole take late by e.g. 35 ms) from **real rushing or dragging** in specific bars.
- Grades pitch in **cents** for every note.
- Recommends the best fix: clip nudge, **NewTime**, **NewTone / Pitcher**, or punch-in re-record.
- Works in 4/4, 3/4, 6/8, 12/8, 5/4 and 7/8, with straight and triplet grids, and estimates **BPM + time signature from an a-cappella vocal**.
- **Melody β†’ MIDI + key detection**, so Claude can write matching piano, strings and vocal harmony.

**πŸ₯ Beat, chord and melody builder**
- Drum step patterns written straight into the Channel Rack (`x...x...x...x...`).
- Live note audition into the selected instrument, plus multi-track **`.mid` export** (chords, melodies, 808s, drums).

**πŸ“Š Mixing & mastering analyzer**
- ITU-R BS.1770-4 **LUFS**, 4Γ— oversampled **True Peak**, crest factor, stereo correlation, sub-bass mono check and 6-band balance.
- Distribution check for **Spotify, Apple Music, YouTube, TikTok/Reels, club and EBU R128**, with fixes using FL Studio stock plugins.
- Reads 8/16/24/32-bit PCM and 32/64-bit **float WAV** (FL renders).
- Auto-analyses every new take in FL's `Audio\Recorded` folder (read-only). Optional live master meter via WASAPI loopback.

**πŸ—£οΈ Hands-free and AI**
- Offline wake word **"Hey Studio"** (faster-whisper). While FL is recording it only accepts "stop" or "cut", so singing never triggers a command.
- A **zero-token local router** handles common commands instantly. Anything else goes to Claude or Antigravity as a compact packet of at most 300 tokens.
- Sound and room physics tools: room modes, SBIR, comb filtering, latency, and a BPM-to-milliseconds delay/reverb grid.
- Built-in knowledge base for FL Studio, mixing, mastering, DJing, instruments and music theory.

---

## Requirements
| Need | Notes |
|---|---|
| Windows 10 / 11 | Uses Windows MIDI (winmm) and the registry |
| [Python 3.11+](https://www.python.org/downloads/) | `winget install Python.Python.3.13` |
| [FL Studio](https://www.image-line.com/) 20.7+ | Needs MIDI scripting support; newer versions unlock more features |
| [loopMIDI](https://www.tobias-erichsen.de/software/loopmidi.html) (free) | Creates the virtual MIDI cables. `winget install TobiasErichsen.loopMIDI` |
| Optional | A microphone for voice control and the mic check |

---

## Quick Install (1 click)
1. **Download** this repository (green **Code** button β†’ *Download ZIP*) and unzip it, or:
   ```powershell
   git clone https://github.com/thecrystoria-svg/fl-studio-assistant.git
   cd fl-studio-assistant
   ```
2. **Double-click `install.bat`.** It will:
   - find Python 3.11+ and create a private `.venv`;
   - install the assistant (and ask about the optional voice and loopback features);
   - offer to install loopMIDI;
   - copy the FL Studio controller script into `Documents\Image-Line\FL Studio\Settings\Hardware\FLAssistant\`;
   - offer to register the MCP server in Claude Desktop, Claude Code and Antigravity (your existing configs are backed up as `.bak`).
3. Do the [FL Studio Setup](#fl-studio-setup-5-minutes) below, then **double-click `start-dashboard.bat`**.

> Install everything without questions: `powershell -ExecutionPolicy Bypass -File .\install.ps1 -Voice -Loopback -Yes`

## Manual Install
```powershell
python -m venv .venv
.\.venv\Scripts\activate
pip install -e .                 # core
pip install -e ".[voice]"         # optional: offline "Hey Studio" (faster-whisper)
pip install -e ".[loopback]"      # optional: live master metering (pyaudiowpatch)
python -m fl_assistant.installer  # copies the FL controller script
python -m fl_assistant.cli connect-ai --apply   # optional: register in Claude/Antigravity
```

---

## FL Studio Setup (5 minutes)
1. Open **loopMIDI** and create two ports named exactly **`FLA-Cmd`** and **`FLA-State`**. Keep loopMIDI running.
2. Make sure the script is installed (`install.bat` did it). Otherwise run `python -m fl_assistant.installer`.
3. In **FL Studio β†’ Options β†’ MIDI Settings (F10)**:
   - **Input:** select `FLA-Cmd` β†’ **Enable** β†’ Controller type **`FL Studio AI Assistant`**.
   - **Output:** select `FLA-State`.
   - Give the input and output the **same Port number** (for example 10).
4. Check it works:
   ```powershell
   .\.venv\Scripts\python -m fl_assistant.cli state
   ```
   You should see `"connected": true` and your project tempo.

> One port only? A single loopMIDI port (e.g. `FLAssistant`) still works for one-way control. Live state, ACKs and plugin discovery need both ports.

---

## Connect Claude, Antigravity or Cursor (MCP)
The quickest way is `python -m fl_assistant.cli connect-ai --apply`, or the **Connect Claude & Antigravity** button in the dashboard. Then restart the app.

To set it up by hand, add this to your MCP config (`claude_desktop_config.json`, `~/.gemini/antigravity/mcp_config.json`, Cursor, VS Code, etc.):
```json
{
  "mcpServers": {
    "fl-studio-assistant": {
      "command": "C:\\path\\to\\fl-studio-assistant\\.venv\\Scripts\\python.exe",
      "args": ["-m", "fl_assistant.mcp_server"],
      "cwd": "C:\\path\\to\\fl-studio-assistant"
    }
  }
}
```
Run `python -m fl_assistant.cli connectors` to print ready-made configs with your real paths, including HTTP/SSE MCP and OpenAPI.

**MCP tools (37):** `fl_state`, `fl_transport`, `fl_mixer`, `fl_channel`, `fl_plugin_param`, `fl_replay`, `fl_plugin_maps`, `fl_discover_plugin`, `fl_set_plugin_semantic`, `fl_drum_pattern`, `fl_play_notes`, `export_midi`, `coach_vocal_take`, `extract_melody`, `estimate_tempo_meter`, `analyze_audio_file`, `check_distribution`, `watch_recorded_takes`, `live_meter_status`, `realtime_command`, `escalation_packet`, `test_microphone`, `get_studio_brief`, `check_fl_setup`, `install_fl_controller_script`, `calc_room_modes`, `calc_wave_and_sbir`, `calc_comb_filter`, `calc_digital_audio_latency`, `calc_bpm_timing`, `calc_mic_physics`, `list_audio_skills`, `get_audio_skill`, `search_audio_skills`, `get_ai_connection_configs`, `connect_claude_and_antigravity`, `get_fl_safety_policy`.
**Resources:** `fl://state`, `fl://brief`, `fl://safety-policy`, `fl://knowledge/{topic}`. **Prompts:** `studio_recording_session`, `mix_master_and_distribute`.

---

## How to Use

### 1. Web dashboard
Double-click `start-dashboard.bat` (or run `python -m fl_assistant.server`) and open **http://127.0.0.1:8765**.
- **Setup doctor:** checks FL Studio, ASIO, audio devices and the two MIDI ports, with exact fix steps.
- **Live FL state** and **Replay from start**.
- Transport and mixer buttons. Record ON, Undo and Save ask "are you sure?".
- **Mix / Master / Distribution check:** drop an exported `.wav`.
- **Singing coach / melody / tempo:** drop a vocal take.
- **Beat & chord builder:** write drum steps, or export chords and a melody to `.mid`.
- **Talk box:** type or speak commands (the router uses no AI tokens).

### 2. Voice control: "Hey Studio"
```powershell
.\start-voice.bat          # or: python -m fl_assistant.cli voice --device-id 0
```
Say **"Hey Studio"** followed by a command:

| Say | What happens |
|---|---|
| "Hey Studio, play" / "stop" / "replay" | Transport (replay = jump to start + play) |
| "Hey Studio, record track 2" β†’ "confirm" | Arms insert 2 and records (asks first) |
| "Hey Studio, cut" | Stops recording (works while recording) |
| "Hey Studio, mute track 3" / "solo track 1" | Mixer |
| "Hey Studio, set track 4 volume to 70%" | Mixer volume |
| "Hey Studio, save" β†’ "yes" | Saves the project (asks first) |
| "Hey Studio, undo" β†’ "confirm" | Undo (asks first) |
| "Hey Studio, what's the tempo?" | Reads live FL state |
| "Hey Studio, bpm 140" | Delay/reverb times for 140 BPM |
| "Hey Studio, check mic" | 1.2 s level test with advice |

While FL Studio is **recording**, only a clear "stop" or "cut" is accepted, and spoken replies are muted so they never end up in your take. The first run downloads the `tiny.en` speech model (about 75 MB) once.

### 3. Talk to Claude / Antigravity
Once connected over MCP, just ask in plain English:
- *"What's playing in FL right now?"* β†’ `fl_state`
- *"Coach my vocal take C:\Takes\verse.wav at 92 BPM in 6/8."* β†’ timing offset vs rushing bars, pitch in cents, recommended fix
- *"Extract the melody and key from hook.wav and write a piano + strings part that fits."* β†’ notes + key + diatonic chords β†’ `export_midi`
- *"Make a trap beat on channels 0–2 and an 808 in F minor."* β†’ `fl_drum_pattern` + `export_midi`
- *"Cut the mud around 300 Hz by 3 dB on insert 4, EQ in slot 1."* β†’ `fl_set_plugin_semantic`
- *"Is my master ready for Spotify?"* β†’ `check_distribution`

### 4. Command line (CLI)
Run everything as `python -m fl_assistant.cli <command>` (or `fl-assistant-cli <command>`). Output is JSON.

| Command | Example |
|---|---|
| Setup status | `brief`, `doctor`, `state` |
| Natural command | `talk "mute track 3"` |
| Transport | `transport play` Β· `transport record --confirm` Β· `transport save --confirm` Β· `replay` |
| Mixer / channel | `mixer 3 volume --value 0.7` Β· `channel 2 mute` |
| Analyze a mix | `analyze mix.wav --mode master` Β· `distribute master.wav --platform spotify` |
| Singing coach | `coach verse.wav --bpm 92 --meter 6/8` |
| Melody + key | `melody hook.wav --bpm 120` |
| Tempo + meter | `tempo acapella.wav` |
| Drums | `drums 0 "x...x...x...x..."` |
| Export MIDI | `export-mid idea --chords "Am F C G" --melody "E4:1 G4:1 A4:2" --bpm 90` |
| Watch takes | `watch` (analyses each new recording in FL's `Audio\Recorded`) |
| Voice | `voice --device-id 0` |
| Physics | `acoustics room-modes 4.2 3.5 2.6` Β· `acoustics bpm 128` |
| Knowledge | `knowledge search "808 on phone speakers"` |
| MIDI daemon | `pitcherd` (optional: runs the single MIDI owner in the foreground) |

Drum pattern symbols: `X` accent, `x` hit, `o` ghost, `.` rest (1–64 steps). Melody format: `C4:1 E4:0.5 r:0.5 G4:2` (note:beats, `r` = rest). Exported `.mid` files go to `%LOCALAPPDATA%\FLAssistant\exports`; drag them into the Playlist or Piano roll.

### 5. REST API & WebSocket
Interactive docs: **http://127.0.0.1:8765/docs** (OpenAPI schema at `/openapi.json`). Highlights:
`GET /api/state` Β· `POST /api/fl/transport` (`{"action":"save","confirm":true}`) Β· `POST /api/fl/replay` Β· `POST /api/fl/drums` Β· `POST /api/fl/notes` Β· `POST /api/fl/plugins/discover` Β· `POST /api/fl/plugins/semantic` Β· `POST /api/export/mid` Β· `POST /api/coach` Β· `POST /api/melody` Β· `POST /api/tempo` Β· `POST /api/analyze` Β· `POST /api/distribute` Β· `POST /api/takes/watch` Β· `POST /api/escalation` Β· WebSocket `/ws/realtime?token=…` (the token is printed when the server starts).

---

## Recipes
**Fix a late vocal take**
1. Record. The take watcher (or `cli coach take.wav --bpm <tempo>`) reports, for example, `offset_ms: 35, rushing_bars: []`.
2. The plan says `clip_offset_nudge, shift_ms: -35`. Nudge the clip 35 ms earlier, or set the insert's recording latency compensation, and you're done. That was latency, not your timing.
3. If it shows `rushing_bars: [3]` instead, fix those bars in **NewTime**. If pitch shows `+30 cents`, use **NewTone** or **Pitcher**.

**Write accompaniment for a sung idea**
`melody idea.wav` β†’ key `A minor`, notes, diatonic chords `Am Bdim C Dm Em F G` β†’ ask Claude for piano + strings β†’ `export_midi` β†’ drag the `.mid` into FL.

**Loudness check before release**
Export a 24-bit or float WAV β†’ `distribute master.wav --platform all` β†’ follow the Fruity Limiter / Maximus suggestions (aim for βˆ’1 dBTP).

---

## Safety
- **Your FL user content is writable:** projects (`.flp`), presets (`.fst`/`.fsc`/`.fnv`), templates and `Settings\Hardware` under `Documents\Image-Line\FL Studio`.
- **FL Studio's program installation is protected:** `Program Files\Image-Line`, `Program Files (x86)\Image-Line`, a custom install folder, and every `.exe`, `.dll`, `.vst`, `.vst3`, `.scr`.
- **How it's enforced:** a runtime Python audit hook (`sys.addaudithook`), a single sanctioned writer (SafeIO), and a test that scans the code for any other file write.
- **Confirmation:** `record`, `undo` and `save` always need an explicit "confirm" / `confirm=true`. Questions ("should I save?") and negatives ("don't record yet") never trigger anything.
- **Network:** the dashboard only answers on localhost, rejects cross-site requests, limits uploads (`FLA_MAX_UPLOAD_MB`, default 256) and protects the WebSocket with a per-run token.
- **Self-healing mix tweaks:** at most 1 dB per step, at least 2 s apart, never boosts, and ignore invalid meter readings.

---

## Troubleshooting & FAQ
**`"connected": false` / "No telemetry"**
Check that loopMIDI is running with both `FLA-Cmd` and `FLA-State`. In F10, the input must be enabled with Controller type *FL Studio AI Assistant*, the output set to `FLA-State`, and **both on the same Port number**. Run `cli doctor` for exact steps.

**"No loopMIDI / FLAssistant virtual MIDI port detected"**
Install loopMIDI and create the two ports. Port names are matched case-insensitively.

**The voice loop can't open the microphone**
An ASIO driver may be using the interface exclusively. Use another mic (e.g. the laptop mic: `voice --device-id 1`) or switch FL to *FL Studio ASIO*. List devices with `cli doctor`.

**Live master meter says "loopback unavailable"**
Run `pip install -e ".[loopback]"`. Native interface ASIO drivers bypass Windows loopback, so analyse exported WAVs or recorded takes instead.

**Plugin control says WRONG_PLUGIN or PARAM_NOT_FOUND**
Load the plugin into that mixer slot first. Run `fl_discover_plugin` once to read its real parameter names. On older FL versions without display-string support, values are approximate and marked `"approximate": true`.

**Does it work on macOS?**
Not yet. MIDI and audio use Windows APIs. The analyzer, coach and MIDI builder are pure Python and run anywhere.

**Does it cost AI tokens?**
Common commands are handled locally with zero tokens. Only open-ended questions go to your AI, as a packet of 300 tokens or less.

---

## How It Works
```
 Voice ("Hey Studio") ─► VAD ─► faster-whisper ─► recording gate ─┐
 Dashboard / CLI / REST / WebSocket ───────────────────────────────
 Claude / Antigravity / Cursor ── MCP ─────────────────────────────
                                                                   β–Ό
                     zero-token router ──► pitcherd (single MIDI owner)
                                              β”‚  FLA-Cmd  (SysEx v2 + CC)  ─► FL Studio script (device_FLAssistant.py)
                                              β”‚  FLA-State (state, ACK/NACK) β—„β”€β”˜
 WAV files / Audio\Recorded / loopback ─► analyzer Β· coach Β· live meter ─► fixes & MIDI export
```
- **SysEx v2 protocol:** `F0 7D 46 4C <ver> <seq> <cmd> <payload> <checksum> F7`. Each command is sent as one atomic frame and acknowledged by sequence number. The CC v1 protocol on MIDI channel 16 still works as a fallback.
- MIDI notes on channels 1–15 pass straight through to the selected FL instrument.

| Module | Role |
|---|---|
| `pitcherd.py`, `midi_io.py`, `sysex.py`, `state.py` | MIDI daemon, ports, protocol, live state |
| `fl_script/device_FLAssistant.py` | FL Studio MIDI controller script |
| `plugin_maps.py` | Named stock-plugin parameters + calibration |
| `coach.py` | Timing/pitch coach, tempo/meter, melody + key |
| `midi_builder.py` | Drums, chords, melodies, `.mid` writer |
| `analyzer.py`, `live_audio.py`, `take_watcher.py` | LUFS/True Peak, live meter, take watcher |
| `voice.py`, `selfheal.py`, `escalation.py`, `realtime.py` | Voice, safe auto-tweaks, AI hand-off, command router |
| `server.py`, `mcp_server.py`, `cli.py` | Dashboard/REST, MCP, CLI |
| `safety.py` | Write boundary (SafeIO + audit hook) |

---

## Disclaimer
This is an independent open-source project, **not affiliated with or endorsed by Image-Line**. FL Studio, Fruity Parametric EQ 2, Fruity Limiter, Maximus, Fruity Reeverb 2, WaveShaper, NewTime, NewTone and Pitcher are trademarks of Image-Line Software. Claude is a trademark of Anthropic. loopMIDI is by Tobias Erichsen. Always keep backups of your projects.

**Keywords:** FL Studio AI assistant, FL Studio MCP server, Claude FL Studio, Antigravity FL Studio, FL Studio voice control, FL Studio Python MIDI script, loopMIDI controller, AI music production, vocal timing and pitch coach, LUFS true peak analyzer, mixing and mastering assistant, beat maker MIDI generator.

TDQS

C2.6/5.0

Scored across 37 tools

Disambiguation3/5

Most tools target distinct actions, but several clusters overlap: fl_plugin_param vs fl_set_plugin_semantic, fl_plugin_maps vs fl_discover_plugin, and fl_transport vs fl_replay. Descriptions mostly clarify the boundaries, but an agent must read carefully to avoid misselection.

Naming Consistency3/5

All names use snake_case, which keeps them readable, but conventions are mixed: fl_* noun-style control tools, calc_* calculators, get_/check_/list_/search_ verbs, and bare names like realtime_command and escalation_packet. Category grouping is somewhat predictable, but there is no single verb_noun pattern throughout.

Tool Count2/5

37 tools is heavy for an assistant surface and spans FL control, diagnostics, audio analysis, physics calculators, skills, and connection setup. Many specialized tools could be consolidated or split into narrower servers to improve selection reliability.

Completeness3/5

The set covers live control, setup, analysis, MIDI export, and many advisory workflows, but notable FL Studio lifecycle gaps remain: no playlist/arrangement/clip editing, no project open/load, no audio render/stem export, and no explicit plugin/effect loading. Agents can work around some of these in the FL UI, but the surface is not fully complete for a DAW assistant.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues