WCCC_Spiral

WCCC_Spiral

Spiralling

SpirallingGraph

For this week's Creative Code challenge by Raphaël de Courville :" Spiral ”, SpirallingGraph is Coded in Python, SonicPi & Hydra.

Poem

To get past
Into the land that vast
Sustaining motions that can be able last
Be hold , for the times
That we take a pause
To rewind
Where does the Spiral act false?

Video

Code

Hydra


s0.initScreen()

src(s0).rotate(()=> time % 18).repeat(3,3
).modulateScale(src(s0),[0.25,0.5,0.75,1].smooth())
.add(src(s0).scrollX([-0.25,-0.5,0.5,0.25].smooth())
.scrollY([0.5,-0.35,0.15,-0.35,0.5].smooth())).out()

Python


import matplotlib.pyplot as plt
import numpy as np


def spiral(N, div_1, div_2, color1, color2,color3):

    # Compute areas and colors
    r = 2 * np.random.rand(N)
    theta = 2 * np.pi * np.random.rand(N)
    area = (50 * r* r)/ div_1
    colors = theta / div_2

    fig = plt.figure()
    #fig1 = plt.figure()

    ax = fig.add_subplot(projection='polar')
    ax1 = fig.add_subplot(projection='polar')
    ax2 = fig.add_subplot(projection='polar')

    c = ax.scatter(theta, r, c=colors, s=area, cmap= color1, alpha=0.675)
    c1 = ax1.scatter(theta/2, r, c=colors, s=area, cmap= color2, alpha=0.475)
    c1 = ax1.scatter(theta/1.5, r, c=colors, s=area/2, cmap= color3, alpha=0.375)


spiral(350,1.5,2.25,'gist_earth_r','gist_earth_r','gist_earth_r')
spiral(50,2,1.25,'ocean','ocean','ocean')
spiral(350,2,1.25,'ocean','ocean','ocean')
spiral(150,2,1.25,'ocean','ocean','ocean')
spiral(150,2,1.25,'YlOrRd_r','gist_earth_r','ocean')
spiral(250,2,1.25,'YlOrRd_r','gist_earth_r','ocean')

SonicPi (SpedUp)

#using 6 circles to make the sound


def circles1(radius,loop)

  circumference = 2 * Math::PI * radius
  area = Math::PI * (radius ** 2)

  live_loop loop do
    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), amp: 2
        sample [:ambi_drone,:elec_beep].choose, beat_stretch: area / 80,amp: dice(5)
      end
    end
    sleep [0.25,0.5,1,2,4,8].choose
  end

end

def circles2(radius,loop)

  circumference = 2 * Math::PI * radius
  area = Math::PI * (radius ** 2)

  live_loop loop do
    with_fx :ixi_techno,mix: 0.75 do
      with_fx :vowel, voice: dice(3) + 1 do
        use_synth :chipbass
        play [circumference/2,circumference/3,circumference].choose, sustain: dice(3), amp: 2
        sample [:tabla_ghe2,:elec_pong,:drum_bass_hard].choose, rate: area / 100, attack: dice(5), amp: dice(5)
      end
    end
    sleep [0.25,0.5,1,2,4,8].choose
  end

end


circles1(2,:circle1)
circles2(4,:circle2)
circles2(5,:circle3)
circles1(7,:circle4)
circles2(9,:circle5)
circles1(12,:circle6)