# Send FL Studio Scripting to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "flstudio-scripting",
    "name": "FL Studio Scripting",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/delorenj/flstudio-scripting",
    "canonicalUrl": "https://clawhub.ai/delorenj/flstudio-scripting",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/flstudio-scripting",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=flstudio-scripting",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "references/api-arrangement-patterns.md",
      "references/api-callbacks.md",
      "references/api-channels.md",
      "references/api-device.md",
      "references/api-mixer.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "flstudio-scripting",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-03T03:07:55.431Z",
      "expiresAt": "2026-05-10T03:07:55.431Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=flstudio-scripting",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=flstudio-scripting",
        "contentDisposition": "attachment; filename=\"flstudio-scripting-0.1.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "flstudio-scripting"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/flstudio-scripting"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/flstudio-scripting",
    "downloadUrl": "https://openagent3.xyz/downloads/flstudio-scripting",
    "agentUrl": "https://openagent3.xyz/skills/flstudio-scripting/agent",
    "manifestUrl": "https://openagent3.xyz/skills/flstudio-scripting/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/flstudio-scripting/agent.md"
  }
}
```
## Documentation

### FL Studio Python Scripting

Complete reference for FL Studio's Python API: MIDI controller scripting (14 modules, 427+ functions), piano roll note manipulation, Edison audio editing, and FLP file parsing with PyFLP.

### Requirements

FL Studio 20.8.4+, Python 3.6+

### Check API Version

import general
print(f"API Version: {general.getVersion()}")

### Script Installation

Place scripts in Shared\\Python\\User Scripts folder.

### 1. MIDI Controller Scripting

Purpose: Control FL Studio through hardware MIDI controllers and send feedback to devices.
Runs: Continuously while FL Studio is open.
Available modules: transport, mixer, channels, arrangement, patterns, playlist, device, ui, general, plugins, screen, launchMapPages, utils, callbacks

Entry points:

def OnInit():
    """Called when script starts."""
    pass

def OnDeInit():
    """Called when script stops."""
    pass

def OnMidiMsg(msg):
    """Called for incoming MIDI messages."""
    pass

def OnControlChange(msg):
    """Called for CC messages."""
    pass

def OnNoteOn(msg):
    """Called for note-on messages."""
    pass

def OnRefresh(flags):
    """Called when FL Studio state changes."""
    pass

### 2. Piano Roll Scripting

Purpose: Manipulate notes and markers in the piano roll editor.
Runs: Once when user invokes through Scripts menu.
Available modules: flpianoroll, enveditor

import flpianoroll
score = flpianoroll.score
for note in score.notes:
    note.velocity = 0.8  # Set all velocities to 80%

### 3. Edison Audio Scripting

Purpose: Edit and process audio samples in Edison.
Runs: Once within Edison's context.
Available modules: enveditor

### API Module Reference Map

Navigate to the appropriate reference file based on what you need to control.
Read these files ONLY when you need specific API signatures.

### Core Workflow Modules

ModuleFunctionsWhat It ControlsReferencetransport20Play, stop, record, position, tempo, loopingapi-transport.mdmixer69Track volume/pan/mute/solo, EQ, routing, effectsapi-mixer.mdchannels48Channel rack, grid bits, step sequencer, notesapi-channels.md

### Arrangement Modules

ModuleFunctionsWhat It ControlsReferencearrangement + patterns9 + 25Markers, time, pattern control, groupsapi-arrangement-patterns.mdplaylist41Playlist tracks, live mode, performance, blocksapi-playlist.md

### Device & Communication

ModuleFunctionsWhat It ControlsReferencedevice34MIDI I/O, sysex, dispatch, hardware refreshapi-device.md

### UI & Application Control

ModuleFunctionsWhat It ControlsReferenceui + general71 + 24Windows, navigation, undo/redo, version, snapapi-ui-general.md

### Plugins

ModuleFunctionsWhat It ControlsReferenceplugins13Plugin parameters, presets, names, colorsapi-plugins.md

### Specialized Hardware Display

ModuleFunctionsWhat It ControlsReferencescreen + launchMapPages9 + 12AKAI Fire screen, launchpad page managementapi-screen-launchmap.md

### Utilities, Constants & MIDI Reference

ModuleFunctionsWhat It ControlsReferenceutils + constants21Color conversion, math, note names, MIDI tablesapi-utils-constants.md

### Callbacks & FlMidiMsg

ModuleFunctionsWhat It ControlsReferencecallbacks26All callback functions, FlMidiMsg class, event flowapi-callbacks.md

### Piano Roll & Edison

Note, Marker, ScriptDialog, score classes for piano roll manipulation plus Edison enveditor utilities.
See piano-roll-edison.md

### FLP File Parsing (PyFLP)

External library for reading/writing .flp project files without FL Studio running. Batch processing, analysis, automated generation.
See pyflp.md

### Minimal MIDI Controller Skeleton

# name=My Controller
# url=https://example.com

import device
import mixer
import transport

def OnInit():
    if device.isAssigned():
        print(f"Connected: {device.getName()}")

def OnDeInit():
    print("Script shut down")

def OnControlChange(msg):
    if msg.data1 == 7:  # Volume CC
        mixer.setTrackVolume(mixer.trackNumber(), msg.data2 / 127.0)
        msg.handled = True

def OnNoteOn(msg):
    track = msg.data1 % 8
    mixer.setActiveTrack(track)
    msg.handled = True

def OnRefresh(flags):
    pass  # Update hardware display here

### Key Pattern: Always Check Device Assignment

def OnInit():
    if not device.isAssigned():
        print("No output device linked!")
        return
    # Safe to use device.midiOutMsg() etc.

### Key Pattern: Mark Events as Handled

def OnControlChange(msg):
    if msg.data1 == 7:
        mixer.setTrackVolume(0, msg.data2 / 127.0)
        msg.handled = True  # Prevent FL Studio from also processing this

### Key Pattern: Send Feedback to Hardware

def OnRefresh(flags):
    if device.isAssigned():
        # Update volume fader LED
        vol = int(mixer.getTrackVolume(0) * 127)
        device.midiOutMsg(0xB0, 0, 7, vol)

For complete examples (MIDI learn, scale enforcer, LED feedback, batch quantization, sysex handling, performance monitoring, automation engine, debugging):
See examples-patterns.md

### Performance

Cache module references at top level (import once)
Avoid tight loops in MIDI callbacks (keep under 10ms)
Batch UI updates; use device.directFeedback() for controller echo

### Hardware Integration

Always check device.isAssigned() before device functions
Implement two-way sync for all controls (send feedback on state change)
Test on real hardware (virtual ports behave differently)

### Code Organization

Separate MIDI mapping from business logic (use a controller class)
Keep callbacks responsive; offload complex work
Handle edge cases: invalid indices, missing devices, out-of-range values

### Script Not Receiving MIDI

Check device.isAssigned() returns True
Verify MIDI input port in FL Studio MIDI Settings
Ensure callback functions are defined at module level (not nested)
Check MIDI message status bytes match expected values

### Piano Roll Script Not Working

Verify script is in Shared\\Python\\User Scripts folder
Ensure a pattern is open in piano roll before running
Access notes via flpianoroll.score.notes

### Performance Issues

Avoid complex calculations inside OnIdle() (called every ~20ms)
Don't repeatedly query values that haven't changed
Use device.setHasMeters() only if peak meters are needed

### FAQ

Double-click detection: Use device.isDoubleClick(index)
Inter-script communication: Use device.dispatch(ctrlIndex, message)
LED control: device.midiOutMsg(0x90, 0, note, velocity) for note-on LEDs
processMIDICC vs OnControlChange: Use On* callbacks for modern code
GUI access: Limited through ui module; full UI automation not available
Multiple devices: Check device.getName() to identify, handle per-port

### Resources

Official FL Studio API: https://www.image-line.com/fl-studio/modules/python-scripting/
PyFLP GitHub: https://github.com/demberto/PyFLP
API Functions: 427+ across 14 modules | Last Updated: 2025
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: delorenj
- Version: 0.1.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-03T03:07:55.431Z
- Expires at: 2026-05-10T03:07:55.431Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/flstudio-scripting)
- [Send to Agent page](https://openagent3.xyz/skills/flstudio-scripting/agent)
- [JSON manifest](https://openagent3.xyz/skills/flstudio-scripting/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/flstudio-scripting/agent.md)
- [Download page](https://openagent3.xyz/downloads/flstudio-scripting)