# Sample-duration-based bpm modification

``

    use_sample_bpm  string_or_number (sample_name_or_duration)

Modify bpm so that sleeping for 1 will sleep for the duration of the sample.

Introduced in v2.1

## Options

num_beats: | The number of beats within the sample. By default this is 1.

## Examples

# Example 1
``
    use_sample_bpm :loop_amen

    live_loop :dnb do
      sample :bass_dnb_f
      sample :loop_amen
      sleep 1
    end
| ``
    #Set bpm based on :loop_amen duration

    #`sleep`ing for 1 actually sleeps for duration of :loop_amen
# Example 2
``
    use_sample_bpm :loop_amen, num_beats: 4

    live_loop :dnb do
      sample :bass_dnb_f
      sample :loop_amen
      sleep 4

    end
| ``
    # Set bpm based on :loop_amen duration
    # but also specify that the sample duration
    # is actually 4 beats long.

    #`sleep`ing for 4 actually sleeps for duration of :loop_amen
    # as we specified that the sample consisted of
    # 4 beats