Origin | generative art

25/04/2023 01:07:33 - Philmo

Abstract

Differential growth

Vector maths

Motion equation

Interactions

Water element

Audio engineering

Music theory

Chord progression

Audio reactive

Abstract

Following my creative ideas and research in generative art, computer simulations and electronic music, Origin is a long form creative coding project exploring simple yet complex patterns leading to the formation of generative ecosystems; systems under forces and constraints in which entities emerge making use of their environment to adopting an identity and evolving.

Generative systems are like seeds, they host instructions and rules in a generic yet defined form depending on some external conditions waiting to expand into various outputs having their own identity as an expression of their different genotype . This image somehow speaks to me in an overall appreciation of life and its processes. The living as gained over time the ability to bend spacetime by making use of systems buffering the energy exchanges and fighting against universe’s expanding disarray. In a creative manner, harmony and beauty emerge out of complexity transforming perturbation waves into a symphony of sounds while colors and forms create patterns reaching an equilibrium state.

Where lie our creative origins and our abilities for pattern recognition an invisible yet strong mechanism mirrors a fractal pattern that invites the observer into the play in a soothing way.

Origin make use of motion’s equations, trigonometry and calculus to simulating the behavior of an ecosystem of cells under a constant play of forces, leading them to form patterns.

The idea starts with a few agents in a physic force based environment. Each agent is defined by a position, velocity and acceleration components, a color and a radius. By creating an interplay of forces between these agents which repel and attract each other in the same time, motion is induced creating a form of autonomous drawing agents in an equilibrium state.

The outcome of the sketch is a first surprise leading to the drawing of abstract patterns yet still lacking a form of order. From this point I explore different methods to partly control the path of these agents by adding a grid underneath which act as a distortion map on the forces that modify the motion components of these agents leading to different patterns. By tuning the forces that play between them a new state can be reached forcing agents to adopt positions in a stochastic yet ordered way.

Differential growth

Using differential growth simulation mechanisms I create dozens of agents that are now node objects: sorted elements of a path in the ecosystem. Each nodes have neighbors experiencing mutual attraction forces while an overall force pushes each nodes away from each others forcing them to cluster in the form of cells. Differential growth is the mechanism used by nature to save space in confined environments by creating asperity on the path. In the simulation growth and splitting rules add nodes at positions where the path is bending, creating more asperity and almost following a fractal pattern while evolving.

Playing with these different settings lead to different outputs. And I decided to exclude the growth part of the simulation to find an equilibrium in which each nodes organize to form a blob.

I really like these organic looking blobs which reminds me of colored spots on animals, strong patterns witnessing evolution.

Vector maths

Since I have been using Vanilla JS (no libraries) and html5 canvas doing a lot of computations on multidimensional datas, I decided to create a helper class Vector implementing the definition of each vector operations and making easier to read the code and to chain operations.

Motion equation

This class is used to define node’s motion components and to apply the different forces using a simple differential equation f = ma and numeric integration. Applying physics rules to the ecosystem gives the simulation an organic look through the different motions.

Interactions

In the interplay of forces I decided to consider 5 different conditions on the Nodes:

  • attraction and repel each other
  • repel closest Nodes
  • attract neighbors
  • curvature and alignement, controls the bending of the path
  • sinusoïdale wave force

By tuning the different ratios of each forces the system reach an equilibrium state while the Path entities adopt forms to adapt to the virtual environment.

Water element

I started experimenting with several path together on which again different forces are applied, creating new interplays and behaviors. The different nodes of each Paths repel each others upon a defined distance while an overall attraction force cluster the paths together at the center of the canvas. Knowing the location of each nodes, the Path center of mass can be computed and a repellent force is applied between them preventing them from overlapping.

These different forces are applied on the acceleration components of each nodes forming the path with steering behavior and at an intensity proportional to the inverse squared distance scaled by a force factor when repelling and by a factor proportional to the distance of each node when clustering.

Sinusoïdale waves emerging from the center of the canvas shake the Nodes periodically in an organic looking manner like if the Paths were in a living liquid ecosystem almost adopting a rythme driven by music beats or creating water like sounds out of the interactions.

It’s then mandatory to add a musical dimension to the system.

Audio engineering

Generating audio in native Javascript is made possible by the controls of different signals, gains and effects, as if really playing with electronics and different waves. Oscillators uses complex mathematics to producing sinusoidale waves that renders to the audiocontext and this element is the basis of all music synthesis.

It’s by shaping this constant signal that we can create sounds, rythmes and music. All waves including music can be rationalized to a perturbation like a rock thrown into still water would create ripples and waves. By measuring the height the wave height at a moment in time we can speak of amplitude while the time needed for a wave to go from its minima to maxima would be defined by frequency.

