Sonic-Pi中文教程http://www.ityks.com/
use_bpm 80 noteBase = 1 live_loop :jiepai do sample :elec_pop sleep 1; end minAmp = 1 maxAmp = 1 define :noteBeat do |note, beat| use_synth :tb303 with_fx :reverb do if (beat == 2) #两拍 play note, sustain: 1.25, release: 0.25, attack: 0.25, decay: 0.25 ,amp: rrand(minAmp , maxAmp) elsif (beat == 1) #一拍 play note, sustain: 0.25, release: 0.25, attack: 0.25, decay: 0.25 ,amp: rrand(minAmp , maxAmp) elsif (beat == 0.5) #二分之一拍 play note, sustain: 0, release: 0.25, attack: 0.25, decay: 0 ,amp: rrand(minAmp , maxAmp) elsif (beat == 0.25) #四分之一拍 play note, sustain: 0, release: 0.125, attack: 0.125, decay: 0 ,amp: rrand(minAmp , maxAmp) elsif (beat == 0.125) #八分之一拍 play note, sustain: 0, release: 0.125, attack: 0, decay: 0 ,amp: rrand(minAmp , maxAmp) elsif (beat == 3) #三拍 play note, sustain: 2.25, release: 0.25, attack: 0.25, decay: 0.25 ,amp: rrand(minAmp , maxAmp) elsif (beat == 3.5) #三拍半 play note, sustain: 2.5, release: 0.25, attack: 0.25, decay: 0.25 ,amp: rrand(minAmp , maxAmp) elsif (beat == 1.5) #一拍半 play note, sustain: 0.5, release: 0.25, attack: 0.25, decay: 0.25 ,amp: rrand(minAmp , maxAmp) elsif (beat == 4) play note, sustain: 3.25, release: 0.25, attack: 0.25, decay: 0.25 ,amp: rrand(minAmp , maxAmp) end end sleep beat end 2.times do sample :tabla_tun3 sleep 1 end noteBeat(72, 0.5) noteBeat(71, 0.5) noteBeat(72, 0.5) noteBeat(76, 0.5) noteBeat(71, 2) noteBeat(69, 0.5) noteBeat(67, 0.5) noteBeat(69, 0.5) noteBeat(72, 0.5) noteBeat(67, 2) noteBeat(65, 0.5) noteBeat(64, 0.5) noteBeat(65, 0.5) noteBeat(72, 0.5) noteBeat(71, 1) noteBeat(67, 1) noteBeat(69, 0.5) noteBeat(71, 0.5) noteBeat(72, 0.5) noteBeat(76, 0.5) noteBeat(74, 2) #2-1 noteBeat(72, 0.5) noteBeat(71, 0.5) noteBeat(72, 0.5) noteBeat(76, 0.5) noteBeat(71, 1) noteBeat(67, 1) #2-2 noteBeat(69, 0.5) noteBeat(71, 0.5) noteBeat(72, 0.5) noteBeat(74, 0.5) noteBeat(76, 1) noteBeat(76, 1) #2-3 noteBeat(77, 0.5) noteBeat(76, 0.5) noteBeat(74, 0.5) noteBeat(72, 0.5) noteBeat(71, 0.5) noteBeat(76, 0.5) noteBeat(68, 0.5) noteBeat(71, 0.5) #2-4 noteBeat(69, 3) noteBeat(69, 0.25) noteBeat(71, 0.25) noteBeat(72, 0.25) noteBeat(74, 0.25) #3-1 noteBeat(76, 3) noteBeat(74, 1) #3-2 noteBeat(79, 1) noteBeat(77, 1) noteBeat(76, 1) noteBeat(74, 0.5) noteBeat(72, 0.5) #3-3 noteBeat(71, 3) noteBeat(72, 0.5) noteBeat(69, 3.5) #3-4 noteBeat(69, 0.5) noteBeat(67, 0.5) #4-1 noteBeat(77, 1) noteBeat(79, 1) noteBeat(69, 0.5) noteBeat(72, 1) noteBeat(71, 1.5) #4-2 noteBeat(72, 1) noteBeat(74, 1) noteBeat(71, 1) #4-3 noteBeat(71, 3) sleep 0.5 noteBeat(69, 3.5) #4-4 noteBeat(69, 0.25) noteBeat(71, 0.25) noteBeat(72, 0.25) noteBeat(74, 0.25) #5-1 noteBeat(76, 3) noteBeat(74, 1) #5-2 noteBeat(79, 1) noteBeat(77, 1) noteBeat(76, 1) noteBeat(74, 0.5) noteBeat(72, 0.5) #5-3 noteBeat(71, 3) noteBeat(72, 0.5) noteBeat(69, 3.5) #5-4 noteBeat(69, 0.5) noteBeat(67, 0.5) #6-1 noteBeat(65, 1) noteBeat(67, 1) noteBeat(69, 0.5) noteBeat(72, 1) noteBeat(71, 1.5) #6-2 noteBeat(72, 1) noteBeat(74, 1) noteBeat(77, 1) noteBeat(76, 3.5) #6-3 noteBeat(74, 0.5) noteBeat(72, 0.5) #6-4 noteBeat(71, 2) noteBeat(66, 2) #7-1 noteBeat(72, 0.5) noteBeat(71, 0.5) noteBeat(72, 0.5) noteBeat(76, 0.5) noteBeat(71, 2) #7-2 noteBeat(69, 0.5) noteBeat(67, 0.5) noteBeat(69, 0.5) noteBeat(72, 0.5) noteBeat(66, 2) #7-3 noteBeat(65, 0.5) noteBeat(64, 0.5) noteBeat(65, 0.5) noteBeat(72, 0.5) noteBeat(71, 1) noteBeat(67, 1) #7-4 noteBeat(69, 0.5) noteBeat(71, 0.5) noteBeat(72, 0.5) noteBeat(76, 0.5) noteBeat(74, 2) #8-1 noteBeat(72, 0.5) noteBeat(71, 0.5) noteBeat(72, 0.5) noteBeat(76, 0.6) noteBeat(71, 1) noteBeat(67, 1) #8-2 noteBeat(69, 0.5) noteBeat(71, 0.5) noteBeat(72, 0.5) noteBeat(74, 0.5) noteBeat(76, 1) noteBeat(76, 1) #8-3 noteBeat(77, 0.5) noteBeat(76, 0.5) noteBeat(74, 0.5) noteBeat(72, 0.5) noteBeat(71, 0.5) noteBeat(76, 0.5) noteBeat(68, 0.5) noteBeat(71, 0.5) #8-4 noteBeat(69, 4)