Random

A seeded random control lane: steps, glides or walks to a new value on each trigger, or free-running at a rate or tempo division.

  • Control
  • Since 0.2.0
  • random
  • noise
  • modulation
  • trigger
  • walk

Open in TuneToys

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

Random is a control lane that changes to a new random value now and then. It either follows a trigger you cable in, or runs on its own clock.

What it does#

Each time a new value is due, Random decides with Probability whether to change at all, then picks the value. In Step mode the lane jumps to a new value between 0 and 1; in Smooth mode it glides there over Slew; in Walk mode it moves from where it is by at most Walk either way and stays inside 0 to 1. Min and Max then map that 0 to 1 value onto the range the output uses, and may be swapped to invert it.

When a cable reaches Trigger, each rising edge is a new value. When nothing does, Random runs at Rate, or at one value per Beats when Beats is above 0, locked to the shared transport.

Seeded#

The sequence is seeded from the node's path, so the same Toy produces the same values on every host, every play and every replay. Two Random nodes in one Toy differ because their paths differ. Changing Probability does not shift the sequence that follows.

When to use it#

Use it for sample-and-hold style stepped values, a drifting pitch, humanised timing or levels, and generative patches. For random shapes inside a cycle, see the Random step and Random smooth shapes of Control LFO; to freeze any lane on a clock use Sample and hold.

Ports#

PortDirectionSignalLanes
triggerInputControl1
controlOutputControl1

Parameters#

ParameterLabelRangeDefaultUnitScaleNotes
modeMode0 to 20linearStep jumps to a new value, Smooth glides to it, Walk moves a bounded step from the current value. Choices: 0 Step, 1 Smooth, 2 Walk.
rate_hzRate0.01 to 402HzlogNew values per second when nothing is cabled to Trigger and Beats is 0.
beatsBeats0 to 640beatslinearBeats per new value, synced to the shared transport, when nothing is cabled to Trigger. 0 uses Rate instead.
probabilityProbability0 to 11linearChance that a trigger changes the value.
walkWalk0 to 10.2linearLargest step either way in Walk mode.
slew_msSlew0 to 10000100mslinearGlide time in Smooth mode.
minMin0 to 10linearOutput when the internal value is 0.
maxMax0 to 11linearOutput when the internal value is 1.

Mode (mode)#

Step, Smooth or Walk. A discrete choice.

Rate (rate_hz) and Beats (beats)#

How often a new value is due when Trigger is not cabled. Beats above 0 follows the transport and Rate is ignored. Control runs once per audio block, so at most one new value arrives per block.

Probability (probability)#

The chance a trigger changes the value, 0 to 1.

Walk (walk)#

The largest step either way in Walk mode.

Slew (slew_ms)#

The glide time in Smooth mode.

Min (min) and Max (max)#

The output range the 0 to 1 value is mapped onto.

Tips#

  • Cable a Control LFO square wave into Trigger to line new values up with a clock.
  • Set Min and Max narrower for a gentle drift around a centre.
  • Probability 0.5 on a steady clock gives uneven, human-sounding changes.

See also#

Sample and hold, Control LFO, Counter, Scale, 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. Wander

beginner Teaches: mode, rate_hz, slew_ms

A free-running smooth random lane glides the pitch of a tone between new values.

Patch: Oscillator audio output connected to Gain audio input. Gain audio output connected to Patch outputs audio input. Random control output connected to Oscillator @frequency input.
Connections as text
  • Oscillator audio output connected to Gain audio input
  • Gain audio output connected to Patch outputs audio input
  • Random control output connected to Oscillator @frequency input
  • Min and Max map the 0 to 1 draw onto the range you want.
  • The sequence is seeded from the node path: the same on every play.
Frame preview: WanderFrame “Wander” with 5 elements: text heading, text hint, segmented Mode, knob Rate, knob Slew.WANDERWith nothing cabled to Trigger, Random draws a new value at Rate. Smooth glides…StepSmoothWalkMode1.5 HzRate300 msSlew
Frame preview (static). Controls show their default values.

Open in TuneToys

2. Random on a clock

intermediate Teaches: probability, walk

A square clock triggers Random in Walk mode, and Probability decides how often the pitch moves.

Patch: Oscillator audio output connected to Gain audio input. Gain audio output connected to Patch outputs audio input. Control LFO control output connected to Random trigger input. Random control output connected to Oscillator @frequency input.
Connections as text
  • Oscillator audio output connected to Gain audio input
  • Gain audio output connected to Patch outputs audio input
  • Control LFO control output connected to Random trigger input
  • Random control output connected to Oscillator @frequency input
  • A cabled Trigger replaces the internal clock.
  • Walk stays inside 0 to 1, then Min and Max.
Frame preview: Random on a clockFrame “Random on a clock” with 5 elements: text heading, text hint, knob Probability, knob Clock, knob Walk.RANDOM ON A CLOCKEach rising edge of the clock may move the value. Probability is the chance it …0.6Probability4 HzClock0.25Walk
Frame preview (static). Controls show their default values.

Open in TuneToys

  • Sample and hold Capture the input lanes whenever the trigger lane rises and hold them until the next trigger.
  • Control LFO A free-running or tempo-synced low-frequency oscillator on a control lane, 0 to 1, with depth, offset, phase, skew, random shapes and a reset input.
  • Counter Count rising edges of a trigger lane, with step, limit, wrap and reset. Lane 1 is the normalised count, lane 2 the raw count.
  • Scale Map a control range onto another with a curve, clamp and inversion. Depth and offset for any modulation.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close