Skip to content

Trim samples and deal with overlaps

By default, samples play from start to end when triggered. In this guide, you’ll find some options to trim them and deal with sample overlaps.

Event-relative trimming: deal with overlaps

There are two main functions that allow us to deal with sample overlaps: cut and legato.

Play only one sound at a time with cut

In the style of classic drum-machines, cut will stop a playing sample as soon as another sample with in same cutgroup is to be played. This ensures that only one sample is playing in the same group, making it. For example,

d1 $ fast 2 $ sound "ho:4 hc ho:4 hc" # cut 1

makes the pattern sound more realistic, by “choking” the open hi-hat when the closed one plays.

Force sounds to fit their slot with legato

legato modifies the note length relative to the event length. When its value is 1, is equivalent to stopping the sample when the next event (whether it is a sample or a silence), is triggered. Notice the difference between

d1 $ sound "sax ~ ~ sax ~ ~ sax ~" # legato 1

and

d1 $ sound "sax ~ ~ sax ~ ~ sax ~" # cut 1

Also, notice how these two lines are equivalent:

d1 $ sound "sax ~" # legato 1
d1 $ sound "sax" # legato 0.5

Sample-relative trimming

Another way to trim samples is to do so in relation to their own length, by specifying on which part Tidal begins and/or ends playing them. For this purposes, the number 0 represents the start of the whole sample, and 1, the end.

begin

To specify on which part Tidal will start playing a sample, we can use the function begin. For example, begin 0 will play the sample from the start, begin 1 will skip the whole sample, and begin 0.25 will cut off the first quarter of each sample.

In the next example, the first 3 ade samples are played on every cycle, but the start point from which they are played changes on each cycle:

d1 $ n "0 1 2" # s "ade" # begin "<0 0.25 0.5 0.75>" # legato 1

end

To specify on which part Tidal will stop playing a sample, we can use the function end. For example, end 0.75 will cut off the last quarter of each sample.

In the next example, the sample will be played two times every cycle, the second being shorter and in the second time, the segment will be shorter than in the first, creating a kind of accumulating canon effect:

d1 $ s "bev" >| end "[0.15 0.07]"

Absolute trimming with sustain

sustain indicates the total duration of sample playback in seconds.

d1 $ fast 2 $ s "breaks125:1" # cps (120/60/4) # sustain 1

At 120 BPM, a cycle lasts for two seconds. In the above example, we cut the sample so it plays just for one second, and repeat this part two times, so we fill the whole cycle. Note that sample pitch isn’t modified.

d1 $ s "breaks125:2!3" # cps (120/60/4) # sustain "0.4 0.2 0.4" # begin "0 0 0.4"

Here, we take advantage that sustain receives a pattern to build a different break from the original sample.