The magic happens when waves are modulated by another signal, and I decided to use a technic called frequency modulation where the ryhtme at which the oscillator oscillate is controlled by another oscillator with lower frequencies.

The overall sound generation in Origin come from the implementation of different javascript classes in which different methods are chained to produce an audiograph. It reminds me of old music synthesizer where the different sounds are created by patching different inputs and outputs with cable. The use of classes make easier to chain, associate or patch recursively audio elements to creating the desired sounds.

Origin is made of 5 frequency modulation synthesizers each of them made of 10 oscillators which signal is shaped by Envelopes; an audio node which controls the intensity of the signal at different moment of time or more precisely elements like the pitch and duration of note playing. We can dissect this process in different steps called ADSR for attack, decay, sustain and release, variables that measures the time between the different phases.

Tuning these different parameters defines the character of the sound. For example with a low attack time the wave will reach its maxima quickly after a note is triggered creating a punchy effect that can be shaped further with the other parameters.

The 5 synthesizer used in Origin were tuned to obtain instrument like sounds or effects which different frequencies associate harmonically to creating an atmosphere and soundscapes. From a general javascript class defining the basis of an FM synthesizer other classes are extended creating the other instruments such as a Drone, a Pad, a Lead, Bell, Stab and effects.

Playing lower octave notes the drone is like a bass instrument playing successively the same chord without triggering the release of the wave creating the same way a warm deep background noise.

Widening the feeling of space and dimension in sounds, a Pad is a synthesizer with a high attack time creating soundscape that surrounds the different sounds. The stab and bell are punchy instruments playing notes with low duration to creating clipping effects like the sounds of water droplets while the lead fill the space with resonating medium frequencies.

All instruments sounds are then amplified with effects also implemented from scratch in javascript in the form of classes which methods can be chained or associated recursively while different parameters of audio elements are patched to creating other effects.

A Chorus effect is applied to each synthesizer modulated by a low frequency oscillator that acts on the timing of a delay effect creating more room to the sound. Creating a form of echo, a PingPongDelay balance the audio signal between left and right and giving the same way new tempos and emphasizing the simulation of a space in which the sound of instruments spread to slowly fade.

The overall atmosphere of origin is created by turning off the audiosignal at random intervals and load it into a buffer to later render it at lower speed creating a bouncing effect that rhythms the music in syncopation with the main beat.

The audio from each synthesizer is routed to a compressor that controls the overall volume of the music and which different settings give different character to the audio at the step of mastering reducing undesirable frequency and amplifying the core.

Music theory

Applying Western music theory Origin is a generative music systems in which every outputs will produce different sounding music by making use of small algorithm that interpret music notation and rules, coded from scratch in javascript.

Making use of the deterministic stochasticity of blockchain, a random key is picked associated with a flavor (major, minor) to generating its music scale with a function. The scale is then used to build chords, retrieving the root, 3rd, 5th, 7th and 9th notes which will be triggered at the same time passing each note frequency to a different oscillator across the 5 synthesizers.

Chord progression

Amongst 96 possible musical variations every outputs are made of chords progressions following the circle of fifths while randomly voicing up or down the root, third or fifth chord note creating more than thousands of different atmosphere regardless of the flavor or key picked randomly with each different outputs. By randomly selecting a chord type combined with degrees, it’s amongst 5 of these possible variations that the progression is built according to the circle of Fifths; Each degrees mapped to a note and defining the next one.

Following the same progression between the different instruments, chords are voiced up or down differently with a random pattern. Voicing a chord creates different atmosphere and musical characters by increasing or decreasing the note an octave up or down and creating the same way an infinite amount of variations between the different progressions of each outputs.

Origin make use of a sequencer in the form of timing functions humanized by offseting randomly the time between the trigger of the attack and the trigger of the release while the bell and stab are triggered at random intervals on a 50% chance each ish. Between each chord transition the delay time and feedback of effects such as Delay and PingPongDelay randomly vary differently between each instruments to create different tempo.

Audio reactive

Visual and sound interactions are created by increasing the amplitude of the sinusoidale wave force according to the overall amplitude of the sound across all frequencies. Making use of Fast Fourier Transformation, the audio signal from master output is analyzed in real time creating audio reactive wave that propagate across the canvas shaking entities in harmonic manner.

Origin is a living simulation witnessing to the power of the natural world and of the infinite possibilities that arise when the dynamic tension between creativity and constraints meet.

Generative Ordinal


Comments