SonicPiで曲作り 1

use_bpm 45
use_random_seed 1

t = 0
c = [
  :Es4,:As4,:Ds4,:Es4,
  
  :Es3,:Es3,:Ds3,:Ds3,
  :Es3,:As3,:Ds3,:Es3,
  :As3,:Ds3,:As3,:Ds4,
  
  :Es4,:As4,:Ds4,:Es4,
  :Ds4,:Es4,:Es4,:Ds4,
  :As4,:Ds4,:Ds4,:Gs4,
  
  :Gs3,:Ds3,:As3,:Ds3,
  :Es3,:As3,:Ds3,:Ds3,
  :Gs3,:Es3,:As3,:Ds3
]
a = c[0]

live_loop :bd do
  sync "/cue/bd"
  sample :bd_ada, amp: 0.4
  sleep 0.5
  sleep 0.25
  sample :bd_ada, amp: 0.2
end

live_loop :loop0 do
  tr = c[t]
  if(tr != nil)
    a = tr
  else
    t=0
    tr = c[t]
    a = tr
  end
  t=t+1
  print t,a
  sleep 4
end

with_fx :reverb, room: 0.5, mix: 0.7 do
  live_loop :loop1 do
    use_synth :sine;
    play choose(scale(a, :minor_pentatonic, num_octaves: 1)), attack: 0, release: 0.1, amp: 0.1
    play choose(scale(a+12, :minor_pentatonic, num_octaves: 1)), attack: 0, release: 0.1, amp: 0.1
    sleep 0.125;
  end
end

with_fx :reverb, room: 0.99, mix: 0.7 do
  live_loop :loop2 do
    if(t>=5 && t!=20)
      cue :bd
    end
    synth :piano , note: scale(a, :minor_pentatonic, num_octaves: 2).shuffle.take(3), attack: 0, release: 0.15, amp: 1
    sleep 1;
  end
end

with_fx :reverb, room: 0.99, mix: 0.7 do
  live_loop :loop3 do
    use_synth :saw
    play note: scale(a, :minor_pentatonic, num_octaves: 2).shuffle.take(3), attack: 0.5, release: 16, amp: 0.05
    sleep 4;
  end
end