Xylophone revisited

#1

I dragged out my old Xylo code to add to a track, and
thought I’d repost it, just for the heck.

Enjoy.

Eli…

use_bpm 115

tracker = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

xylo = 3

define :xylophone do
  left_melody = [62,57,50,60,50,55,50,50,53,50,55,50,52,50,57,48,
                 62,57,48,60,48,55,48,48,53,48,55,48,52,48,57,45,
                 62,57,45,60,45,55,45,45,53,45,55,45,52,45,57,48,
                 62,57,48,60,48,55,48,48,53,48,55,48,52,48,57,50].ring
  
  right_melody = [0,0,1,0,1,0,1,0,1,2,0,1,0,1,0,1,
                  0,0,1,0,1,0,1,0,1,2,0,1,0,1,0,1,
                  0,0,1,0,1,0,1,0,1,2,0,1,0,1,0,1,
                  0,0,1,0,1,0,1,0,1,2,0,1,0,1,0,1].ring
  tick
  use_synth :pretty_bell
  play left_melody.look, amp: 0.25, release: [0.75,1].choose
  play left_melody.look+(12*right_melody.look), amp: 0.5, release: 2 if one_in(4)
  sleep 0.5
end

define :start_loop do |i|
  tracker[i] = 1
end

define :stop_loop do |i|
  tracker[i] = 0
end


live_loop :xylo do
  if tracker[3]>0 then
    k = xylophone
  else
    kill k
    sleep 0.5
  end
end

live_loop :loopy do
  start_loop xylo
  sleep 16
  stop_loop xylo
  sleep 8
  start_loop xylo
  sleep 32
  stop_loop xylo
  sleep 8
end

2 Likes