Genuary2026_RecursiveBoxes
Plotting Boxes
Updated
•2 min read
BoxesInMotion
BoxesInMotion is Coded in Python & SonicPi and uses Recursion & Only Boxes(Prompt 12 & 26 of Genuary2026)
Poem
Entities
made of Boxes
Wandering around acting as this Stage
Is theirs
Within their tiers
Ignoring the others that are there
For this is their space
For their paths in their pace
For the Boxes are of one shade
For the Boxes are only Boxes
Video
Code
Python
#original code = https://matplotlib.org/stable/gallery/mplot3d/voxels.html
import matplotlib.pyplot as plt
import numpy as np
import random as rd
def plotting(f):
# prepare some coordinates
x, y, z = np.indices((f, f, f))
# draw cuboids in the top left and bottom right corners, and a link between
# them
cube1 = (x < 3) & (y < 3) & (z < 3)
cube2 = (x >= 5) & (y >= 5) & (z >= 5)
link = abs(x - y) + abs(y - z) + abs(z - x) <= 2
link2 = abs(y - z) + abs(x - z) + abs(y - x) >= 5
colors = ['red','aqua','green','white','orange','violet','black','purple']
palette = rd.choices(colors, k=20)
if f % 2 == 0:
if f % 3 == 0:
voxelarray = cube1 ^ cube2 | link ^ link2
# set the colors of each object
colors = np.empty(voxelarray.shape, dtype=object)
colors[link] = palette[0]
colors[cube1] = palette[1]
colors[cube2] = palette[2]
colors[link2] = palette[12]
else:
voxelarray = cube1 | cube2 | link
colors = np.empty(voxelarray.shape, dtype=object)
colors[link] = palette[3]
colors[cube1] = palette[4]
colors[cube2] = palette[5]
colors[link2] = palette[13]
else:
if f % 5 == 0:
voxelarray = cube1 ^ link ^ link2
colors = np.empty(voxelarray.shape, dtype=object)
colors[link] = palette[6]
colors[cube1] = palette[7]
colors[cube2] = palette[8]
colors[link2] = palette[14]
else:
voxelarray = cube1 | link | link2
colors = np.empty(voxelarray.shape, dtype=object)
colors[link] = palette[9]
colors[cube1] = palette[10]
colors[cube2] = palette[11]
colors[link2] = palette[15]
# and plot everything
ax = plt.figure().add_subplot(projection='3d')
ax.voxels(voxelarray, facecolors=colors, edgecolor='k')
plt.axis('off') # Hide all axes
plt.show()
if f == 20 or f == 21:
return 1
else:
return plotting(f + 1)
SonicPi
live_loop :dosage do
use_random_seed Time.now.to_i
use_bpm [5,20,120,240].choose
with_fx :wobble, mix: 0.25 , amp: 1 do
sample [:ambi_drone,:ambi_glass_hum].choose,beat_stretch: [2,3].choose, rate: [0.5,0.4,0.3,0.2,0.3,0.4].tick
sleep [0.5,1,2].choose
end
end
live_loop :bell do
with_fx :echo, mix: [0.1,0.8,0.3,0.5,0.25].tick do
with_fx :ixi_techno, mix: [0.2,0.7].choose do
use_random_seed Time.now.to_i/2
use_bpm [120,80,220].choose
sample [:perc_bell,:elec_bell].choose, rate: (rrand 0.125,1.5)
sleep rrand(0.2,2)
end
end
end
live_loop :synth do
use_random_seed Time.now.to_i / 3
with_fx [:flanger,:ixi_techno].choose, mix: 0.34 do
sync :bell
use_synth [:chiplead,:chipbass,:piano].choose
play [50,75,100].choose , release: 0.1, sustain: dice(2), cutoff: rrand(60, 120) if spread(7,8).tick
sleep [0.125,0.5,1,2].choose
end
end




