Skip to main content

Command Palette

Search for a command to run...

WCCCxGenuary2026_Automata

Cellular Automata With Audio

Updated
3 min read
WCCCxGenuary2026_Automata

AutomataPolis

For this week's Creative Code challenge by @sableRaph & Prompt 9 of Genuary 2026: “Cellular Automata“, AutomataPolis is coded in SonicPi with Cellular Automata rules to compose this soundtrack. While the poetry is coded in with the rules used in CellularPoetry through Python

: (https://blog.illestpreacha.com/genuary2026crazyautomata)

Poem

Beyond Ascending All Over, getting closer to the main goal, almost?

Aiming Towards the Boundaries, Elevating Interstellar ambitions, even above required actions

Below Climbing Coverages above, Taking further from a vague area, barely?

Audio

IllestPreacha · AutomataPolis

Code

SonicPi

def neighboring(naming,looping,timer, timer2)


  #random 10 list array with a seed, to make sure it is always random

  use_random_seed Time.now.to_i / timer
  cells = 25.times.map { Random.rand(0...2)}


  #allows for cell automata rules to include every variable
  cells1 = cells.push(cells[0],cells[1])

  puts cells1

  naming = []

  #length of array and push every neighbor of 3 into the array
  for i in -2..cells1.length-3 do
    naming.push([cells1[i],cells1[i+1],cells1[i+2]])
  end



  #cellular automata rules

  vech = [[0,0,0],[0,1,0],[1,1,1],[0,1,0]]
  elec = [[1,0,0],[0,1,1]]
  drums = [[1,0,1],[1,1,0]]

  x = "F:/Sounds/Vechiles/Remastered/Vech (5).wav"
  x1 ="F:/Sounds/Vechiles/Remastered/Vech (6).wav"
  x2 = "F:/Sounds/Vechiles/Remastered/Vech (7).wav"
  x3 = "F:/Sounds/Vechiles/Remastered/Vech (8).wav"


  live_loop looping do

    use_random_seed Time.now.to_i / timer

    for i in 0..naming.length do
      if drums.include? naming[i]

        with_fx :ixi_techno, mix: [0.1,0.3,0.5,0.25,0.15].tick do
          use_bpm [60,120,30,240].choose
          sample [:drum_bass_hard,:drum_bass_soft,:tabla_ghe2].choose, beat_stretch: [2,3,4].choose
        end

        sleep [0.5,1].choose
      else if vech.include? naming[i]
        sample [x,x1,x2,x3].choose, rate: [-1,0.5,0.25,2].choose
        sleep [0.5,1].choose
      else
        with_fx :flanger do
          sample [:elec_blip,:elec_beep,:elec_soft_kick].choose , rate: [-3, -1,0.5,0.25,-1.75,2,3].choose
        end
        sleep [0.5,1,0.2].choose
      end
    end

  end

  sleep [0.25,0.5,1].choose
end
end

# initalizing variables to pass through

neighboring(@neighbors1,:pass,2,4)
neighboring(@neighbors2,:pass1,3,5)
neighboring(@neighbors4,:pass2,11,64)
neighboring(@neighbors3,:pass3,13,25)

Python & Cellular Automata Rules

Cells

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

Output

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


[-1, 2, 2, 2, -1, -1, -1, -1, -1, 10, 10]
'''
0 = vowel
1 - Consonants
'''

'''
first number holds precedence for the second portion

so if 0 for first ,1 for second = 2
the second must be a synonym for the first word or close

if 1 for the first, 0 for the second = -1
must be an antonym

if the same (0,0) or (1,1) = 10
flip from vowel to constant or vice versas
import numpy as np
import matplotlib.pyplot as plt

C = np.random.randint(low=0, high=2, size=(5, 11))
d = C.tolist()

a = d
plt.imshow(a, cmap='hot', interpolation='nearest')
plt.show()

#NumberCheck

def PoetryPrep(x):


    #x = x.tolist() #turs numpyarrat to list

    x = x + x[:2] #includes first 2 elements to wrap the list for the celluar automata rules


    neighbours = []

    for i in range(0, len(x)-1, 3):

    #range from the index i , with every 3 elements, the 3 different iterations assures that all neighbours get listed
        neighbours.append(x[i:i+3])
        neighbours.append( x[i+1:i+1+3])
        neighbours.append(x[i+1:i+1+3])


    neighbours.pop() #pop the last element

    return neighbours

def AutomataPoetry1(cells):

    AutomataVocab = []

    vowels = [[0,0,0],[1,0,1],[1,1,0],[1,1,1]]

    for i in range(0, len(cells)): #for every element

        if (cells[i] in vowels):
            AutomataVocab.append(0)
            #print(" vowel ")
        else:
            AutomataVocab.append(1)
            #print(" consonant ")
    print(AutomataVocab)

    return AutomataVocab


def AutomataPoetry2(cells):

    AutomataVocab = []

    vowels = [[0,1,0],[1,0,0],[1,1,0],[1,1,1]]

    for i in range(0, len(cells)): #for every element

        if (cells[i] in vowels):
            AutomataVocab.append(0)
            #print(" vowel ")
        else:
            AutomataVocab.append(1)
            #print(" consonant ")

    print(AutomataVocab)

    return AutomataVocab

def FinalAutomataCheck(poem1,poem2):

    AutomataFinale = []

    for i in range(0,len(poem1)):

        if( poem1[i] == poem2[i]):
            AutomataFinale.append(10)
        elif( poem1[i] == 0 and poem2[i] == 1):
            AutomataFinale.append(2)
        else:
            AutomataFinale.append(-1)

    #print(*AutomataFinale)

    return AutomataFinale


FinalAutomataCheck(AutomataPoetry1(PoetryPrep(d[0])),AutomataPoetry2(PoetryPrep(d[1])))

WCCChallenge

Part 14 of 50

Submissions to the WCCChallenge

Up next

WCCC_Factory

Motion in Glitch