Value

A literal source, the data domain's number box and message box.

  • Data
  • Since 0.2.0
  • value
  • number
  • text
  • boolean
  • json
  • constant
  • message
  • data

Open in TuneToys

Value as the Patch draws it, at default values: inlets on the left, outlets on the right.

Value sends one fixed data value: a number, a piece of text, true or false, or a JSON value such as a list.

What it does#

Kind chooses what Value sends. Number sends the Number parameter. Text sends the node's text field as a string. Boolean sends true when Number is not 0 and false when it is 0. JSON parses the text field, so [1, 2, 3] becomes a list of three numbers; text that is not valid JSON sends no value (null) and the inspector shows the error.

Value sends when the Toy starts and again whenever you change Kind, Number or the text. Any message on the send input makes it send its current value again, so a trigger or a rising boolean can "bang" it.

When to use it#

Use it as the start of a data chain: a number for Math, a sentence for String, a list for List, or the second operand of Compare. Use JSON to write a list literal.

Ports#

PortDirectionSignalLanes
sendInputData (any)1
valueOutputData (any)1

Parameters#

ParameterLabelRangeDefaultUnitScaleNotes
kindKind0 to 30linearDatatype of the stored value; Text and JSON read the text data key. Choices: 0 Number, 1 Text, 2 Boolean, 3 JSON.
numberNumber-1000000000 to 10000000000linearThe value when Kind is Number; non-zero is true for Boolean.
  • text: text.

Kind (kind)#

Number, Text, Boolean or JSON, a discrete choice. Text and JSON read the node's text field (up to 1 024 characters), which you edit in the inspector.

Number (number)#

The number to send, from -1 000 000 000 to 1 000 000 000, with no fixed step. Used by Number and Boolean; ignored by Text and JSON.

Tips#

  • Write a list as JSON, for example [60, 64, 67], and feed it to List or Math.
  • Text is sent exactly as typed, spaces included. Use String Trim to clean it.
  • Connect a trigger to send to resend the value on an event.

See also#

Math, String, List, Compare, Cables.

Help patches

Each help patch is an ordinary Toy that teaches one idea. The diagram shows the Patch; the preview shows its Frame. Open it in TuneToys to play and edit it.

1. A number box

beginner Teaches: kind, number

A Value node sends a number, text, boolean or JSON list into a Math node.

Patch: Oscillator audio output connected to Patch outputs audio input. Value value output connected to Math a input.
Connections as text
  • Oscillator audio output connected to Patch outputs audio input
  • Value value output connected to Math a input
  • Number sends the Number value. Text sends the text field as a string; JSON parses it, here a list.
  • Math multiplies by 2. With JSON it doubles every element of the list.
  • Data cables carry values, not sound. Select a data node to see its newest value in the inspector; the tone only keeps the Toy audible.
Frame preview: A number boxFrame “A number box” with 2 elements: text heading, text hint.A NUMBER BOXData nodes are set in the inspector: select one on the Patch to change Kind, Nu…
Frame preview (static). Controls show their default values.

Open in TuneToys

  • Math Arithmetic on data values, with the same operations as signal Math. Numbers in, numbers out; lists are worked element by element.
  • String Text operations on data values: length, case, trim, split, replace, slice, pad, repeat, search, regular expressions, format and JSON.
  • List List operations on data values: get, push, insert, remove, slice, sort, unique, flatten, join, range, sum, minimum, maximum, mean, shuffle and more.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close