# Data cables

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

Source: https://docs.tune.toys/concepts/data-cables/

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](https://docs.tune.toys/nodes/time.cron/), [Web request](https://docs.tune.toys/nodes/web.request/) and [Dataset](https://docs.tune.toys/nodes/data.set/) 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](https://docs.tune.toys/nodes/data.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](https://docs.tune.toys/nodes/data.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](https://docs.tune.toys/nodes/data.to-control/) maps numbers onto a control lane that a parameter socket reads at the next block.
- [Data to MIDI](https://docs.tune.toys/nodes/midi.from-data/) 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](https://docs.tune.toys/nodes/log.console/) 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](https://docs.tune.toys/concepts/cables/), [Control lanes](https://docs.tune.toys/concepts/control-lanes/), [MIDI cables](https://docs.tune.toys/concepts/midi-cables/), [Secrets and the vault](https://docs.tune.toys/concepts/secrets/), [Takes](https://docs.tune.toys/concepts/takes/).
