SuperCollider CLASSES (extension)


dynamical system simulation (Newtonian gravitational force)
Inherits from: UGen : AbstractFunction : Object

//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, 


Eight fixed masses around a boundary apply Newtonian gravitational force dynamics to a central moving mass which cannot escape the [-1, 1] grid in x or y. The position of the moving mass is sonified as an oscillator by its distance from the centre.

This is a relatively expensive oscillator to run.

Note: This original GravityGrid contains an erroneous folding function, and gravity which is more attractive as the distance increases! Which however, adds interesting distortions to the sound. See GravityGrid2 for a cleaned up version. This one is retained for backwards compatibility.

Class Methods

*ar (reset: 0, rate: 0.1, newx: 0, newy: 0, bufnum, mul: 1, add: 0)



Restart the moving mass at a random position within the square (k-rate input)


amount of position update per sample (k-rate)


kr input to be sampled for new x positions for the moving mass on reset


kr input to be sampled for new y positions for the moving mass on reset


Bufnum for a buffer containing weights for the different outer masses indexed as 0-3 and 5-8 and central moving mass 4. Passing -1 means that the weights are not used (are flat).

Inherited class methods

Instance Methods

Inherited instance methods


//GravityGrid comes out with some interesting noisy sounds- WARNING, loud, aliasing! You'll probably want to filter the outputs, maybe with RLPF, Slew et al.



//rhythmic violence


//48k spectrum looping

b = Buffer.alloc(s, 9, 1); //weights buffer

b.setn(0,Array.rand(9,0.1,0.9)); //set weights

{*,,1,'exponential'),,0.8),,0.8), b.bufnum),0.0)}.play

b.setn(0,Array.rand(9,0.1,0.9)); //change weights to new random values

b.setn(0,[0.1,1,0.1,2,0.1,3,0.1,4,0.1]); //change weights to new specific values

{0.1*[0.2,0.3],70,80)),[11.2,12.5],,0.4),,0.8), b.bufnum),,0,300,500),,0,0.3,0.4))}.play