File: Brusselator.schelp

package info (click to toggle)
supercollider-sc3-plugins 3.9.1~repack-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 13,444 kB
  • sloc: cpp: 150,202; lisp: 7,004; ansic: 3,547; makefile: 86; haskell: 21; sh: 8
file content (63 lines) | stat: -rw-r--r-- 2,216 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

class:: Brusselator
summary:: Prigogine oscillator
related:: Classes/Oregonator
categories:: UGens>Generators>Chaotic

//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html
keyword:: SLUGens


Description::

Euler ODE solver implementation of the Brusselator equations (http://en.wikipedia.org/wiki/Brusselator).  

x' = x^2*y - (mu+1)*x + gamma 

y' = -x^2*y + mu*x

All inputs can have .kr rate UGens plugged in.

Nonlinear oscillators can blow up, treat with caution. This one is relatively stable however, converging to a fixed point, or a limit cycle, in the upper positive quadrant. for some reasonable values. Just be careful if mu gets much bigger than gamma (though making it larger is necessary to get some chaotic oscillation behaviour); you can retrigger to get back to normal, and keep the rate lower to avoid Euler integration blow-ups. You may just need to scale and push down around zero to avoid a DC offset. Fixed point is at (x,y) = (gamma, mu/gamma)


classmethods::

method::ar

argument::reset
If > 0.0, restart with new initial conditions sampled from initx, inity
argument::rate
update rate for a sample step
argument::mu
equation constant. Set mu > (gamma**2 + 1.0) for the more fun limit cycle regions
argument::gamma
equation constant
argument::initx
reset value for x
argument::inity
reset value for y


Examples::

code::

//listen to x and y output
{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play

//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma
{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play


//fun time, stable oscillation with these parameters
{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.ar(Brusselator.ar(0.0,MouseX.kr(0.01,0.1,'exponential'),mu,0.25)[0] ) )}.play


{ Out.ar(0,Pan2.ar(Brusselator.ar(Impulse.kr(10),MouseX.kr(0.01,0.1,'exponential'),1.5,0.25,MouseY.kr(-1.0,1.0),0.0)[0]) )}.play


{ Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,500,'exponential')),MouseX.kr(0.01,0.1,'exponential'),1.15,0.5,0.5,1.0) )}.play


::