# How manipulate slices with rings?

**URL:** <https://in-thread.sonic-pi.net/t/how-manipulate-slices-with-rings/834>\
**Category:** \[P\] Patreon Support\
**Created:** [March 4, 2018, 5:07am UTC](https://in-thread.sonic-pi.net/t/how-manipulate-slices-with-rings/834 "2018-03-04T05:07:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GWB70](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/gwb70/32/410_2.png) [@GWB70](https://in-thread.sonic-pi.net/u/GWB70)\
**Post date:** [March 4, 2018, 5:07am UTC](https://in-thread.sonic-pi.net/t/how-manipulate-slices-with-rings/834/1 "2018-03-04T05:07:54Z")

</div>

Hi again :

There’s many possibilities for manipulate values with rings,

and ring chains.One thing that would be quite interesting is

manipulate especific slices in a sample :

# Sound Out

```ruby
with_fx :sound_out_stereo, mix: 0 do
 r = (ring 0,1,2,3) 
  live_loop :sample do
    sample :loop_amen,num_slices: 8, r.take(0),
    amp: 0.5,beat_stretch: 4,rate: 1
sample :loop_amen, r.take(1),rate: 0.5
    sleep 4
  end
end

```

The message that i got was :

unexpected ‘,’ ,expecting =\>

There’s some way to manipulate specific slices through the rings/ring chain ?

Thank you,one more time.

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [March 4, 2018, 5:31am UTC](https://in-thread.sonic-pi.net/t/how-manipulate-slices-with-rings/834/2 "2018-03-04T05:31:45Z")

</div>

Hey @GWB70. Can you explain what you’re trying to use a ring for in this case?

---

<div class="post-metadata">

**Author:** ![kniknoo](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/kniknoo/32/146_2.png) [@kniknoo](https://in-thread.sonic-pi.net/u/kniknoo)\
**Post date:** [March 4, 2018, 8:26pm UTC](https://in-thread.sonic-pi.net/t/how-manipulate-slices-with-rings/834/3 "2018-03-04T20:26:24Z")

</div>

Here’s an example of how I might slice up amen using a ring, using both a variable for a ring and a method chained ring. The important thing is that you need to wind up with a specific value, rather than a ring to give to the slice: option. The .take method returns a ring, so .tick or .choose would be better choices to produce a single value.

```ruby
live_loop :amen_break do
  use_sample_defaults beat_stretch: 2, num_slices: 8, release: 0.5
  r = (ring, 1, 3, 5, 7)
  sample :loop_amen, slice: [0, 2, 4, 6].ring.tick
  sleep 0.25
  3.times do
    sample :loop_amen, slice: r.choose
    sleep 0.25
  end
end

```

---

<div class="post-metadata">

**Author:** ![GWB70](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/gwb70/32/410_2.png) [@GWB70](https://in-thread.sonic-pi.net/u/GWB70)\
**Post date:** [March 4, 2018, 9:53pm UTC](https://in-thread.sonic-pi.net/t/how-manipulate-slices-with-rings/834/4 "2018-03-04T21:53:52Z")

</div>

Well, i want to use rings to pick up specific elements, in a sequence.

In a sequence of 8 slices, i can take few of them,and apply different rates.

I’ll record the parts that i liked for further edition in a DAW.

---

<div class="post-metadata">

**Author:** ![GWB70](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/gwb70/32/410_2.png) [@GWB70](https://in-thread.sonic-pi.net/u/GWB70)\
**Post date:** [March 4, 2018, 10:03pm UTC](https://in-thread.sonic-pi.net/t/how-manipulate-slices-with-rings/834/5 "2018-03-04T22:03:55Z")

</div>

Hey :

It seems we’re looking for similar results.

I’ll use your code for manipulation with rings,to take specific slices

and apply different parameters. Then, i’ll record what i liked,and edit on Acid.

Thank you very much,mate !

> Hi again :

The code that you wrote,works nice

but i couldn’t call an external sample,

do not accept this string :

```ruby
 es = "C:/Users/gwb70/Documents/My Samples"

sample : es,rate: 0.5, slice: [0,2,5,2].ring.tick

```

But still works with internal samples 🙂

---

<div class="post-metadata">

**Author:** ![kniknoo](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/kniknoo/32/146_2.png) [@kniknoo](https://in-thread.sonic-pi.net/u/kniknoo)\
**Post date:** [March 5, 2018, 2:32am UTC](https://in-thread.sonic-pi.net/t/how-manipulate-slices-with-rings/834/6 "2018-03-05T02:32:13Z")

</div>

Give section 3.7 a look again. You have some important info missing. Your es variable is a directory, but sample will need a sample. Also, the colon is a typo. Assuming your sample is called play-me.wav :

```ruby
sample es, "play-me", rate: 0.5, slice: [0,2,5,2].ring.tick

```

[https://sonic-pi.net/tutorial.html#section-3-7](https://sonic-pi.net/tutorial.html#section-3-7)
