# Week 3 lesson 3 - slice and splice

**URL:** <https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519>\
**Category:** Week 3 - every, $, working with longer samples\
**Created:** [29 April 2020 10:08 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519 "2020-04-29T10:08:04Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [29 April 2020 10:08 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/1 "2020-04-29T10:08:05Z")

</div>

Continuing on from [Week 3 lesson 2 - cut vs legato](https://club.tidalcycles.org/t/week-3-lesson-2-cut-vs-legato/515) ..

Lets look at a way of 'beat slicing' looping samples, using slice and splice:

[![](https://img.youtube.com/vi/hKhPdO0RKDQ/maxresdefault.jpg "[TidalClub] Week 3 lesson 3 - slice and splice") ](https://www.youtube.com/watch?v=hKhPdO0RKDQ)

```haskell
setcps 0.6

-- Hear it straight
d1 $ splice 8 "0 1 2 3 4 5 6 7" $ sound "break:4"

-- Now with a more messed-up pattern
d1 $ splice 8 "6 1 [2 3] ~ 4 1 6*2 7" $ sound "break:4"

-- Try changing the cps to hear it at different speeds

-- Try manipulating the pattern of slices
d1 $ splice 8 (fast "1 [0.5 0.75]" "6 1 [2 3] ~ 4 1 6*2 7")
   $ sound "break:4"

-- Now try all the above with 'slice' instead of 'splice'.
-- Slice _doesn't_ do the pitching up/down thing to splice the
-- sound to the step.

-- Here I put six slices from a loop originally in 4/4, to create
-- a 3/4 waltz
d1 $ splice 8 ("0 1 2 3 4 5") $ sound "break:4" # gain 1.1
d2 $ sound "kick snare*2 clap:4" # speed 2

```

**Next lesson:**

> [@Week 3 lesson 4 - chop and striate](https://club.tidalcycles.org/t/week-3-lesson-4-chop-and-striate/534):
>
> Continuing on from [https://club.tidalcycles.org/t/week-3-lesson-3-slice-and-splice/519](https://club.tidalcycles.org/t/week-3-lesson-3-slice-and-splice/519) , lets round off our week of work with longer samples, to look at a different way of 'beat slicing', using 'chop' and 'striate'. Here's the video: [https://www.youtube.com/watch?v=A199q\_kMhb0](https://www.youtube.com/watch?v=A199q_kMhb0) .. and here's the worksheet: -- Let's take a nice break: once $ sound "break:8" -- We can use 'begin' and 'end' to only play part of the sound, in this -- case the final quarter of it: d1 $ sound "break:8\*4" # begin 0…

---

<div class="post-metadata">

**Author:** ![ganz](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ganz/32/64_2.png) [@ganz](https://uzu.lurk.org/u/ganz)\
**Post date:** [30 April 2020 12:15 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/2 "2020-04-30T12:15:09Z")

</div>

Didn't tried out much with drum loops before, but splice and slice are great. Slice seems to be my favorite of both.

Thought I could easely extend your example with a variation of a second group of eight slices, but it doesn't come out what I thought.

setcps 0.4

d1 $ slice 8 (slow "1" "1 2 [3 4] ~ 3 6 7 8") $ sound "break:8"

d2 $ slice 16 (slow "2" "1 2 [3 4] ~ 3 6 7 8" + "1 2 [3 4] ~ 3 6 5 8") $ sound "break:8"

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [30 April 2020 12:40 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/3 "2020-04-30T12:40:22Z")

</div>

Yes that will add the numbers together, rather than have one play after the other.

Here's a couple of approaches:

```haskell
d2 $ slice 16 (slowcat ["1 2 [3 4] ~ 3 6 7 8", "1 2 [3 4] ~ 3 6 5 8"]) $ sound "break:8"
d2 $ slice 16 (slow 2 "1 2 [3 4] ~ 3 6 7 8 1 2 [3 4] ~ 3 6 5 8") $ sound "break:8"
d2 $ slice 16 ("<[1 2 [3 4] ~ 3 6 7 8] [1 2 [3 4] ~ 3 6 5 8]>") $ sound "break:8"

```

They should do the same (in haste, I haven't tested them).

Note that it starts counting at `0`, so if you have 8 slices, 0 will be the first slice, 1 will be the second one, and 8 will also be the first (because it loops back to the start).

---

<div class="post-metadata">

**Author:** ![ganz](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ganz/32/64_2.png) [@ganz](https://uzu.lurk.org/u/ganz)\
**Post date:** [30 April 2020 13:30 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/4 "2020-04-30T13:30:40Z")

</div>

Thanks a lot for this examples! Its almost what I intended.  
And now I got, that the slice parameter should remain on "8". That's it:

d1 $ slice 8 (slowcat ["1 2 [3 4] ~ 3 6 7 8", "1 2 [3 4] ~ 3 6 5 8"]) $ sound "break:8"

d1 $ slice 8 (slow 2 "1 2 [3 4] ~ 3 6 7 8 1 2 [3 4] ~ 3 6 5 8") $ sound "break:8"

d1 $ slice 8 ("\<[1 2 [3 4] ~ 3 6 7 8] [1 2 [3 4] ~ 3 6 5 8]\>") $ sound "break:8"

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [30 April 2020 15:21 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/5 "2020-04-30T15:21:41Z")

</div>

Great!

I would still substract 1 from all the numbers, i.e. this might sound better (or might not):

```haskell
d1 $ slice 8 (slowcat ["0 1 [2 3] ~ 2 5 6 7", "0 1 [2 3] ~ 2 5 4 7"]) $ sound "break:8"

```

So the first slice 0 is at the start.

Also I noticed that there is just one number changing, so you could also write this like:

```haskell
d1 $ slice 8 "0 1 [2 3] ~ 2 5 <6 4> 7" $ sound "break:8"

```

---

<div class="post-metadata">

**Author:** ![ganz](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ganz/32/64_2.png) [@ganz](https://uzu.lurk.org/u/ganz)\
**Post date:** [30 April 2020 16:02 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/6 "2020-04-30T16:02:14Z")

</div>

Yes! Mini-notation.

---

<div class="post-metadata">

**Author:** ![malarki](https://uzu.lurk.org/user_avatar/uzu.lurk.org/malarki/32/504_2.png) [@malarki](https://uzu.lurk.org/u/malarki)\
**Post date:** [6 May 2020 08:02 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/7 "2020-05-06T08:02:28Z")

</div>

I love these (still catching up a bit from starting late). Pushing the splices into audio rate gets really interesting:

```
d1 $ slice 8 (slow 1 "0*5 1*7 [2*4 3*8] ~ 4*7 1*16 6*8 7*37") $ s "break:4" # delay 1 # room
```

---

<div class="post-metadata">

**Author:** ![mattia.paterna](https://uzu.lurk.org/user_avatar/uzu.lurk.org/mattia.paterna/32/112_2.png) [@mattia.paterna](https://uzu.lurk.org/u/mattia.paterna)\
**Post date:** [10 May 2020 19:01 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/8 "2020-05-10T19:01:21Z")

</div>

sort of wavetable synthesis?

---

<div class="post-metadata">

**Author:** ![malarki](https://uzu.lurk.org/user_avatar/uzu.lurk.org/malarki/32/504_2.png) [@malarki](https://uzu.lurk.org/u/malarki)\
**Post date:** [12 May 2020 08:26 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/9 "2020-05-12T08:26:52Z")

</div>

@mattia.paterna yes, i think, in a more limited way than typical. i'd be limiting how it's read to discrete blocks of samples instead of reindexing more arbitrarily.

---

<div class="post-metadata">

**Author:** ![nuntxaku](https://uzu.lurk.org/user_avatar/uzu.lurk.org/nuntxaku/32/1205_2.png) [@nuntxaku](https://uzu.lurk.org/u/nuntxaku)\
**Post date:** [10 November 2020 20:31 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/11 "2020-11-10T20:31:50Z")

</div>

Hi!!  
I'm trying to slice a long sample, but just from the second middle of that. How can I pattern just the second half of a long sample to manipulate it? Taking "bev" as example, imagin it begins playing normal, but in the middle it begins to change using stut, |\*speed or whatever.  
It's close to work with a sample like "break" and that sintax

```
d1 
    $ within (0.5, 1) (stut' 16 (0.0625)((|*speed 1.3))) 
    $ within (0.5, 1) (#gain 0)
    $ splice 32 "[0 .. 32]"
    $ sound "break:4" 
    # speed 1

```

But with a sample as long as "bev" it fails.

```
d1 
    $ slow 4
    $ within (0.5, 1) (stut' 16 (0.0625)((|*speed 1.3))) 
    $ within (0.5, 1) (#gain 0)
    $ splice 32 "[0 .. 32]"
    $ sound "bev" 
    # speed 1

```

How could I achieve this?

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [11 November 2020 20:50 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/12 "2020-11-11T20:50:23Z")

</div>

That first example sounds nice!

I'm a bit confused what the `within (0.5, 1) (#gain 0)` is doing. I can hear it sounds very different without it.. But don't understand why the first half of each cycle isn't completel silent then..

The problem with the second one is it lasts longer than a cycle, and transformations generally work on a per-cycle basis. You have a `slow 4` there but that ends up stretching out all the chopped up bits or grains leaving gaps. So maybe you also want to modify the playback rate of the sound. You could do that with 'hurry' instead:

```haskell
d1 
    $ hurry 0.25
    $ within (0.5, 1) (stut' 16 (0.0625)((|*speed 1.3))) 
    $ within (0.5, 1) (#gain 0)
    $ splice 32 "[0 .. 32]"
    $ sound "bev" 

```

Maybe it's better after the splice though:

```haskell
d1 
    $ within (0.5, 1) (stut' 16 (0.0625)((|*speed 1.3))) 
    $ within (0.5, 1) (#gain 0)
    $ hurry 0.25
    $ splice 32 "[0 .. 32]"
    $ sound "bev" 

```

---

<div class="post-metadata">

**Author:** ![nuntxaku](https://uzu.lurk.org/user_avatar/uzu.lurk.org/nuntxaku/32/1205_2.png) [@nuntxaku](https://uzu.lurk.org/u/nuntxaku)\
**Post date:** [13 November 2020 11:51 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/13 "2020-11-13T11:51:46Z")

</div>

Hi @yaxu thanks for your answer. I think what I'm actually searching for is a sintax capable to affect a long sample progessively while it sounds. May be the way to achieve this is through a sintax capable of slice a long sample in two half, and then reslice the second half in n parts being able to affect its parameters (just for that 2nd half). In that hypotetical case we cought be able to nest it again and again. The result is a long sample who is progressively modificated in some their parameters.  
I don't know if it's possible.  
Thank you!!

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [13 November 2020 17:52 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/14 "2020-11-13T17:52:26Z")

</div>

Hi @nuntxaku,

Hm, I don't think there is an easy function for this. I could try to make something but actually in the next version of Tidal and SuperDirt it will become possible to modify effects (e.g. panning, distortion) to an ongoing sound without chopping it. There are some complications but hopefully I will get a chance to finish the interface for this soon.

---

<div class="post-metadata">

**Author:** ![nuntxaku](https://uzu.lurk.org/user_avatar/uzu.lurk.org/nuntxaku/32/1205_2.png) [@nuntxaku](https://uzu.lurk.org/u/nuntxaku)\
**Post date:** [13 November 2020 18:51 UTC](https://uzu.lurk.org/t/week-3-lesson-3-slice-and-splice/519/15 "2020-11-13T18:51:48Z")

</div>

We'll be waiting for it. Thank you very much!
