mcp_opendaw_set_script_device_code
Set user JavaScript on openDAW scriptable devices (Apparat, Werkstatt, Spielwerk) to define custom DSP or MIDI behavior. The compiler validates and registers the code for the audio worklet.
Instructions
Set the user JavaScript code on a scriptable device (Apparat/Werkstatt/Spielwerk).
Compiles the code using the official OpenDAW ScriptCompiler, which:
Parses @param declarations and creates WerkstattParameterBox children
Parses @sample declarations and creates WerkstattSampleBox children
Validates the JavaScript (new Function check)
Registers the worklet module on the AudioContext
Writes the code with proper // @ header back to the device
The code defines a Processor class that the host instantiates in the audio worklet.
@param declarations: // @param [type] [unit]
@sample declarations: // @sample
See the openDAW plans/apparat.md, plans/spielwerk.md for the full API.
device_type: "apparat" (instrument), "werkstatt" (audio effect), "spielwerk" (MIDI effect)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| unit_index | Yes | ||
| device_type | Yes | ||
| device_index | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |