# Decomposing drums for use in a granular

**URL:** <https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073>\
**Category:** Learning Resources\
**Created:** [August 18, 2023, 3:56pm UTC](https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073 "2023-08-18T15:56:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattS6464](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@MattS6464](https://discourse.flucoma.org/u/MattS6464)\
**Post date:** [August 18, 2023, 3:56pm UTC](https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073/1 "2023-08-18T15:56:58Z")

</div>

Here is an interactive learning patch that decomposes drum loops to be used in a simple granulator.  
Any and all feedback and suggestions on developing the patch would be appreciated!

(make sure you download both files)  
[harmonicDrumGranular.maxpat](https://discourse.flucoma.org/uploads/short-url/yQVb8O0kfiFGI9Vu6l0bE9QMeaA.maxpat) (61.5 KB)  
[drum.grains.maxpat](https://discourse.flucoma.org/uploads/short-url/cr0qsZ3rGLTYOqyDw50I2LVIRHe.maxpat) (16.4 KB)

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [August 18, 2023, 5:39pm UTC](https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073/2 "2023-08-18T17:39:10Z")

</div>

This sounds quite cool.

I actually like what the strip-silence step does to the “groove” of it.

It would be interesting to perhaps fork each component down its own tree/path, and then create a macro-granularization that incorporates all of them (different rates/panning/etc…). Particularly since, at least with this example, “time” is getting erased and we just have a “cloud”-type sound.

Also reminds me a bit of something @spluta was working on a while back doing an epic multi-resolution version of PaulStretch that is, somewhat conceptually, similar (to what I’m suggesting at least).

p.s. loving seeing some new examples on here!

---

<div class="post-metadata">

**Author:** ![MattS6464](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@MattS6464](https://discourse.flucoma.org/u/MattS6464)\
**Post date:** [August 22, 2023, 9:03am UTC](https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073/3 "2023-08-22T09:03:46Z")

</div>

Thanks for the feedback! I’ve had a go at implementing some of those ideas, let me know what you think.  
[drum.grains.maxpat](https://discourse.flucoma.org/uploads/short-url/a2oJqtEtpqHTSfJ6Y9tvHS3uWvD.maxpat) (34.0 KB)  
[harmonicDrumGranular.maxpat](https://discourse.flucoma.org/uploads/short-url/ye8RaeO2E6392Food88DhZb7Muz.maxpat) (141.6 KB)

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [August 22, 2023, 12:23pm UTC](https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073/4 "2023-08-22T12:23:07Z")

</div>

Very cool, dig the additions.

You can also add in a step that pre-sorts the components, so they don’t end up in a random order.

In the patch I posted [here](https://discourse.flucoma.org/t/nmf-filter-transposition/) one of the steps takes the centroid for each channel of the bases and rewrites them to a new buffer based on that order, and I’ve found it to be quite effective. At minimum, it’s always consistent.

---

<div class="post-metadata">

**Author:** ![MattS6464](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@MattS6464](https://discourse.flucoma.org/u/MattS6464)\
**Post date:** [August 24, 2023, 1:15pm UTC](https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073/5 "2023-08-24T13:15:12Z")

</div>

Awesome! I’ve implemented your ordering idea.  
Doing so has allowed me to label the components in the granular, making it substantially more user friendly when it comes to knowing which sound is linked to which parameter!

[drum.grains.maxpat](https://discourse.flucoma.org/uploads/short-url/wt73vOWSTBMHCAXNK3EqaVbl8fH.maxpat) (34.5 KB)  
[harmonicDrumGranular.maxpat](https://discourse.flucoma.org/uploads/short-url/yr98JqiFI7kzgr6T1TSoXEndSjK.maxpat) (153.6 KB)

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [August 24, 2023, 1:42pm UTC](https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073/6 "2023-08-24T13:42:06Z")

</div>

Nice.

I do wonder why there isn’t a default sorting applied, or a `@sort` attribute since this will be such a point of confusion/faff to most coders (novice and advanced alike). I get that there’s no solid universal way to sort things (centroid makes sense for bases imo), but _always_ getting a random order (unless you specifically seed things) makes it needlessly clunky.

This is especially the case since applying sorting requires getting into some gritty plumbing between the objects.

p.s. you don’t need the `counter` in your `sortdrums` subpatch. The `b` won’t trigger until after the `l` has done it’s thing, so something like this would work regardless of how many `components` you have (whereas the `counter` method would require you manually changing the cutoff point).

 ![Screenshot 2023-08-24 at 2.38.48 PM](https://discourse.flucoma.org/uploads/default/original/2X/7/7fdd12cacbc84e337ca3daabb1bbdb648cba6bf0.png)

---

<div class="post-metadata">

**Author:** ![MattS6464](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@MattS6464](https://discourse.flucoma.org/u/MattS6464)\
**Post date:** [August 24, 2023, 3:55pm UTC](https://discourse.flucoma.org/t/decomposing-drums-for-use-in-a-granular/2073/7 "2023-08-24T15:55:53Z")

</div>

Thanks again!  
I struggled to think of an immediate solution to that issue so I ended up needlessly overcomplicating things with the `counter`.

Here’s the full patch again with that quick fix!  
[drum.grains.maxpat](https://discourse.flucoma.org/uploads/short-url/wt73vOWSTBMHCAXNK3EqaVbl8fH.maxpat) (34.5 KB)  
[harmonicDrumGranular.maxpat](https://discourse.flucoma.org/uploads/short-url/gFlLeLq0q2xLV52MJftq9m6SD9E.maxpat) (151.7 KB)
