·

# ObscureTerrain

For this week's Creative Code Challenge by @sableraph: "Obscure", ObscureTerrain is coded in Hydra, LiveCodeLab & SonicPi to Represent a realm full of obscured traits.

## Obscuring Process

• The genre of the sound coded in SonicPi is meant to be obscured. What is it? Is it even a genre that can be found on Spotify Wrapped, YouTube Recap or Apple Music Year Review?

• The main sound heard comes from using various Linear Algebra techniques to further the idea of an obscured way to design sounds.
• Through Hydra & LiveCodeLab, This terrain is obscured through many geometric shapes and the lasting effect they have. How was this realm originally designed: is it possible to go back?

## Poem

``````What is the Eye Focusing on?
What is the sense of touch, rotating upon?
What is obscured in the smell of the place
Or even in the taste of the space?
We may never know
We may always know
But the information
That portion
Sorting
Is an on going rotation
Investigation
``````

## Code

### SonicPi - Linear Algebra Exploration

``````live_loop :matrix do

use_random_seed (Time.now.to_i)

matrix1 = [[rrand(-5,3),0,dice(3)],[rrand_i(-4,4),dice(4),rrand(-3,4)],[rrand(-2,4),-1,0]]

#determinant
a = matrix1[0][0]
b = matrix1[0][1]
c = matrix1[0][2]

d = matrix1[1][0]
e = matrix1[1][1]
f = matrix1[1][2]

g = matrix1[2][0]
h = matrix1[2][1]
i = matrix1[2][2]

#determinant formula
det_a = a*(e*i - f*h) - b*(d*i - f*g) + c*(d*h - e*g)

use_synth :piano
play (det_a).abs

#matrix math

mat_add_A = a + d + g
mat_add_B = b + e + h
mat_add_C = c + f + i

#scalar

use_synth :piano

sleep [0.25,0.5,1,1.5,2,4,8].choose
end

live_loop :dotproduct do

#dot product formula - scalar

use_random_seed (Time.now.to_i) / 3

matrix2 = [[rrand(-5,23),12],[dice(14),rrand(-3,4)]]

#vector length, pythagros of multiple dimension

vector_subspace = [rrand(-3,5),dice(7),rrand(-2,8),dice(3),dice(4)]

for i in 0..vector_subspace.length - 1 do #give constraints for the loops
var = vector_subspace[i]   #variable
var *= var #updating
vector_subspace[i] = var #equals the square
total = vector_subspace.sum #sums the total after each iteration
puts total
vec_length = Math.sqrt(total)
puts vec_length
end

#dot product break down

ax = matrix2[0][0]
ay = matrix2[0][1]
bx = matrix2[1][0]
by = matrix2[1][1]

ab = (ax * bx)  + (ay * by)
det_ab = (ax * by) + (ay * bx)

use_synth :piano
play (ab).abs / 2, decay: vec_length

use_synth :prophet
play (det_ab).abs

with_fx :ping_pong, mix: rrand(0.1,0.6) do
sample :glitch_perc5 , rate: vec_length, pitch: (det_ab).abs % 16
sample :elec_filt_snare , rate: vec_length, pitch: (det_ab).abs % 16
sample :drum_cymbal_closed, rate: 0.5, decay: (det_ab/vec_length).abs % 7
sample 'C:/Audio/Rambling/JungleJazz.wav',beat_stretch: vec_length, rate: Math.sqrt(dice(25) + 1)/3
end

sleep [0.25,0.5,1,2,4].choose
end
``````

### SonicPi - Chaotic Overlaying

``````live_loop :rollback2 do
#making true random as it goes with the actual time
#then using the Math.cbrt to make it a different seed ratio then the above function
use_random_seed Math.cbrt(Time.now.to_i)
use_bpm 75
puts Time.now.to_i
with_fx [:echo,:whammy,:ixi_techno].choose, mix: rrand(0.1,0.6) do
with_fx :ping_pong, mix: rrand(0.1,0.9) do
sample"C:/SonicPi/SocaRiddims/WaterMelonRiddim_Wav.wav",amp: 7, rate: Math.sqrt(dice(25) + 1)/3
sample"C:/SonicPi/SocaRiddims/WaterMelonRiddim_Wav.wav",amp: 7, rate: 0.9 * (Math.sqrt(dice(25) + 1)/3)
sample"C:/SonicPi/SocaRiddims/WaterMelonRiddim_Wav.wav",amp: 1.2, rate: 0.75 * (Math.sqrt(dice(25) + 1)/3)
sample"C:/SonicPi/SocaRiddims/WaterMelonRiddim_Wav.wav",amp: 3, rate: 0.85 * (Math.sqrt(dice(25) + 1)/3)
sample"C:/SonicPi/SocaRiddims/WaterMelonRiddim_Wav.wav",amp: 3, rate: 0.95 * (Math.sqrt(dice(25) + 1)/3)
sample"C:/SonicPi/SocaRiddims/WaterMelonRiddim_Wav.wav",amp: 3, rate: 1.05 * (Math.sqrt(dice(25) + 1)/3)
sleep [128,64,96].choose
end
end
sleep [0.5,1,2].choose
end
``````

### Hydra

``````s0.initScreen()

``````

### LiveCodeLab

``````rot = time / 5

animationStyle paintOver

if time % 8 > 4
ambientLight 255
noStroke
if time % 8 < 4
stroke red
ambientLight 124- ((time % 30)*3), 90, 110 + ((time % 23) * 4)

ringDetail = 11
if time % 10 > 5
fill orange

if time % 10 < 5
fill yellow

if time % 12 < 6
rotate rot,Math.hypot(rot, time  % 10)
scale 0.7

if time % 12 > 6
rotate rot, Math.sqrt(rot), rot
scale wave(0.03)

9 times with i
rotate (time / 5) + i
ringDetail times
rotate wave(0.03), Math.cbrt(i), (2 * pi) / ringDetail
move 2*i, i, i/5
rect abs(tan(1 - time % 5)), 0.3 + (1 / ringDetail)
if time % 14 > 7
fill blue
else
fill red
stroke white
animationStyle motionBlur
rect  Math.hypot(0.3, (3 / ringDetail)),abs(tan(3 - time % 6)),0
``````