Set the tempo for the code block
with_bpm
[bpm (number)]
Sets the tempo in bpm (beats per minute) for everything in the given block. Affects all containing calls to sleep and all temporal synth arguments which will be scaled to match the new bpm. See also use_bpm
Introduced in v2.0.0
|
# default tempo is 60 bpm 4.times do sample :drum_bass_hard sleep 1 end sleep 5 # with_bpm sets a tempo for everything between do ... end (a block) # Hear how it gets faster? with_bpm 120 do 4.times do sample :drum_bass_hard sleep 1 end end sleep 5 # bpm goes back to normal 4.times do sample :drum_bass_hard sleep 1 end |
# sleeps for 1 second # sleeps for 5 seconds # set bpm to be twice as fast # now sleeps for 0.5 seconds # sleeps for 1 second |