Applying Math Expressions to Slider Receivers

Related: Syncing a Slider to a Data-Source and Introduction to MIDI/OSC/DMX Setup

Using control data from other applications, external hardware, and internal providers like LFOs or Audio Analysis plugin is a major component of VDMX- every UI element (eg. sliders and buttons) is capable of being controlled by MIDI/OSC/DMX and other data sources. The procedure for the setup is consistent across all interface control items- you add a receiver (which receives data from things) to the UI element you're working with using the UI Inspector. Once the assignment is made the sub-inspector for data-receivers contains several options for how the data is mapped onto the UI item being controlled.

Typically the range of numbers being received can be automatically translated by VDMX to cover the local minimum and maximum envelopes of a slider UI item. However in some situations you may want to override the default number mapping behavior by using the settings in the sub-inspector panel for receivers. In this tutorial we'll look at some of the common cases you may run into and how to handle them when making your own VJ rig or video instruments.


Notes and Tips:

Decimal receivers take an incoming numeric value, optionally modifying it via a series of math functions, and apply it to whatever owns the receiver:

  • "Invert val?" inverts the received value.
  • "Scale val to fit within envelopes" takes the received value and scales it to fit within the min/max envelopes of whatever owns the receiver (usually a slider). This lets you use the full range of a hardware control to manipulate a specific range of a slider.
  • When the "Skip duplicate received values" option is enabled the UI item will not output if the incoming values have not changed.
  • The "Use Num FX Chain?" toggle determines whether or not this receiver uses a number fx chain to modify the received data before passing it on to the object which owns the receiver.
  • The "Edit Num FX Chain" button uninspects the receiver and its attached UI item and inspects the receiver's num fx chain, allowing you to edit and add to it.
  • The middle of the Decimal Data Receiver Inspector changes depending on whether the receiver is receiving data from a MIDI, OSC, or DMX data source.
    • When receiving from MIDI, there's an option to work with "Endless MIDI mode"- some MIDI devices send increment/decrement messages when turning infinite knobs: this is how you work with this data
    • When receiving from OSC/data sources, there's a toggle for choosing whether or not the receiver's values are "normalized". By default, all receivers are expected to be normalized (the values are expected to be ranged from 0.0-1.0): if you disable this, the receiver will send its values outside this range to whatever owns it. This is particularly useful if you want to control the exact value of a slider directly.
    • When receiving from OSC/data sources, a text field becomes visible which allows you to choose which item in the list you want the receiver to work with. Some OSC devices and software encodes values in lists- this lets you work around such contrivances and extract the data you need from them.
  • The "Do Math?" option reveals a text field which can be used to enter a custom mathematical expression that is applied to the receiver before output.
    • Use the $VAL, $MIN and $MAX strings to access the slider value, minimum and maximum envelope values as variables in your equations.
    • For a full list of supported mathematical functions and constants visit the wiki for DDMathParser by Dave Delong.

Click on a slider to inspect it in the UI Inspector. Use the '+' button to create a new receiver.

Receivers can adjust the slider value, or its min / max envelope handles positions.

The "Do Math" option in the receiver sub-inspector allows for entering math expressions.

The "Do Math" option in the receiver sub-inspector allows for entering math expressions.