"Photophobia" - a simple, stable random-on-rails song

I wanted to test out the randomization options to see if I could generate a simple loop that changed slightly as it played. I made it repeat in a somewhat predictable way, not really making it complex at all. I made this at 60BPM, but it seems to work pretty well at higher tempos. The result to me sounds like the slow onset feeling of being overwhelmed by sunlight.

# useful globals

use_synth :prophet

amp = 0.5

#key and scale
root = :as1
notes = choose([:m, :m7, :M7, :M, 'm+5'])

# initiate global randoms

#drums
one = rrand_i(1, 101)
oneand = rrand_i(2, 102)
two = rrand_i(3, 103)
twoand = rrand_i(4, 104)
three = rrand_i(5, 105)
threeand = rrand_i(6, 106)
four = rrand_i(7, 107)
fourand = rrand_i(8, 108)

#chords
onec = choose(chord(root, notes))
twoc = choose(chord(root, notes))
threec = choose(chord(root, notes))
fourc = choose(chord(root, notes))

#randomizer functions

#drums
define :rando do
  one = rrand_i(1, 101)
  oneand = rrand_i(2, 102)
  two = rrand_i(3, 103)
  twoand = rrand_i(4, 104)
  three = rrand_i(5, 105)
  threeand = rrand_i(6, 106)
  four = rrand_i(7, 107)
  fourand = rrand_i(8, 108)
end

#chords
define :randoc do
  onec = choose(chord(root,  notes))
  twoc = choose(chord(root, notes))
  threec = choose(chord(root, notes))
  fourc = choose(chord(root, notes))
end

#interation variables
count = 1
ccount = 1

#big effects
with_fx :gverb, spread: 1, room: 100, release: 10, mix: 0.5, damp: 0, amp: 0.5 do #big 'verb
  with_fx :compressor, mix: 1, amp: 1 do #throbby
    with_fx :eq, low_shelf: 1.25, low: -1, mid: -0.5, high: 1 do #beefy, mid scooped
      with_fx :bitcrusher, bits: 24, sample_rate: 44000, mix: 1 do #12 bit does that Justice thing when used with distortion
        with_fx :distortion, distort: 0.0, mix: 0.25, amp: 0.75 do #optional distortion
          
          #everlasting loop
          live_loop :loop do
            
            #update chord notes
            notes = choose([:m, :m7, :M7, :M, 'm+5'])
            
            #big washy crashy sound
            sample :drum_cymbal_open, attack: 0.2, beat_stretch: 3
            sample :drum_cymbal_open, attack: 0.2, beat_stretch: 5
            
            #play the chord progression twice
            8.times do
              
              #build chords
              if ccount == 1 or ccount == 5
                play onec, sustain: 7, amp: amp, attack: 0.2
                play onec + 5, sustain: 7, amp: amp, attack: 0.2
                play twoc + 12, sustain: 7, amp: amp, attack: 0.2
                play onec + 17, sustain: 7, amp: amp, attack: 0.2
                play twoc + 24, sustain: 7, amp: amp, attack: 0.2
                play onec - 12, sustain: 7, amp: amp, attack: 0.2
              end
              if ccount == 2 or ccount == 6
                play twoc, sustain: 7, amp: amp, attack: 0.2
                play twoc + 5, sustain: 7, amp: amp, attack: 0.2
                play threec + 12, sustain: 7, amp: amp, attack: 0.2
                play twoc + 17, sustain: 7, amp: amp, attack: 0.2
                play threec + 24, sustain: 7, amp: amp, attack: 0.2
                play twoc - 12, sustain: 7, amp: amp, attack: 0.2
              end
              if ccount == 3 or ccount == 7
                play threec, sustain: 7, amp: amp, attack: 0.2
                play threec + 5, sustain: 7, amp: amp, attack: 0.2
                play fourc + 12, sustain: 7, amp: amp, attack: 0.2
                play threec + 17, sustain: 7, amp: amp, attack: 0.2
                play fourc + 24, sustain: 7, amp: amp, attack: 0.2
                play threec - 12, sustain: 7, amp: amp, attack: 0.2
              end
              if ccount == 4 or ccount == 8
                play fourc, sustain: 7, amp: amp, attack: 0.2
                play fourc + 5, sustain: 7, amp: amp, attack: 0.2
                play onec + 12, sustain: 7, amp: amp, attack: 0.2
                play fourc + 17, sustain: 7, amp: amp, attack: 0.2
                play onec + 24, sustain: 7, amp: amp, attack: 0.2
                play fourc - 12, sustain: 7, amp: amp, attack: 0.2
              end
              
              #play the drums
              8.times do
                if count == 1
                  sample :drum_cymbal_closed
                  if one >= 0 #kick always kicks on the '1'
                    sample :drum_heavy_kick, amp: 2
                    sample :drum_heavy_kick, amp: 3, beat_stretch: 0.25
                  end
                end
                if count == 2
                  sample :drum_cymbal_soft
                  if oneand >= 33 and oneand <=50 #soft snare hit sometimes
                    sample :drum_snare_hard, attack: 0.01, sustain: 0, release: 1, amp: 1
                    
                  end
                  if oneand >= 51 #kick sometimes
                    sample :drum_heavy_kick
                  end
                end
                if count == 3
                  sample :drum_cymbal_closed
                  if two >= 53 #kick sometimes
                    sample :drum_heavy_kick
                  end
                end
                if count == 4
                  sample :drum_cymbal_soft
                  if twoand >= 54 #kick sometimes
                    sample :drum_heavy_kick
                  end
                end
                if count == 5
                  if three >= 0 #snare on the '2'
                    sample :drum_snare_hard, attack: 0.01, sustain: 0, release: 0.01, amp: 2
                    with_fx :gverb, spread: 1, room: 100, release: 4, mix: 0.5, damp: 0.5, amp: 2 do
                      sample :drum_snare_hard, attack: 0.01, sustain: 0, release: 0.01
                    end
                    
                  end
                  if three >= 55 #kick sometimes
                    sample :drum_heavy_kick
                  end
                end
                if count == 6
                  sample :drum_cymbal_soft
                  if threeand >= 33 and threeand <=50  #soft snare hit sometimes
                    sample :drum_snare_hard, attack: 0.01, sustain: 0, release: 1, amp: 1
                    
                  end
                  if threeand >= 51 #kick sometimes
                    sample :drum_heavy_kick
                  end
                end
                if count == 7
                  sample :drum_cymbal_closed
                  if four >= 52  #kick sometimes
                    sample :drum_heavy_kick
                  end
                end
                if count == 8
                  sample :drum_cymbal_soft
                  if fourand >= 54  #kick sometimes
                    sample :drum_heavy_kick
                  end
                end
                #count up for drums
                count = count + 1
                # reset count
                if count >= 9
                  count = 1
                end
                #wait a beat
                sleep 1
              end
              
              #count for chords
              ccount = ccount + 1
              if ccount >= 5
                ccount = 1
              end
            end
            #randomize
            randoc
            rando
          end
        end
      end
    end
  end
end

*edited for clarity

1 Like