Skip to content
Cabbage
Install

Widgets

Csound Output

csoundOutput creates a read-only text area that displays Csound’s console messages inside the instrument. It is most useful when developing plugins, where the Csound console is not readily available: anything written with printf, prints, or similar opcodes is appended to the widget as it is produced.

csoundOutput.csd
Download .csd
"bounds": {"left":0, "top":0, "width":100, "height":100}

Integer values that set position and size on screen(in pixels).

"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.

"label": {
"text": "",
"offsetY": 0
}

Configures the widget label displayed near the control.

  • text: string — the label text.
  • offsetY: number — vertical offset applied when the label is rendered outside the control (pixels).

Typography (font size, color, family, alignment) is set via style.label.*.

"visible": true

A value of true will cause the widget to become invisible (use 0/1 to update from Csound). Widgets have their visibility set to true by default.

"zIndex": 1

Sets the stacking order of the widget. Widgets with higher zIndex values will appear in front of widgets with lower values. Default is 1.

"style": {
"opacity": 1,
"backgroundColor": "#1e1e1e",
"fontFamily": "courier new, monospace",
"fontSize": 13,
"fontColor": "#dddddd",
"textAlign": "left"
},
  • The widget is read-only. Users can select and scroll the text but cannot edit it.
  • fontSize is set in pixels.
  • textAlign accepts left, center, or right.
  • Colors accept named CSS colors, hex (e.g., #RRGGBB or #RRGGBBAA), or rgb/rgba strings.

Console messages are collected by the Cabbage backend and appended to the output widget. Any of Csound’s printing opcodes will appear there:

printf("Frequency: %.2f Hz\n", 1, frequency)
prints("Instrument started\n")

To print only when something happens, gate the message with a channel trigger:

trigger:CabbageNumTrig = cabbageGetValue("printMessage")
printf("Button pressed at %.2f seconds\n", trigger.trig, timeinsts())

The widget is display-only and does not send values to Csound. Messages accumulate while the instrument is running.

csoundOutput.csd
<Cabbage>
{
"pluginId" : "def1",
"enableDevTools": true,
"channelConfig" : [ {"name": "0 in 2 out", "ins": "0", "outs": "2"} ],
"widgets" : [
{ "type": "form", "caption": "Csound Output Example", "size": {"width": 580, "height": 420} },
{
"type" : "csoundOutput",
"bounds" : {"left": 16, "top": 16, "width": 548, "height": 330},
"label" : {"text": "Csound console output:"},
"style" : {
"backgroundColor": "#1e1e1e",
"fontFamily" : "courier new, monospace",
"fontSize" : 13,
"fontColor" : "#dddddd",
"textAlign" : "left"
}
},
{
"type" : "button",
"bounds" : {"left": 16, "top": 360, "width": 140, "height": 30},
"channels": [ {"id": "printMessage", "event": "valueChanged"} ],
"label" : { "text": {"off": "Print Message", "on": "Print Message"} }
}
]
}
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
; Rory Walsh 2026
;
; License: CC0 1.0 Universal
; You can copy, modify, and distribute this file,
; even for commercial purposes, all without asking permission.
instr 1
trigger:CabbageNumTrig = cabbageGetValue("printMessage")
printf("Button pressed at %.2f seconds\n", trigger.trig, timeinsts())
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
i1 0 z
</CsScore>
</CsoundSynthesizer>