How to define and use patterns of a 4/4 measure in a fixed form


#1
use_bpm 120

with_fx :reverb, mix: 0.25, room: 0.25 do
  
  define :uno do
    1.times do
      x = 0.25
      with_fx :echo, mix: 0.125, phase: 0.75, decay: 10 do
        use_synth :fm
        1.times do
          play_pattern_timed [48, 60, 48], [0.25, 0.5, 0.25], amp: x, pan: 0.5
        end
        1.times do
          play_pattern_timed [48, 72, 48], [0.5, 0.25, 0.25], amp: x, pan: 0.5
        end
        1.times do
          play_pattern_timed [48, 00, 72], [0.25, 0.25, 0.5], amp: x, pan: 0.5
        end
        sleep 1
      end
    end
  end
  
  define :due do
    4.times do
      x = 0.5
      use_synth :dsaw
      play 36, release: 0.2, amp: x, pan: -0.5
      sleep 0.25
      play 48, release: 0.2, amp: x, pan: -0.5
      sleep 0.25
      play 36, release: 0.2, amp: x, pan: -0.5
      sleep 0.25
      play 48, release: 0.2, amp: x, pan: -0.5
      sleep 0.25
    end
  end
  
  define :tre do
    1.times do
      with_fx :echo, mix: 0.125, phase: 0.75, decay: 10 do
        sample :elec_soft_kick, amp: 2, pan: 0
        sleep 1
        sample :elec_snare, pan: 0.1
        sleep 1
        sample :elec_soft_kick, amp: 2, pan: 0
        sleep 1
        sample :elec_snare, pan: 0.1
        sleep 1
      end
    end
  end
  
  define :quattro do
    with_fx :echo, mix: 0.125, phase: 0.75, decay: 10 do
      4.times do
        sample :elec_chime, amp: 0.25, pan: -0.1
        sleep 0.5
        sample :elec_chime, amp: 0.125, pan: -0.1
        sleep 0.5
      end
    end
  end
  
  #uno
  #due
  #tre
  #quattro
  
  in_thread do
    10.times do
      uno
    end
  end
  in_thread do
    sleep 4
    4.times do
      due
      sleep 4
    end
  end
  in_thread do
    sleep 4
    8.times do
      tre
    end
  end
  in_thread do
    sleep 4
    2.times do
      quattro
      sleep 4
      quattro
      sleep 4
    end
  end
  
end