Widgets
Form
form creates the main application window. The default values for size are 600x300. There can only be one form per instrument, and it has the unique channel name of MainForm. The caption property will only be displayed when running an instrument as a standalone application.
Properties
Section titled “Properties”Caption
Section titled “Caption”"caption": "string"The string passed to caption will be the string that appears on the main application window.
Automatable
Section titled “Automatable”"automatable": trueDetermines if a widget is automatable by a host DAW. Automatable widgets show up as plug-in parameters in the host. Non-automatable widgets can still communicate with Csound but are not accessible by the host. The default varies by widget: most interactive controls default to true, while display-only widgets such as label, image and csoundOutput default to false.
Note that hosts don't allow this parameter to change dynamically. If you change this setting, the plugin will need to be reloaded.
Channel
Section titled “Channel”"channels": [ { "id": "channelName", "label": { "name": "Channel Name", "prefix": "", "suffix": "" }, "event": "valueChanged", "type": "number", "range": {"min":0, "max":100, "defaultValue":0, "skew":1, "increment":0.1} }]
In Cabbage 3, widgets use an array of channels instead of a single channel string. Each channel object includes an
id that defines a unique channel name. Widgets in Cabbage 3 can have any number of channels attached to
them. An optional label object controls how the parameter appears in DAW parameter editors and
automation lanes; if omitted, the id is used. An optional event property specifies the
type of interaction. A range object can define the minimum, maximum, and default values, along with the
skew and step increment. The type is set to number by default. Each widget sets its own
type, number or string. A "string" channel carries text (readable with the
string variant of cabbageGetValue), persists through session saves, and is excluded from DAW automation.
See Persisting Custom UI State.
Channel label: DAW display name
The label object separates the internal channel identifier from the display name shown in DAWs, and
allows a prefix and suffix to be appended to the parameter's value string in the DAW. This is useful when you want
short, code-friendly channel IDs (e.g., hrm1, hrm2) while showing descriptive names in the
DAW (e.g., Harmonic 1, Harmonic 2). Csound code always uses the id for
channel access via cabbageGetValue and cabbageSetValue.
| Field | Description |
|---|---|
name | Human-readable parameter name shown in the DAW (required if using label) |
prefix | String prepended to the value in the DAW's value display (optional) |
suffix | String appended to the value in the DAW's value display (optional) |
If range is omitted, it defaults to a range from 0 to 1, with increments of 0.001 for widgets that use drag events (e.g., sliders, XY pads) and 1 for widgets that use click or toggle events (e.g., buttons, checkboxes).
Note on increment parameter behavior:
The increment parameter quantizes all values sent to Csound channels, ensuring they snap to the
specified step size. For example, with increment: 0.1, values will be rounded to 0.0, 0.1, 0.2, etc.
before reaching Csound.
The DAW host automation has additional constraints:
-
increment >= 1.0: The host will display discrete integer steps (e.g., move from 1 to 2 to 3, etc.) in its native controls, and enforce these steps during automation. increment < 1.0: The host displays a continuous slider.
Cabbage always quantizes values internally before sending to Csound.
Supported event types:
| Event | Description |
|---|---|
valueChanged (default) | Tracks simple value changes |
mousePressLeft | Sends 1 when the left mouse button is pressed, 0 when released. |
mousePressRight | Sends 1 when the right mouse button is pressed, 0 when released. |
mousePressMiddle | Sends 1 when the middle mouse button is pressed, 0 when released. |
mouseReleaseLeft | Sends 0 when the left mouse button is released. |
mouseReleaseRight | Sends 0 when the right mouse button is released. |
mouseReleaseMiddle | Sends 0 when the middle mouse button is released. |
mouseMoveX | Tracks movement along X axis. |
mouseMoveY | Tracks movement along Y axis. |
mouseDragX | Tracks movement along X axis with mouse pressed |
mouseDragY | Tracks movement along Y axis with mouse pressed |
mouseInside | Sends the channel maximum while the pointer is inside the widget and the minimum when it leaves. |
The form’s channels report mouse activity across the whole instrument window while the instrument is running in performance mode. They are not sent while the interface is being edited. This makes the form the place to put global gestures such as scrubbing, mouse-following effects, or detecting when the pointer leaves the interface.
"channels": [ { "id": "mouseX", "event": "mouseMoveX", "range": { "min": 0, "max": 1 } }, { "id": "mouseY", "event": "mouseMoveY", "range": { "min": 0, "max": 1 } }, { "id": "mouseLeft", "event": "mousePressLeft", "range": { "min": 0, "max": 1 } }, { "id": "mouseRight", "event": "mousePressRight", "range": { "min": 0, "max": 1 } }, { "id": "mouseInside", "event": "mouseInside", "range": { "min": 0, "max": 1 } }]mouseMoveX / mouseMoveY and mouseDragX / mouseDragY are normalised to the form bounds and scaled into each channel’s range. mouseInside sends the channel maximum when the pointer enters the form and the minimum when it leaves. Press channels send 1 on press and automatically return to 0 on release; a matching mouseReleaseLeft / mouseReleaseRight / mouseReleaseMiddle event is optional and only needed when the release should use a separate channel id. Because the form covers the whole window, its left-click (valueChanged) and mouse press channels report clicks anywhere in the interface, including clicks on other widgets.
"id": "widgetId"This optional channel can be used to define a top-level line of communication between the instrument’s UI and Csound. It is reserved for UI updates only. If omitted, it defaults to the first id from the channels array. Its primary purpose is to help produce clearer code, especially for widgets with multiple channels.
Scale Source
Section titled “Scale Source”"scaleSource": "host"Selects how the form's pixel scaling is calculated. Use "host" (the default) to use the scale reported by the DAW host, or "os" to use the operating system DPI.
"size": {"width":100, "height":100}integer values denoted the width and height of the form.
ZIndex
Section titled “ZIndex”"zIndex": 0Sets the stacking order of the widget. Widgets with higher zIndex values will appear in front of widgets with lower values. Default is 0.
"style": { "backgroundColor": "#004c6b", "opacity": 1},- The form background color is controlled by
style.backgroundColor. - Opacity applies to the form’s background.
Example
Section titled “Example”<Cabbage>{ "pluginId" : "def1", "enableDevTools": true, "channelConfig" : [ {"name": "0 in 2 out", "ins": "0", "outs": "2"} ], "widgets" : [ { "type": "form", "caption": "Form Example", "size": {"width": 380, "height": 200} }, { "type" : "label", "channels": [ { "id": "info", "event": "valueChanged" } ], "bounds" : {"left": 10, "top": 16, "width": 360, "height": 20}, "label" : {"text": "The form sets this window's caption and size"} } ]}
</Cabbage><CsoundSynthesizer><CsOptions>-n -d -+rtmidi=NULL -M0 -m0d</CsOptions><CsInstruments>; Initialize the global variables.ksmps = 32nchnls = 20dbfs = 1
; Rory Walsh 2021;; License: CC0 1.0 Universal; You can copy, modify, and distribute this file,; even for commercial purposes, all without asking permission.
instr 1 prints("Form example running\n")endin
</CsInstruments><CsScore>;starts instrument 1 and runs it for a weeki1 0 z</CsScore></CsoundSynthesizer>