Skip to content

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

Latest

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.