Sonic Pi's start: and finish: opts play arbitrary sub-sections of a sample
start: and finish: take values between 0 and 1 representing fractional positions in the sample. start: 0.5 begins halfway through; finish: 0.5 stops halfway. When finish: is less than start:, the segment plays backwards. Combined with rate: and ADSR opts this enables precise loop chopping. sample_duration accepts the same opts and returns the exact duration of the selected segment, useful as the matching sleep value.
Examples
sample :loop_amen, start: 0.25, finish: 0.5 # middle quarter sample :loop_amen, start: 0.5, finish: 0.25 # middle quarter, backwards
Assessment
Divide :loop_amen into 4 equal slices using start: and finish:. Play them in reverse order with a release fade on each.