Big update to YummyFillings

Okay, I made some major updates to YummyFillings.rb. I added a bunch of new methods, and enhanced several methods. There are a ton of enhancements, most notably support for drum notation (“x–x–x-”), melody degrees (:i, :ii, etc) and layering synths in arrange.
For those who don’t know, YummyFillings.rb is a library of helpful methods for making music, including lfos, envelopes, trancegates, strums, arpeggiation, manipulation of arrays/hashes, and much much more.
Here’s the github link:

And here’s an ambient piece I made, which uses the genchord method to generate chord changes a la neo-reimannian theory:

eval_file "E:/Yummy/YummyFillings.rb"

bar = 16.0
whole = 4.0
half =2.0
quarter =1.0
eighth =0.5
sixteenth =0.25
dotted =1.5
triplet =2.0 / 3
halftone = 1
second = 2
wholetone = 2
min3 = 3
maj3 = 4
fourth = 5
tritone = 6
fifth = 7
min6 = 8
maj6 = 9
min7 = 10
maj7 = 11
octave = 12

set :thisroot, :c4
set :firstroot, :c4
set :thischord, :major
set :thisscale, :ionian
set :thisshift, :diatonic
set :thispent, (get[:thischord].to_s + "_pentatonic").to_sym

live_loop :manage, delay: 0.01 do
  sleep bar * 3.99
  debugprint "resetting chord and scale values"
  thisroot, thischord, thisscale, thisshift = genchord get[:thisroot], get[:thischord], get[:thisscale], get[:thisshift]
  thisroot -= octave if thisroot > get[:firstroot] + fifth #to keep from drifting ever upward
  ##| debugprint "thisroot: ", thisroot
  ##| debugprint "thischord: ", thischord
  ##| debugprint "thisscale: ", thisscale
  ##| debugprint "thisshift: ", thisshift
  set :thisroot, thisroot
  set :thischord, thischord
  set :thisscale, thisscale
  set :thisshift, thisshift
  set :thispent, (thischord.to_s + "_pentatonic").to_sym
  
  sleep bar * 0.01
end

with_synth :fm do
  live_loop :sheen, sync: :manage do
    leadroot = get[:thisroot] + octave + octave
    ##| debugprint "leadroot: ", leadroot
    [:i, :iii, :v, :vii].shuffle.each do |thisdegree|
      thisnote = degree thisdegree, leadroot, get[:thisscale]
      mydivisor = (midi_to_hz get[:thisroot]) / (midi_to_hz thisnote)
      play thisnote, amp: 0.3, duration: half, divisor: mydivisor, attack: sixteenth, decay: sixteenth, depth: 2     if dice(10) <= 7
      
      sleep half
    end
  end
end




with_synth :bass_foundation do
  live_loop :bass, sync: :manage do
    bassroot = get[:thisroot] + (octave * -2)
    ##| debugprint "bassroot: ", bassroot
    [:i, :iii, :v, :vi].each do |thisdegree|
      play (degree thisdegree, bassroot, get[:thisscale]), duration: whole * 2, attack: sixteenth
      sleep whole * 2
    end
  end
end

with_fx :echo, phase: eighth * dotted, decay: whole do
  with_fx :panslicer, phase: sixteenth do
    with_synth :pluck do
      live_loop :pluck, sync: :manage do
        if get[:thischord] == :major
          minordegree = :vi
          majordegree = :v
        else
          minordegree = :viii
          majordegree = :vii
        end #if major or minor
        pluckroot = get[:thisroot]
        minorpent = chord_degree minordegree, get[:thisroot], get[:thisscale]
        majorpent = chord_degree majordegree, get[:thisroot], get[:thisscale]
        ##| debugprint "pluckroot: ", pluckroot
        ##| debugprint "thispent: ", get[:thispent]
        8.times do
          play minorpent.choose, amp: 1.5    if dice(10) <= 5
          sleep quarter
        end
        16.times do
          play majorpent.choose, amp: 1.5    if dice(10) <= 5
          sleep quarter
        end
        8.times do
          play minorpent.choose, amp: 1.5    if dice(10) <= 5
          sleep quarter
        end
      end
    end
  end
end

with_synth :zawa do
  live_loop :piano, sync: :manage do
    pianoroot = get[:thisroot]
    with_fx :nlpf, cutoff: :e2 do
      with_fx :nlpf, cutoff: pianoroot + octave + fifth do
        ##| debugprint "pianoroot: ", pianoroot
        [:viii, :vii, :vi, :v, :vi, :v, :iv, :iii, :vii, :vi, :v, :iv, :v, :iv, :iii, :ii, :ix, :viii, :vii, :vi, :vii, :vi, :v, :iv, :viii, :vii, :vi, :v, :vi, :v, :iv, :iii].each do |thisdegree|
          play (degree thisdegree, pianoroot, get[:thisscale]),  amp: 4
          sleep quarter
        end
      end
    end
  end
end


with_fx :flanger, phase: 2 do
  with_fx :echo, phase: half * dotted, decay: bar * 2 do
    with_synth :winwood_lead do
      live_loop :chord do
        chordroot = get[:thisroot]
        [:i, :iii, :v, :vi].each do |thisdegree|
          1.times do
            play_chord (chord_degree thisdegree, chordroot, get[:thisscale], 4), duration: half , amp: 0.4     if dice(10) <= 8
            
            sleep whole * 2
          end
        end
      end
    end
  end
end

live_loop :whoosh, sync: :manage, delay: sixteenth do
  sample :ambi_dark_woosh, amp: 1 if dice(10) <= 5
  sleep [half * dotted, half * dotted, half].tick
  
end


live_loop :cymbal, sync: :manage do
  sample :drum_splash_hard, rate: -1, beat_stretch: half, amp: 0.5     if dice(10) <= 7
  
  sleep [whole * dotted, whole * dotted, whole].tick
end

live_loop :kick, sync: :manage do
  [sixteenth, quarter, quarter, quarter, eighth, sixteenth, eighth * dotted, eighth * dotted, eighth * dotted, eighth * dotted, eighth, eighth].each do |thismuch|
    sample :bd_808, amp: 6
    sleep thismuch
  end
end



… and another creation, exploring the use of weird harmonics:

harmonics = [7, 9, 11, 13, 15, 17, 19, 21]
rootnotes = [:c3, :c2, :c1, :c0].reverse
4.times do
with_fx :flanger, phase: 4, wave: 0, mix: 0.25 do
  with_fx :krush, mix: 0.25 do
    with_synth_defaults amp: 0.5, attack: 0.125, duration: 0.25, release: 0.125 do
      with_synth  :beep do
        rootnotes.each do |rootnote|
          harmonics.each do |harm|
            #play rootnote
            play :c4
            play :g4
            play :c5
            play (harmonic rootnote, harm)
            sleep 0.125
          end
        end
      end
    end
  end
end
end

I’d love to hear what you think!
Enjoy!

3 Likes