First longboard session after winter with Sonic Pi live coded music YT



# 260404 2307 First longboard session after winter with Sonic Pi live coded music YT
# Saved 260404 2307
# https://in-thread.sonic-pi.net/t/first-longboard-session-after-winter-with-sonic-pi-live-coded-music-yt/9966
# https://youtu.be/C8_gdPZz61Q

/ First longboard session after winter /

# Creates a #### bar to visual show filter value in log
define :bar do |val, max=130, width=13|
  filled = (val.to_f / max * width).round
  empty  = width - filled
  "Cutoff: [" + "#" * filled + " " * empty + "] #{val.round}"
end


use_bpm 68
set_volume! 0.5
with_fx :reverb, room: 0.7 do
  with_fx :lpf, cutoff: 100 do |lpf|
    with_fx :flanger, mix: 0.7 do
      with_fx :ping_pong, mix: 0.4, feedback: 0.8 do
        with_fx :krush, mix: 0.1 do
          
          live_loop :a2 do
            tick
            
            l = 16
            control lpf, cutoff: c = knit(60,l,80,l,100,l, 120,l).look
            # control lpf, cutoff: c=line(60,110,steps: 64).look
            puts bar(c) if spread(1,l).look
            
            use_synth :saw#:prophet
            use_synth_defaults release: [0.1,0.2,0.4].choose+0.2, cutoff: [60,70,80,90,110].choose
            k = 32
            play scale(:c2, :mixolydian).take(1).look+[0,0,0,0,12].look+knit(0,k*3,-2,k).look,amp: 1+rdist(0.3), pan: 0.5 if spread(3,5).look
            play scale(:c2, :mixolydian).take(1).look+[0,0,0,0,12].look+knit(0,k*3,-2,k).look,amp: 1+rdist(0.3), pan: -0.5 if spread(3,5).look
            sleep 0.25
          end
          
          live_loop :a1 do
            tick
            
            u = 1
            use_random_seed u+tick
            puts "a=",a = rrand_i(1,8)
            puts "b=",b = rrand_i(1,8)
            
            use_synth :square
            b.times do
              use_synth_defaults release: [0.1,0.2,0.4].choose, cutoff: 60
              play scale(:c4, :mixolydian).choose, amp: 1.2+rdist(0.3)
              sleep 0.25
            end
            
            use_synth :saw
            a.times do
              use_synth_defaults release: [0.1,0.2,0.4].choose, cutoff: 90
              play scale(:c5, :mixolydian).choose,amp: 1+rdist(0.3)
              sleep 0.25
            end
          end
          
        end
      end
    end
  end
end