Skip to content

Releases

v1.3.0 — FL Studio read-only filesystem / MIDI response channel

Choose a tag to compare

@Zierax Zierax released this 17 Nov 22:02

v1.3.0 — FL Studio's read-only filesystem is no longer a blocker

A follow-up to #2. v1.2.0 made the controller load on FL Studio 21; this release makes it actually answer.

The problem

FL Studio's scripting interpreter has a read-only filesystem in the older builds (confirmed on FL Studio 21.0.3, build 3517):

hasattr(builtins, "open")            # False
_io.open(path, "wb")                 # RuntimeError: File access disabled

That is an intentional sandbox (PEP 578 audit events): no file writes, no sockets, no subprocesses. It cannot be switched on from inside FL Studio. v1.2.0 could read the command file but could not write mcp_response.json, so every call timed out.

The fix

The controller now has two response channels, and the server accepts whichever arrives first:

Channel When How
Response file whenever the build permits writes _io.open, trying wb then r+b; the server pre-creates and truncates the file
MIDI out when every file write is refused device.midiOutSysex() to the output port linked to the controller

The MIDI channel is the two-way mechanism Image-Line documents for controller scripts (available since API version 1) and the one used by the original flapi project. Responses are framed with a manufacturer id, sequence number and total length, chunked to 700 bytes, and encoded as ASCII so every byte fits in the 7-bit MIDI data range. The server reassembles the chunks and matches them to the request id.

Setup change for FL Studio 21 and older

Assign an output port to the controller in Options → MIDI Settings, set to the same port number as the input port. Without it the controller has nowhere to send the response.

The Script output panel now prints the result of a startup file-access probe:

[MCP] file access: BLOCKED (File access disabled) -- responses will be sent over MIDI
[MCP] MIDI out: assigned, response channel available

fl_diagnostics() exposes the same through file_access, midi_out_assigned and response_channel.

Also in this release

  • 451 tests (up from 438), including a full end-to-end round trip in a simulated FL Studio 21 environment with both the stripped standard library and a read-only filesystem. That test would have failed on v1.2.0.
  • utils/midi_response.py — sysex framing and chunk reassembly, with tests for out-of-order chunks and large payloads.
  • Setup, troubleshooting, architecture and prompt documentation updated.
  • MCP_VERSION bumped to 6.

Upgrade

Pull v1.3.0, copy fl_controller/device_FLStudioMCP.py into Settings/Hardware/FLStudioMCP/, press Options → Update MIDI scripts, and set the controller's output port as described above. Run fl_diagnostics() to confirm.

v1.2.0 — FL Studio 21 support, diagnostics, rebuilt prompt pack

Choose a tag to compare

@Zierax Zierax released this 14 Nov 03:37

FL Studio 21 support, real diagnostics, and a rebuilt AI prompt pack

This release makes the bridge work on FL Studio 21 and older, fixes a
handful of bugs that made the server silently do the wrong thing, and
ships a prompt pack that turns the server into a producer rather than a
command runner.


FL Studio 21 (and older) now work — no setup required

FL Studio does not embed a normal Python installation. It embeds a
stripped CPython interpreter whose standard library is largely
removed: on FL Studio 21 the bundled Shared/Python/Lib contains only
midi.py and utils.py. So import json — and os, pathlib,
importlib — fail with ModuleNotFoundError, and the controller script
never finished initialising.

The controller script now uses builtins only:

  • a self-contained JSON codec, byte-identical in output to
    json.dumps(..., indent=2) — the wire format is unchanged
  • string-based path handling instead of os.path / pathlib
  • the controller folder is discovered through sys.path, which FL Studio
    populates with the Hardware subfolder
  • module probing uses the __import__ builtin instead of importlib

Nothing has to be installed for FL Studio 21. It initialises on 21 and on
2025 alike. → #2

The MIDI port is chosen, not guessed

The server used to take output_ports[0], which on a typical Windows
machine is a software synth such as Microsoft GS Wavetable Synth 0 — the
server then talked to the wrong device and every call timed out.

