Skip to content

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

Choose a tag to compare

@Zierax Zierax released this 14 Nov 03:37
· 7 commits to master since this release

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.