CHAOS Operators

The CHAOS operator will provide a new source of uncertainty to the teletype via chaotic, yet deterministic systems.

Here is a progression of the Logistic Map, which devolves into chaos past certain parameter values.

Logistic_map_animation

I haven’t put my nose to the grindstone on this operator, so before I start, I’ll put the usual design questions in play.

Given the number of potential chaotic implementations, I wonder what limitations we should set on

  • operator parameter count
  • access to hidden variables, and count

as well as the usual operator questions:

  • name (CHAOS)
  • alias (&? $? Surely the language won’t be complex enough to need both for something clever.)

And, if anyone wants to suggest algorithms to implement, I’m happy to hear them. Some links were shared in the other thread, but I should be able to implement anything that relies on only arithmetic and sin() and cos(). I’m interested in knowing what an algorithm is useful for, more than anything.

Algorithm Candidates

While we don’t have to stick to only one algorithm, we should probably limit the set to a small, useful set.

  • Logistic map (1 parameter, 1 constant, 1 dimension)
  • Cubic map (1, 1, 1)
  • Henon map (2, 1, 2)
  • Cellular Automata (1, 1, 1)

Tentative Syntax

CHAOS              | get next chaotic value
CHAOS 5000         | set current value to 0.5
CHAOS 15000        | set current value to 1.5
CHAOS -12500       | set current value to -1.25
CHAOS.R 5000       | set chaos parameter to half of range
CHAOS.ALG          | get current algorithm
CHAOS.ALG 0        | select LOGISTIC
CHAOS.ALG 1        | select CUIBIC
CHAOS.ALG 2        | select HENON

Cellular Automata

Given the difference in parameter and value type, this algorithm should be spun off into a new operator.

Tentative Syntax

CA.R 123          | select rule 123
CA 63             | set current value to 63
CA                | get next value
7 Likes

What will it do? Can you give an example? That would help.

1 Like

Ah, good point!

Top post updated with brief introduction.

$ would be a great alias for SCRIPT

5 Likes

I thought $ was great for CHAO$!
:grin:

Amazing! I love it to bits, as SCRIPT is so useful but so long.

2 Likes

Still not following. Can you give a code example? Does it take parameters? Does it return a value?

I: CHAOS.R 275 // 2.75
M: CV 1 CHAOS 

Produces the chaotic sequence as a CV. Each call provides the next value as defined by the logistic map with parameter R.

4 Likes

Got it! Thanks. I can’t help with the math, but I will enjoy reading responses!

What if you do a namespace that means “function”? That way you can create chaos functions, but also more mundane stuff like a simple exponential curve?

!CHAOS
!EXPONENTIAL
!WHATEVER

Not in love with ! but I think the concept of multiple functions could be interesting. Are different implementations of CHAOS worth pursuing? Then have multiple CHAOS functions.

What if we use F[functionname] without the brackets? Would even be interested in an alias for FDRUNK to keep things clean.

I don’t get it either - what is .R, what does 275 do, what 2.75 an what are the slashes for? Also does “next value” mean you basically define a more or less random sequence in the I script and then go through it with CHAOS without being able to alter any parameters. Like creating a still of the fancy diagram above at p=2.75?

I have never looked into its details, but Gendy seems to be a popular source of uncertainty in music. I think it was originally imagined as an audio source, but was later adopted for control purposes. Here is a cpp source. Also CSound files. A major problem will be deciding which parameters to expose.

2 Likes

ye olde cubic map is a nice simple recursive chaotic oscillator
x = a(x^3) + (1-a)*x

initial state should be in (-1, 1)

it has the cool property that x oscillate between positive and negative. so if you do interpolation by cosine segment it’s a sine oscillator, &c.

with a<3.2 or so it’s period=2, with amplitude kind of dependent on a. orbits tend to get longer and denser approaching a=4, whereupon it blows up.

Henon map is a fun 2-state recursive function that comes from celestial mechanics.

x(n+2) = 1 - a * x(n+1)^2 + b * x(n)

with a in, like, [1-2], b in, say, [0-1].

[edited for clarity]

this is denser and “crunchier” than cubic, and it’s fun to have different outputs for the different states.

lorenz attractor is another popular one but its a bit heavier to compute. (example omitted)

you can do a lot of fun things with coupled nonlinear force terms. here’s an oscillator based on th fermi-pasta-ulam-tsingou model. basically its a bunch of masses connected by springs, where the force term for the spring has a cubic term. you get differenet cool enharmonics by changing the “pickup position.” have found it very nice for LFO bank as well as audio rate.

[https://github.com/catfact/audio-externals/tree/master/fpu]

  1. i’ve seen a version of the logistic map with two variables, referred to as ‘twisted logistic’… will update here if i can dig up the details. it’s very musical.

  2. 1-d, binary cellular are always fun and very simple to implement. with continuous states you get what i’ve seen referred to as cellular dynamata… which can really model a large range of dynamical systems… and there’s a deep rabbit hole.


i gotta point out that gendy is stochastic. whole other can of worms. it is an implementation of the stochastic sieves xenakis used to produce waveforms for Metastasis (1955.) my opinion is that complex applications of random variables (gendy, markov chains) fall kinda outside the scope of a single TT operator. but it’s just an opinion.

if you do want to include a toolkit of basic non-uniform random distributions as operators, some of the usual suspects would be:

  • PINK (1/f) - best done by a “pinking filter” or something like Voss algorithm (which is basically sum of multirate uniform noise sources - see http://stenzel.waldorfmusic.de/post/pink/ for an efficient modern implementation)
  • BELL/GAUSS/NORMAL - a bell curve distribution, average of many uniform samples
  • BROWN - 1/f^2 , limit of random walk

these all require a uniform random variable as a starting point.


oh, BTW: can be hard to make even simple recursive functions behave properly with fixed-point arithmetic; rounding errors make it too noisy. i’d just use soft floats on AVR32 and eat the cycles. you probably realize this already.


and PS: in looking up the FPUT on wikipedia, i am over the moon to see that there has been some direction in officially crediting the person who actually programmed this important model, which was possibly the defining experiment in computational physics and one of the progenitive experiments for “chaos theory.”

mary tsingou was a woman of greek ancestry working at Los Alamos in 1955. it’s shameful that her name has been omitted from this groundbreaking work for half a century.

15 Likes

Interesting read! I’ll think about that one.

R is the parameter to the hypothetical CHAOS operator. Slashes are just a comment describing what 275 meant.

Your summary is accurate. :+1:

Cellular Automata might be worthy of an entire operator, but I could just as easily fold it into the chaotic generator. :+1:

1 Like

I am still trying to figure this out and am looking at this now:

Am I right that CHAOS would most of the time give exactly one or two values, then suddenly a lot of random values depending on what was put in the I script? So that the above example with 275 would just always output about 65?

If so I would include the parameter (here: 275) into the actual operator instead of having CHAOS.R 275 executed once in the I script.

Probably I still don’t get it but I hardly see any use of it like that while CV 1 CHAOS.R X with X dynamically varying between 0 and 400 might be interesting as it will happen nothing or something drastic in a way that is more unpredictable the higher X is. It also should be scaled to meaningful range then.

This is brain busting…

:nerd_face::boom:

EDIT: Starting from 0 also does not make sense, does it?

1 Like

Your understanding is correct.

At high levels of R, the sequence produced by repeated calls to CHAOS will be chaotic. At low levels of R, the sequence is not chaotic.

Isn’t the sequence at low levels of R not even a sequence?

[0, 0, 0, 0, 0, 0, 0, 0]

Is a sequence of zeroes.

…sounds interesting.

:man_teacher: