TalesIn20
For this week's Creative Code Challenge by @sableraph: "MesoAmerican”, Talesin20 is coded in P5JS, Hydra, SonicPi. It Translates the current usage of the decimal systems and translates it into the base20 system that was used by the Aztecs: https://mathworld.wolfram.com/Vigesimal.html. While the sound is reflective of the speculative thoughts surronding the Aztec and Mayan Calendars/Crop Circles.
Poem
The base may not be the same
But the propose is still a similar aim
To represent the information around
Pass down
That becomes endowed
Within ourselves
Rhythms within our reflects
Re step in the steps
That merge back to thoughts that deflect
As we merge the patterns hidden
In the rhythm
What was once submerged
Becomes visible once merged
Video Version
Interactive P5: TalesIn20
https://editor.p5js.org/illestknock/full/x3hXK5PEP
Images
Code
p5js
function setup() {
createCanvas(windowWidth, windowHeight);
//PROMPT
x1 = prompt("choose a number between 0 and 159999");
x2 = prompt("choose another number between 0 and 159999");
x3 = prompt("choose a number larger than 159999 or smaller than 0");
x4 = prompt("choose another number between 8000 and 159999");
x5 = prompt("choose any number");
}
//Font
let usedFont = ["fantasy", "monospace", "georgia", "Courier New"];
//ARRAYS For Colors
let fillnumber = ["orange", "yellow", "gold", "red", "pink", "salmon", "coral"];
let fillnumber2 = [
"blue",
"teal",
"skyblue",
"navy",
"turquoise",
"royalblue",
"midnightblue",
];
function draw() {
// numbers in based 20 translation
let numbers = [
based_multi(x1, 20),
based_multi(x2, 20),
based_multi(x3, 20),
based_multi(x4, 20),
based_multi(x5, 20),
];
background("black");
textSize(35);
//Varied Framerate
frameRate(Math.cbrt((second() % 35) + 3));
//Nested for loops to get grid like factor
for (let i = 0; i < windowWidth; i = i + 125) {
for (let j = 0; j < windowHeight; j = j + 150) {
if (i % 15 > 7) {
textFont(random(usedFont));
stroke(random(fillnumber));
strokeWeight((second() % 30) + 5);
fill(random(fillnumber2));
text(random(numbers), i + random(35, 44), j + 10);
} else {
textFont(random(usedFont));
stroke(random(fillnumber2));
strokeWeight(random(second() % 30) + 5);
fill(random(fillnumber));
text(random(numbers), i + 10, j + random(27, 3) + (second() % 3));
}
}
}
}
// allow for fullscreen without switching
function mousePressed() {
if (
mouseX > 0 &&
mouseX < windowWidth &&
mouseY > 0 &&
mouseY < windowHeight
) {
let fs = fullscreen();
fullscreen(!fs);
}
}
//allows for translation into any base system
//takes an int I and translates it to a
function based_multi(i, b) {
return Math.abs(i).toString(b);
}
Hydra
s0.initScreen()
src(s0).pixelate([15,30,100,500,1000,10000].smooth(),[15,30,45,100,1000,10000].smooth()).repeat(10,10)
.diff(src(s0)
.scale([1,1.5,2].smooth())).out()
SonicPi
Tweaked Code & Sound (by Adding a different random seed generator) from a previous Genuary Submission: https://blog.illestpreacha.com/genuary2023generativemusic
#Two chord based functions, one runs on a random assortment, while the other one iterates
def chordsChoose(notes,minMaj,minMaj2,timeChord,dc,st)
play chord(notes.choose, minMaj,decay: dc, sustain: st)
play_pattern_timed chord(timeChord, minMaj2), [0.25,0.5].choose
sleep [1,0.5,0.25,0.5,0.25,1].tick
end
def chordsTick(notes,minMaj,minMaj2,timeChord,dc,ak)
play chord(notes.choose, minMaj,decay: dc, attack: ak)
play_pattern_timed chord(timeChord, minMaj2), [0.25,0.5].tick
sleep [1,0.75,0.5, 0.25].choose
end
#function for the arrangement
def arrangement(sound,bpm,preeffect,intensity,intensity2,loop,effect,effect2,effect3,effect4)
use_random_seed Time.now.to_i
use_synth sound
use_bpm bpm
with_fx preeffect,mix: intensity do
live_loop loop do
with_fx effect, mix: intensity2 do
chordsChoose([:c4,:f4],:minor,:major,[:c5,:c5].tick,0,dice(3))
chordsTick([:d3,:f3],:major,:major,[:f4,:d4].choose,2,1)
end
with_fx effect2, mix: 0.2 do
chordsTick([:g3,:a3,:c3],:major,:major,[:g4,:f4].choose,3,dice(3))
chordsTick([:e4,:a4,:c4],:major,:major,[:g4,:f4].choose,1,2)
end
with_fx effect3 do
chordsChoose([:a3,:g3],:minor,:major,[:a4,:a4].tick,0,dice(3))
chordsTick([:b2,:d2,:f4],:major,:major,[:g4,:f4,:d4].tick,1,dice(2))
end
with_fx effect4, mix: 0.1 do
chordsTick([:f3,:b3],:major,:major,[:f4,:d4].choose,0,2)
chordsTick([:g3,:a3,:c3],:major,:major,[:g4,:f4].choose,3,1)
chordsTick([:d3,:b3],:major,:major,[:f4,:d4].choose,2,3)
end
end
end
end
#treating every arrangement function as if it was a member of an ochestra
arrangement(:piano,60,:hpf,0.2,0.4,:arrangement1,:ixi_techno,:ping_pong,:ixi_techno,:ixi_techno)
arrangement([:fm,:prophet,:pretty_bell].choose,30,:lpf,0.3,0.5,:arrangement2,:ixi_techno,:gverb,:ixi_techno,:krush)
arrangement(:piano,30,:hpf,rrand(0.2,0.3),0.4,:arrangement3,:ixi_techno,:pitch_shift,:ixi_techno,:krush)
arrangement(:piano,15,:ping_pong,rrand(0.1,0.3),0.5,:arrangement4,:ixi_techno,:vowel,:ixi_techno,:ixi_techno)
arrangement([:fm,:prophet,:pretty_bell].choose,15,:ping_pong,rrand(0.1,0.3),0.5,:arrangement5,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)
arrangement(:chipbass,30,:vowel,rrand(0.1,0.3),0.5,:arrangement6,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)
arrangement(:dark_ambience,45,:whammy,rrand(0.2,0.7),0.4,:arrangement7,:ixi_techno,:ping_pong,:ixi_techno,:ixi_techno)
arrangement(:chipbass,15,:vowel,rrand(0.3,0.5),0.5,:arrangement8,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)
#reading of the DipInCodeFirstService
#for csvs larger than 10 mbs use the for reach
require 'csv'
#naming the Dataset DipInCode and going to read the file
Dip = CSV.parse(File.read("C:/Colorscape/DipInCode/SonicPi_CodeBase/Model/DipInCode_FirstService.csv"), headers: true)
#Getting the Ingredients
Merlot = Dip[24]
#Dip[foodname][column].to_f , need to.f as it is to float
with_fx :vowel do
live_loop :Merlot1 do
use_bpm Merlot["Red"].to_f
sample :sn_dub, rate: dice(Merlot["Yellow"].to_f/Merlot["Key"].to_f) if spread(Merlot["Blue%"].to_f,Merlot["Green%"].to_f).tick
sample :ambi_dark_woosh,rate: rrand(Merlot["y2"].to_f,Merlot["Red"].to_f/Merlot["Blue"].to_f) if spread(Merlot["H-Lab1"].to_f,Merlot["CIE-L"].to_f).reverse.mirror
sleep [Merlot["x2"].to_f,Merlot["Yellow"].to_f/Merlot["Mangeta"].to_f,Merlot["Saturation2"].to_f/Merlot["Lightness"].to_f].choose
end
end
with_fx :ixi_techno do
live_loop :Merlot2 do
use_bpm Merlot["Blue"].to_f
with_fx :reverb do
sample :ambi_choir, rate: rrand(Merlot["y2"].to_f,Merlot["Red"].to_f/Merlot["Blue"].to_f) if spread(Merlot["H-Lab1"].to_f,Merlot["CIE-L"].to_f).reverse.mirror
sleep [Merlot["x2"].to_f,Merlot["Green%"].to_f/Merlot["Blue%"].to_f].choose
end
end
end
with_fx :gverb do
live_loop :Merlot3 do
use_bpm Merlot["Green"].to_f
sample :elec_blip, rate: dice(Merlot["Yellow"].to_f/Merlot["Key"].to_f) if spread(Merlot["Blue%"].to_f,Merlot["Green%"].to_f).tick
sample :ambi_dark_woosh,rate: rrand(Merlot["y2"].to_f,Merlot["Red"].to_f/Merlot["Blue"].to_f) if spread(Merlot["H-Lab1"].to_f,Merlot["CIE-L"].to_f).reverse.mirror
sleep [Merlot["x2"].to_f,Merlot["Yellow"].to_f/Merlot["Mangeta"].to_f,Merlot["Saturation2"].to_f/Merlot["Lightness"].to_f].choose
end
end
with_fx :distortion do
live_loop :Merlot4 do
use_bpm Merlot["Red"].to_f
with_fx :reverb do
sample :ambi_choir, rate: rrand(Merlot["y2"].to_f,Merlot["Red"].to_f/Merlot["Blue"].to_f) if spread(Merlot["H-Lab1"].to_f,Merlot["CIE-L"].to_f).reverse.mirror
sleep [Merlot["x2"].to_f,Merlot["Green%"].to_f/Merlot["Blue%"].to_f].choose
end
end
end