cables is under heavy development.
There might be one or another bug, please let us know about it!
op id:bb4debc5-642c-4d9f-b4ea-570212e102a5
Represents a Markov Chain

summary (oneliner)

CtrlMarkov represents a Markov Chain where each call to next will move to the next state. If the next state choice is an array, the next state is chosen randomly with even probability for all of the choices. For a weighted probability of the next choices, pass in an object with state and probability attributes. The probabilities will be normalized and then chosen. If no next options are given for the current state, the state will stay there.
Markov Chains can be used for many things, e.g. generating music or visuals.



youtube id


related ops


Values (Object)

An object with state values, e.g. { "beginning" : [ "end", "middle"], "middle" : "end" }

Start Value (string Number)

Which value to start with (optional), e.g. "beginning"

Next (Function)

Sets the output port Next Value


Next Value (string Number)

The next value in the chain after calling Next

CtrlMarkov Example:

Shows how to simulate a system using a Markov Chain. The used system has three states ("a", "b" and "c"). Using an object it is defined which state might come after another. Here "b" always follows after "a". After "b" always "c" follows. After "c" it might be "a" or "b".


  • Uses library: Tone.js (Webaudio Library)
  • Op author: tim

Caught a mistake or want to contribute to the documentation?

Edit this documentcancel save

Examples using CtrlMarkov

Public Patches using CtrlMarkov