# Creating a "choke" for audio in a sampler

**URL:** <https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489>\
**Category:** Tutorial Requests\
**Created:** [1 December 2022 16:31 UTC](https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489 "2022-12-01T16:31:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pbardon1412](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/p/e47c2d/32.png) [@pbardon1412](https://forum.cabbageaudio.com/u/pbardon1412)\
**Post date:** [1 December 2022 16:31 UTC](https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489/1 "2022-12-01T16:31:08Z")

</div>

Hi guys

I’ve followed Rory Walshs youtube tutorial on creating a live sampler in cabbage, similar to drum rack in ableton. I would love to be able to incorporate a choke for the audio. Basically when another sample slot is played, I want audio of the current sample playing to stop.

It would be great aswell if I could have this function turn on and off with a button.

Any help greatly appreciated I’m more or less a complete beginner.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [1 December 2022 16:34 UTC](https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489/2 "2022-12-01T16:34:36Z")

</div>

I’ll have to think about this. Leave it with me, it’s almost the end of the day here where I am, so it will probably be tomorrow before I can get you something 👍

p.s. welcome to the forum 🙂

---

<div class="post-metadata">

**Author:** ![pbardon1412](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/p/e47c2d/32.png) [@pbardon1412](https://forum.cabbageaudio.com/u/pbardon1412)\
**Post date:** [2 December 2022 22:23 UTC](https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489/3 "2022-12-02T22:23:50Z")

</div>

No stress at all Rory thanks a mil, any help would be greatly appreciated 🙏

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [3 December 2022 10:36 UTC](https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489/4 "2022-12-03T10:36:46Z")

</div>

Dang it, I completely forgot about this. I’ll try to take a look later today but I can’t promise anything. Weekend time is family time 😁

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [3 December 2022 15:18 UTC](https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489/5 "2022-12-03T15:18:24Z")

</div>

I’m just thinking about this now. If we turn off the other samples when a new one starts playing we will get some clicks. So this has to be done in a way where we fade out the previous sample rather to shut is down brute force.. 🤔

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [3 December 2022 15:41 UTC](https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489/6 "2022-12-03T15:41:39Z")

</div>

This should do the trick. You can also control how long the fade out is for the previous sample. You could add a slider to control this too. I’ll leave it up to you to add a button to enable/disable this feature 👍

[SimpleSampler.csd](https://forum.cabbageaudio.com/uploads/short-url/i5sBF5ATWDWa1lGAuihG9lGBgqc.csd) (4.2 KB)

---

<div class="post-metadata">

**Author:** ![pbardon1412](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/p/e47c2d/32.png) [@pbardon1412](https://forum.cabbageaudio.com/u/pbardon1412)\
**Post date:** [4 December 2022 16:52 UTC](https://forum.cabbageaudio.com/t/creating-a-choke-for-audio-in-a-sampler/3489/7 "2022-12-04T16:52:23Z")

</div>

Rory you’re an absolute legend thank you so much!!

I’ll let you know how it goes 😃
