Data cables

The fifth cable type carries structured messages between host nodes; datatypes, widening and bridges into sound.

Tune.Toys has five cable types. Audio, video, control and MIDI run continuously or in time with the engine. Data cables, drawn dotted in violet, carry one message at a time: a number, some text, a JSON object, a table. Data nodes such as Cron, Web request and Dataset live in the host's data runtime, never on the audio thread.

Datatypes#

Every data port declares a datatype: trigger, boolean, integer, number, string, color (#rrggbb), json, table, bytes or any. Some outputs take their datatype from a parameter, such as a Web request's Parse or a Convert's To.

A cable connects when the datatypes match, when the input accepts any, or when the value widens without loss:

  • integer → number, and boolean → integer;
  • number, integer, boolean, string or color → json;
  • anything → string (as JSON text).

Everything else is narrowing (json to number, any to trigger) and needs an explicit Convert, which also picks fields out of JSON with a pointer. The validator names the mismatch and suggests the Convert.

Delivery#

A data input takes one cable; outputs fan out freely, and Merge is how several sources meet. Triggers queue (64 per cable); every other datatype keeps only its newest message. Messages are bounded (1 MiB, tables 100 000 cells, bytes 16 MiB), and cycles are refused, like audio feedback. Each message is stamped with the audio block it belongs to, so a cron tick and the sound it changes line up.

Bridges#

Data reaches sound only through explicit bridge nodes:

  • Data to control maps numbers onto a control lane that a parameter socket reads at the next block.
  • Data to MIDI schedules a JSON note list as MIDI into an instrument.

The data runtime runs in the browser. The Player and exports report the data domain unavailable at load: bridges never write there, so parameters keep their base values.

Seeing values#

Select a data node and open the Data panel: tables as a spreadsheet, JSON as a tree, text, numbers with a history, colours as swatches. Console log prints values to the Console panel. An led widget in the Frame lights up from a colour, boolean, number or trigger port.

See also#

Cables and channels, Control lanes, MIDI cables, Secrets and the vault, Takes.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close