# Looping long samples accurately

This post is a wiki. Anyone with karma >1 is welcome to improve it.

Hello, I am having trouble playing longer samples like 5 seconds long in tidal.

d1 $sound "[pe:2]"  (pe is my own sample) And the sample is retriggered before the one before finishes. If you have solution(s) to better handle this, please post thanks! edit retag close merge delete ## 1 answer Sort by » oldest newest most voted There are a number of ways, but basically you want to slow down how often you retrigger. First, if you're at 1 cps and you happen to know the sample is 5 seconds long you can d1$ sound "[pe:2]/5"


But to make things like this easier there's a special parameter unit used in combination with speed that will adjust playback rate. If you want your sample to play every 4 cycles, and automatically stretch the sample to fill 4 cycles, you can use

d1 $sound "pe:2" # unit "c" # speed "0.25"  Where normally speed "0.25" would play the sample at 1/4 speed, but with unit "c" it now means 1/4 of the sample will play each cycle. So the full sample plays in exactly 4 cycles. There's a helper function to make this a little more compact d1$ loopAt 4 $sound "pe:2"  which does exactly the same thing. For reference, another option is unit "s", which switches the units of speed to be in seconds. So if you want to play the sound for exactly 4 seconds once every eight cycles, you could use  d1$ sound "[pe:2]/8" # unit "s" # speed "4"

more

Note that a problem with longer samples is that once you've started them, you can't stop them, or apply different effects.. For now you can solve with use of chop, e.g. d1 $(chop 32$ loopAt 4 \$ sound "pe:2") # delay sine1