Let's Go To War

April 7, 2021 6:03 PM

Generative piece made in Sonic Pi. Was aiming for a jazzy feel, ended up sounding more modernistic.

It's a I-IV-V-IV-I progression, using minor pentatonic scales, and sus4 chords and chord-notes over that, with quite a bit of randomness.

Code:
totaltime = 150.0
live_loop :main do
  if vt > totaltime
    stop
  end
  progression =  [0, 5, 7, 5, 0]
  for deg in progression
    thetimes = [1, 1, 1.25, 0.25, 0.75, 1, 1, 1]
    if not one_in(3)
      thescale = (scale :D+deg-24, :minor_pentatonic)
    else
      thescale = (scale :D+deg-12, :minor_pentatonic).reverse
    end
    set :dascale, :D+deg
    use_synth :piano
    volume = vt/20-0.5
    if volume > 1
      volume =1
    end
    if volume < 0
      volume = 0
    end
    time_warp rand()/10-0.05 do
      play (chord :D+deg-24, :sus4), sustain: 8, sustain_level:1, pan:1, amp:volume
    end
    with_fx :gverb do
      for i in range(1,8)
        play thescale[i],  sustain: 4,  hard: 0.8, stereo_width: 1, amp: volume/5.0, pan: 0.25
        sleep thetimes[i]
        if one_in(3)
          play (chord thescale[i], :sus4) ,  sustain: 4,  hard: 0.8, stereo_width: 1, amp: volume/3.0, pan: -0.25
        end
      end
    end
  end
end

live_loop :beat do
  if vt > totaltime-20
    stop
  end
  thetime = [1, 1, 1, 1]
  time_warp rand()/10-0.05 do
    if rand()+0.2>vt/totaltime
      with_fx :reverb do
        with_fx :echo, phase: 0.25, decay: 1.0 do
          with_swing 0.2 do
            sample :drum_cymbal_soft, amp:0.1+rand/5, pan: -vt/totaltime
          end
        end
      end
    end
  end
  sleep thetime.tick(:drumtime)
end

live_loop :stick do
  if vt > totaltime-30
    stop
  end
  thevols = [0,0,0,0,1,1,1,0,0,0,1]
  with_swing 0.1, pulse: 3 do
    if vt > 20
      sample :tabla_te_m, amp:thevols.tick(:stick)/4.0, pan: 0.2
    end
  end
  sleep 0.75
end


live_loop :beat2 do
  if vt > totaltime-10
    stop
  end
  sleep 0.5
  if rand() totaltime-30
    stop
  end
  sleep 0.5
  if rand() totaltime
    stop
  end
  volume = vt/40-1
  if volume > 0.3
    volume =0.3
  end
  if volume < 0
    volume = 0
  end
  
  use_synth :blade
  thenote = (chord (get :dascale), :sus4).tick(:notesolo)
  thetime = [1.0, 1.0, 0.25, 0.75].tick(:timesolo)
  t = [1,1,1,1,2,2,3,4].choose
  t.times do
    play thenote, sustain: t*2.0, amp: volume, pan:0.2, attack:0, sustain:0.5, release:0.125
    sleep thetime/t
    with_swing 0.1 do
      play thenote+[-12,0,7,7,7,5,5,5,12,24].choose, pan:-0.2, amp: volume, attack:0.25, sustain:1, release:0.25
    end
    if one_in(8)
      use_synth :piano
      with_swing 0.2, pulse: 3 do
        with_fx :echo, phase: t/4.0, decay: t/2.0, mix:0.25 do
          play (chord thenote, :sus4),  pan: -0.1, amp: volume, attack:0.0, sustain:1, release:1
        end
      end
    end
  end
end

posted by signal 1 user marked this as a favorite

« Older Dishonest Used Car Salesman   |   Cuban Heels Newer »

You are not logged in, either login or create an account to post comments

On Playlists

gt2_1