To All Our Known Energies

May 6, 2021 1:10 PM

Downtempo ambient generative probabilistic instrumental.

Made in SonicPi.

Code:
#To All Our Known Energies
duration = 270.0
with_bpm 30 do
  chord1 = (chord :G, :add4)
  chord2 = (chord :D, :add4)
  chord3 = (chord :D, :sus4)
  chord4 = (chord :E, :m11)
  set :thechord, chord1
  progression = [chord1, chord1, chord2, chord3, chord2, chord4]
  
  live_loop :main do
    if vt > duration
      stop
    end
    thechord = progression.tick(:prog)
    set :thechord, thechord
    with_synth :pluck do
      with_fx :octaver, subsub_amp:0.1 do
        play_chord(thechord, decay:6, attack:0.1, pan: 0, amp: 1-vt/240)
      end
    end
    sleep 2
  end
  
  live_loop :melody do
    if vt > duration*0.8
      stop
    end
    thechord = get[:thechord]
    with_synth :dark_ambience do
      with_fx :distortion, amp:0.25 do
        with_fx :echo, phase: 1.0/8*1.5, decay:choose([1,1,1,2,6]) do
          thechord.each do |note|
            if one_in(3)
              play note,  amp: 0.75, decay: 1, pan: 0.2
              if one_in(4)
                time_warp -0.25 do
                  play note+12,  amp: 0.65*vt/duration, decay: 2, pan: -0.3
                end
              end
            end
            sleep 0.5
          end
        end
      end
    end
  end
  
  
  live_loop :morechords do
    if vt > duration*0.9
      stop
    end
    thechord = get[:thechord]
    thechord = chord_invert(thechord, choose([-1,0,1]))
    with_synth :dark_ambience do
      with_fx :octaver, mix:0.25 do
        #with_fx :distortion do
        with_fx :gverb do
          with_fx :tremolo, phase:4, wave:0, depth: 1 do
            if vt>duration*0.1
              play_chord(thechord, decay:6, amp:0.1*vt/duration, pan:-0.25)
            end
          end
        end
      end
      #end
    end
    sleep 3
  end
  
  
  with_fx :tremolo, phase: 0.25, depth: 1, wave:1 do
    live_loop :beat1 do
      if vt > duration*0.85
        stop
      end
      with_fx :echo, phase:1.0/4*1.5, decay: 1.0/8 do
        if one_in(3)
          sample :drum_bass_hard, amp:0.25, pan: -0.5
          sleep 1
        else
          sample :drum_heavy_kick, amp: 0.25, pan: 0.5
          sleep 0.25
        end
      end
    end
    live_loop :beat2 do
      if vt > duration*0.80
        stop
      end
      if vt > duration*0.15
        sample :drum_splash_soft, amp:0.25*(1-vt/duration), pan: -0.25, attack:0.1
      end
      sleep 12
    end
    
    
    
    live_loop :beat3 do
      if vt > duration*0.85
        stop
      end
      if vt > duration*0.35
        sample :loop_mika, beat_stretch: 8, amp: 0.75*vt/duration, pan: 0.25
      end
      sleep 8
    end
    
    live_loop :gtr1 do
      if vt > duration
        stop
      end
      thechord = get[:thechord]
      delta = thechord[0] - 66
      with_fx :distortion, amp:0.25 do
        sample :guit_e_fifths, pitch:delta, amp:3*(1-vt/duration)
        sleep 4 * choose([1,1,2,3])
      end
    end
  end
  
  live_loop :bass do
    if vt > duration*0.97
      stop
    end
    thechord = get[:thechord]
    thenotes = [thechord[0], thechord[1]]
    with_synth :piano do
      with_fx :gverb do
        with_fx :pitch_shift, mix:0.25, pitch:12.1 do
          play(thenotes.tick(:bass)-12*2, amp: 0.03, decay:4, attack:0.25)
          sleep 2
        end
      end
    end
  end
  
  arptimes = [0.75,0.75,0.25,1,0.75]
  live_loop :arp do
    if vt > duration*0.75
      stop
    end
    thechord = get[:thechord]
    thechord.each do |note|
      with_synth :hollow do
        with_fx :flanger do
          with_fx :gverb do
            if vt > duration*0.25
              volume = vt/duration*0.5
              play(note+12, amp: volume)
              play(note+24.1, amp: volume)
            end
            sleep arptimes.tick(:arptimes)*2
          end
        end
      end
    end
  end
end

posted by signal (4 comments total) 2 users marked this as a favorite

This is great. That occasional dissonant touch that I *think* comes from that "two octaves plus a little nudge" in the arp is nice.
posted by ignignokt at 6:12 PM on May 6 [1 favorite]


Clever stuff. Basically magic to me how this sort of thing works.
posted by srednivashtar at 2:32 AM on May 7 [1 favorite]


ignignokt: " I *think* comes from that "two octaves plus a little nudge""
Exactly!

Thanks for the kind comments.
posted by signal at 6:03 AM on May 7


This is lovely, really enjoy the vibe of it.
posted by greenish at 12:02 PM on May 7 [1 favorite]


« Older Ambient Office v5: LoopLoopLoop   |   All This Static Under Clouded Skies Newer »

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