Signal Display

Displays a graphical representation of a signal. Must be used with the display or dispfft opcodes in Csound. You must pass a Csound a-rate variable to the signalVariable() identifier, and you must enable --displays in the Csound options. Please see the SignalDisplay example csd for more details.

signaldisplay backgroundColour("colour"), displayType("type"), signalVariable("variables"), updateRate(val), zoom(val), active(val), alpha(val), bounds(x, y, width, height), colour("colour"), channel("chan"), identChannel("channel"), toFront(), moveBehind("widgetName"), parent(val), visible(val),

Specific Identifiers


backgroundColour("colour") This sets the background colour of the display. Any CSS or HTML colour string can be passed to this identifier. The colour identifier can also be passed an RBG, or RGBA value. All channel values must be between 0 and 255. For instance colour(0, 0, 255) will create a blue, while colour(0, 255, 0, 255) will create a green with an alpha channel set to full.


displayType("type") Sets the the type of display. Must be 'spectrogram' or 'spectroscope', 'waveform' or 'lissajous'. Set to 'spectroscope by default.


signalVariable("variables") The Csound variable or variables passed to the display opcodes. If you use 'lissajous' you must pass two a-rate variables to this identifier.


updateRate(val) Set the rate at which the display will update. val determines the number of milliseconds between update. The update rate is set to 100 milliseconds by default, which means the display will update itself 10 times a second. Smaller update rates will produce smoother images, but will cost more in terms of CPU.


zoom(val) Sets the initial zoom value. Passing a -1 to zoom will cause the zoom buttons to disappear.

Common Identifiers %}


active(val) Will deactivate a control if 0 is passed. Controls which are deactivate can still be updated from Csound.


alpha(val) A value between 0 and 1 will set the alpha blend value for the entire component. Can be useful if you need to fade widgets in and out.


bounds(x, y, width, height) integer values that set position and size on screen(in pixels).


colour("colour") This sets the main colour. Any CSS or HTML colour string can be passed to this identifier. The colour identifier can also be passed an RBG, or RGBA value. All channel values must be between 0 and 255. For instance colour(0, 0, 255) will create a blue, while colour(0, 255, 0, 255) will create a green with an alpha channel set to full.


channel("chan") or channel("chan1", "chan2") in the case of widgets that accept two channels such as xypad, soundfiler and range widgets. channel() accepts a string/s that names the channel/s that Cabbage will communicate with Csound on. The current value of this widget can be retrieved in Csound using a chnget, or a cabbageGetValue opcode. Its value can be set using the cabbageSet, or cabbageSetValue opcodes. hrange, vrange, xypad, and soundfiler all take two channels:

hrange, vrange : channel("min", "max") - min and max values

xypad : channel("x", "y") - x and y values

soundfiler : channel("start", "length") - start time and length of user selection, in samples

Channels named should start with a letter and cannot have any white spaces. Note that all widgets should have a unique channel name.


identChannel("channel") [!!! DEPRECATED !!!] Although identifier channels still work, they are no longer supported. Please use the new guiMode("queue") system and the cabbageGet and cabbageSet opcodes instead. They are far more efficient then identifiers channel.


toFront() Brings a widget to the front of the z order. This identifier takes no arguments and is only intended for use within the Csound orchestra. it makes no sense to call it when declaring the widget.


moveBehind("widgetName") Moves a widget directly behind another. This identifier should only ever be called from your Csound orchestra using a cabbageSet opcode.

This only works with widgets or plants that have the same parent.


parent(val) This identifier is can be to set a widget's parent. It should only be used when creating widgets dynamically using the cabbageCreate opcode. See plants for more details.


visible(val) A value of 0 will cause the widget to become invisible. Widgets have their visibility set to 1 by default.

To enable the use of the signaldisplay widget you must pass --displays to your CsOptions. See the SignalDisplay example for details. Also note that the Lissajous display is the most CPU expensive display option, followed by waveform. The spectral modes are the least CPU expensive.

Example

<Cabbage>
form size(380, 500), caption("SignalDisplay"), guiMode("queue"), pluginId("SigD")
signaldisplay bounds(10, 8, 362, 187), colour("white") displayType("waveform"), backgroundColour(147, 210, 0), zoom(-1), signalVariable("a1", "a2"), channel("display")
combobox bounds(254, 274, 120, 28), align("centre"), channel("displayCombo"), text("Waveform", "Spectroscope", "Spectrogram", "Lissajous")
keyboard bounds(8, 204, 368, 60)
combobox bounds(10, 272, 100, 30), align("centre"), channel("waveshape"), items("Sine", "Saw", "Square")
texteditor bounds(12, 314, 361, 163) channel("infoText"), wrap(1), text("A signaldisplay widget will display an audio signal in either the time/pressure, or time/frequency domain. In this example it will display a variety of different waveforms. This widget is works with the 'display' and 'dispfft' opcodes in Csound, and as such you must include the '--displays' flag in your CsOptions.", "", "You must also pass the names of the audio variables you wish to display to the signalVariable() identifier. In this example variables a1 and a2 are displayed.")
</Cabbage>
<CsoundSynthesizer> 
<CsOptions>
-n --displays -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
;sr is set by the host
ksmps = 16
nchnls = 2
0dbfs=1


instr 1
a1, a2 init 0

if chnget:k("waveshape") == 1 then
    a1 oscili 1, p4
elseif chnget:k("waveshape") == 2 then
    a1 vco2 1, p4
elseif chnget:k("waveshape") == 3 then
    a1 vco2 1, p4, 10
endif
outs a1, a1


aLFO oscil .6, random:k(10, 100)
a2 oscil 1, p4*.9+aLFO

display a1, .1, 1
dispfft a1, .1, 1024
display a2, .1, 1
endin


instr 2

    SText  = "A signaldisplay widget will display an audio signal in either the time/pressure, or time/frequency domain. In this example it will display a variety of different waveforms. This widget is works with the 'display' and 'dispfft' opcodes in Csound, and as such you must include the '--displays' flag in your CsOptions.\n\nYou must also pass the names of the audio variables you wish to display to the signalVariable() identifier. In this example variables a1 and a2 are displayed."
    cabbageSet "infoText", "text", SText


    kDisplayType, kTrig cabbageGetValue "displayCombo"
    STypes[] init 4
    STypes[0] = "waveform"
    STypes[1] = "spectroscope"
    STypes[2] = "spectrogram"
    STypes[3] = "lissajous"
    cabbageSet kTrig, "display", "displayType", STypes[kDisplayType-1]
endin

</CsInstruments>
<CsScore>
;i1 0 3600
f0 3600
i2 0 3600
</CsScore>
</CsoundSynthesizer>