A little experiment with motives

Just a very simple melody generator

live_loop :main do
  cur_pool = (knit (ring -1), 4) + (ring (ring 0), (ring 1), (ring 2), (ring 3), (ring 4), (ring 5), (ring 6), (ring 7), (ring 8), (ring 9))
  7.times do
    next_pool = (ring)
    8.times do
      next_pool = next_pool + (ring cur_pool.choose + cur_pool.choose)
    end
    cur_pool = next_pool
    puts cur_pool
  end
  (2 ** 7).times do
    if not cur_pool[0][tick] == -1
      synth :blade ,note: (scale :g, :major_pentatonic, num_octaves: 2)[ cur_pool[0][look] ] - 12, amp: 0.6
    end
    if (range 0, 4).look == 0
      sample :bd_sone
    end
    sleep 0.25
  end
end
3 Likes