A problem about the entrance of the sound

Hope someone could help me!
So my problem Is I wanna add some effect as the song goes,for example the song starts with only drum beats and than the piano goes in . But i cannot manage to do it. Could someone teaches me?
I just use it for like 1 week:(

Hi @soonks Welcome to using Sonic Pi

One way you can do the example you describe is to put the different parts (drums, piano) into different live_loops. These have a delay: option that you can use so that they don’t all start playing at the same time. Here is an example that starts with a drum, adds a piano and then adds cymbals all at different times.

live_loop :dr do #this loop starts immediately
  sample :bd_haus
  sleep 1 #loop repeats after 1 beat
end

live_loop :p, delay: 4 do #This loop is delayed 4 beats before starting
  use_synth :piano
#next line chooses a note at random from a two octave scale and plays it.
  play scale(:e3,:minor_pentatonic, num_octaves: 2).choose,release: 0.25
  sleep 0.25 #loop will repeat every 0.25 beats
end

live_loop :cym, delay: 8 do #this loop is delayed 8 beats before starting
  sleep 0.5
  sample :drum_cymbal_closed
  sleep 0.25
  sample :drum_cymbal_closed
  sleep 0.25
end

If you `re just starting I suggest working through the Tutorial which you can get at via the Help button.

Problem solved,thank you so much!:grin::grin::grin:

Just a quick message to say that I’ve moved this post from “Introductions & Stories” to “Support, Help & Resources”.

Please do consider supporting both future development and the ongoing maintenance of this forum for full access to these pages.