# Mathober2023_Internal

# InternalSounds

For the 3rd Prompt Of Mathober: **Internal,** Area will be represented Internal. An *Area* is the interior of a shape. InternalSounds takes the area & circumference/perimeter formulas for ***circles, squares and triangles*** and sonifies them into a **SonicPi Composition.**

## Poem

```ocaml
Shape and Sounds
Escape to be Loud
Loud to elevate
Their Voice
To be heard amongst the Noise
So it doesn’t evaporate
```

## Audio

<iframe width="100%" height="300" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/1642139316&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>

[IllestPreacha](https://soundcloud.com/llestreacha) · [Mathober: InternalSounds](https://soundcloud.com/llestreacha/mathober-internalsounds)

## SonicPi Code

```ruby

#Sonifying the Area of A Circle, Square and Triangle

def circles1(radius,loop)
  
  circumference = 2 * Math::PI * radius
  area = Math::PI * (radius ** 2)
  
  live_loop loop do
    use_random_seed Math.cbrt(Time.now.to_i)
    with_fx :ping_pong,mix: 0.75 do
      with_fx :gverb, damp: 0.5 do
        use_synth :piano
        play [circumference,circumference/2], decay: rrand(1,4)
        sample [:ambi_drone,:elec_beep,:perc_snap,:perc_swoosh].choose, beat_stretch: area / 80,amp: dice(2)
      end
    end
    sleep [0.25,0.5,1,2,4,8].choose
  end
  
end

def triangle(height,base,side1,side2,loop)
  
  perimeter = base + side1 + side2
  area = (height * base) /2
  
  live_loop loop do
    use_random_seed Time.now.to_i
    with_fx :ixi_techno,mix: 0.75 do
      with_fx :vowel, voice: dice(3) + 1 do
        use_synth [:chipbass,:chipnoise].choose
        play [perimeter/2,perimeter/3,perimeter].choose, sustain: dice(3)
        sample [:loop_perc1,:elec_blip2,:tabla_ghe2,:elec_wood,:drum_bass_soft].choose, rate: area / 5 + 0.2
      end
    end
    sleep [0.25,0.5,1,2,4,8].choose
  end
end


def square1(side,loop)
  
  perimeter = 4 * side
  area = side ** 2
  
  live_loop loop do
    use_random_seed Time.now.to_i
    with_fx :ixi_techno,mix: 0.75 do
      with_fx [:ping_pong,:flanger].choose, mix: 0.65 do
        sample [:guit_em9,:tabla_ghe2,:elec_pong,:drum_bass_hard].choose, rate: area / 100, attack: dice(5), amp: dice(2)
      end
    end
    sleep [side,perimeter,side/3,Math.cbrt(perimeter)].choose
  end
  
end


circles1(19,:cir1)
triangle(10,5,26,9,:tri1)
square1(13,:sq1)
circles1(22,:cir2)
triangle(14,33,10,9,:tri2)
square1(16,:square2)
```
