Kofi / Illestpreacha
Code is Poetry & Data is Poetry

Follow

Code is Poetry & Data is Poetry

Follow
Genuary2023_Sine

Genuary2023_Sine

Sinefulness

Kofi / Illestpreacha's photo
Kofi / Illestpreacha
·Jan 15, 2023·

1 min read

The prompt for Genuary 2023 Day 15 is

Sine waves

For today's Prompt, I will be using sin functions within SonicPi & Hydra

Hydra Code

noise().colorama(()=> Math.sin((time % 30+ 1)/30))
  .modulateRotate(voronoi(21,()=> Math.sin(mouse.x),0))
  .modulateScale(noise(()=> Math.sin(mouse.y)))
  .modulateRotate(osc(()=> Math.sin(time % 29)/Math.sin(29 - Math.sin(time % 23)),3,1),1)
  .out()


speed = 0.000125

SonicPi Code

def Sine_ing(looping,samp1,samp2,samp3)
  rangeFul = (0..17).to_a.shuffle() #shuffling a range of numbers from 0 to 17 into an array
  #setting counters
  i = 0
  j = rangeFul.length()

  #setting the live loop
  live_loop looping do

    with_fx :echo, mix: Math.sin(j).abs do
      with_fx :distortion,mix: Math.sin(i).abs do
        #If the sin makes the number a negative
        if Math.sin(rangeFul[i]) > 0
          sample [samp1,samp3].choose,rate: Math.sin(rangeFul[i])
        end
      end
    end


    with_fx :ping_pong, mix: Math.sin(i).abs do
      #If the sin makes the number a positive
      if Math.sin(rangeFul[i]) >  0
        sample [samp2,samp3].choose
      end
    end

    with_fx :ixi_techno, mix: Math.sin(j).abs do
      with_fx :vowel, mix: Math.cos(j).abs do
        #If the sin makes the number 0
        if Math.sin(rangeFul[i]) == 0
          sample [samp1,samp2].choose
        end
      end
    end


    i += 1

    if i >= rangeFul.length()
      i = 0
    end

    j -= 1

    if j <= 0
      j = 0
    end

    sleep [Math.sin(i).abs + 0.25,Math.sin(j).abs + 0.25].choose #to avoid the issue with zero

  end
end

sample

Sine_ing(:SineFul,:tabla_ghe5,:drum_bass_soft,:elec_blip)
Sine_ing(:SineFul2,:ambi_dark_woosh,:perc_snap2,:glitch_perc5)
Sine_ing(:SineFul3,:ambi_piano,:ambi_haunted_hum,:vinyl_backspin)
 
Share this