Ports are now scored: the bridge port wins, other MCP ports come next,
virtual MIDI drivers score low and known synths are penalised. When
nothing matches, the status reports port_is_guess: true so the problem
stays visible. fl_connect(port_name="FLStudioMCP 1") forces it.

The command folder is resolved, not assumed

FL Studio's user data folder can be moved or redirected into
OneDrive/iCloud, in which case the server and FL Studio disagreed about
where mcp_command.json lives. The server now searches the documented
location plus the cloud-redirected variants, accepts a folder only if it
actually contains device_FLStudioMCP.py, and honours the
FL_STUDIO_MCP_DIR environment variable.

New: fl_diagnostics

One call that reports the server side (MIDI port, whether it was a guess,
the resolved folder and every candidate) and the controller side (FL
API version, which modules the embedded interpreter can import, the paths
it resolved). It answers most "why is nothing happening" questions
without the archaeology.

Bug fixes

  • The Windows installer was dead. install.ps1 had 125 NUL bytes in
    it — every - had been replaced by 0x00, so the file was not valid
    PowerShell at all. It works now, and a test keeps NUL bytes out of the
    repository.
  • Failures were reported as successes. The controller answered every
    command with "success": true, even when the handler returned an
    error — and every tool checked success before looking at error, so
    failures were swallowed.
  • The generic command layer was dead. _convert_arg() looked its
    argument up with the kind ("int", "float") instead of the
    parameter name, so every entry in GENERIC_COMMANDS raised KeyError.
  • A late response could answer the wrong command. Each request now
    carries an id that the controller echoes back.
  • Commands could be read half-written. The command file is now
    written atomically (temp file + rename) and encoded as UTF-8, so
    non-ASCII channel names survive the trip.
  • The whole repo now passes ruff check (it did not before), and
    text files end with a newline.

The AI prompt pack, rebuilt

prompts/
went from three short files to a full operating manual:

File What it does
CORE.md The standing directive — role, the read-back invariant, creative rules, a "words that do nothing" list
BRIDGE.md Every tool grouped by job, the write/read pairings, what the bridge cannot do, failure branches
WORKFLOW.md The nine production phases, with a gate at the end of each
RECIPE.md The style card, how to fill it from a reference, a worked example
GENRES.md Twelve style specs with real numbers (BPM, key, swing, arrangement, mix)
ARRANGEMENT.md Energy curves, section lengths, layer logic, hooks
THEORY.md Key and mode, bass roles, melody craft
MIXING.md Balance → pan → routing → EQ → FX → automation → loudness
QC.md Seven numbered gate groups and a diagnostic table for a weak result

MAIN.md and STYLES.md remain as pointers, so existing pins keep
working.

Tests

There were none. There are now 432 — including an end-to-end test that
loads the controller with json, os, pathlib and importlib blocked
(the FL Studio 21 environment) and drives a complete command/response
round-trip through the real MIDIConnection. That test would have caught
issue #2 immediately.

uv sync
uv run pytest
uv run ruff check src/ tests/ fl_controller/device_FLStudioMCP.py

Housekeeping

  • The run artifacts (execution logs, scenario and benchmark reports) moved
    out of docs/ into logs/,
    where generated output belongs.
  • .gitattributes normalises line endings to LF — the shell installers
    were being checked out with CRLF and dying with
    bad interpreter: /bin/bash^M.
  • The documentation no longer hard-codes the author's checkout path, and
    the broken relative links inside docs/ are fixed.

Upgrade notes: copy the new fl_controller/device_FLStudioMCP.py into
Settings/Hardware/FLStudioMCP/ and press Options → Update MIDI
scripts
. The script output should show MCP_VERSION: 5.

FL Studio MCP v1.0.0

Choose a tag to compare

@Zierax Zierax released this 17 Aug 03:23

Full FL Studio control over MCP.

  • Transport, mixer, channel rack, patterns, plugins, step sequencer, piano roll
  • Raw access to the entire FL Studio scripting API (fl_raw_command + discovery)
  • 100+ tools across 9 groups (transport/mixer/channels/patterns/plugins/sequencer/piano_roll/advanced/fullcontrol)
  • Hot-reloadable FL Studio controller script (JSON + MIDI trigger bridge)
  • Fresh setup, tools, and troubleshooting docs