# Shortcuts or higher-level Tidal functions for faster pattern composition

**URL:** <https://forum.toplap.org/t/shortcuts-or-higher-level-tidal-functions-for-faster-pattern-composition/354>\
**Category:** TidalCycles\
**Created:** [3 April 2019 13:42 UTC](https://forum.toplap.org/t/shortcuts-or-higher-level-tidal-functions-for-faster-pattern-composition/354 "2019-04-03T13:42:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kindohm](https://forum.toplap.org/letter_avatar_proxy/v4/letter/k/e79b87/32.png) [@kindohm](https://forum.toplap.org/u/kindohm)\
**Post date:** [3 April 2019 13:42 UTC](https://forum.toplap.org/t/shortcuts-or-higher-level-tidal-functions-for-faster-pattern-composition/354/1 "2019-04-03T13:42:49Z")

</div>

Have any of you developed your own custom functions or systems to more quickly make sound in Tidal? I mean, it doesn’t get much faster than `d1 $ s "bd"`, but:

1. Do you have specific rhythms that you always like to use?
2. Are there specific combinations of Tidal functions that you always use together?
3. Is there a way that you consolidate these things into a small function instead of working with a big block of code typed from scratch?

For example, I livecode against my drum machine all the time. To play a snare drum I do this:

```auto
d1 $ note "32" # s "midi" # midichan 1

```

I realize that this is MIDI code but I think this topic also applies to samples, so stay with me here. The above MIDI code is a bit tedious to type every time I just want to play a snare drum on my machine.

An improvement is this:

```auto
let snare = note 32 # s "midi" # midichan 1

d1 $ snare

```

And then I can easily play patterns against that:

```auto
d1 $ struct "t(<3 5>,8,<0 2 5>)" $ snare

```

or

```auto
d1 $ gain "1.25(<3 5>,8,<0 2 5>)" # snare

```

Since MIDI CC’s aren’t easily combined into the same pattern, I do the same thing for CC’s:

```auto
let snarePan = ccn 67 # s "midi" # midichan 1

d2 $ struct "t*16" $ ccv (range 0 127 $ slow 4 sine) # snarePan

```

But that CC pattern is still too much to type. Even better:

```auto
let snarePan = ccn 67 # s "midi" # midichan 1

let slowPan p = struct "t*16" $ ccv (range 0 127 $ slow 4 sine) # p

d2 $ slowPan # snarePan

```

_(above code has not been tested)_

So if those custom functions are defined automatically when Tidal boots up, now all I have to do is this:

```auto
d1 $ struct "t(3,8)" $ snare

d2 $ slowPan # snarePan

```

You could of course extrapolate this to samples:

```auto
d1 $ every 2 (sickRaveEffects) $ dopeRaveRhythm $ favRaveSample

```

The goal is simple chains of user-defined shortcuts.

Do any of you do things like this? If so, what is your goal? How do you achieve it?

---

<div class="post-metadata">

**Author:** ![bgold](https://forum.toplap.org/user_avatar/forum.toplap.org/bgold/32/19_2.png) [@bgold](https://forum.toplap.org/u/bgold)\
**Post date:** [3 April 2019 14:04 UTC](https://forum.toplap.org/t/shortcuts-or-higher-level-tidal-functions-for-faster-pattern-composition/354/2 "2019-04-03T14:04:30Z")

</div>

I’d like to branch out a bit more because I feel a little stuck in one sound, but I often start a rhythm with just `n (run 8)` and use a “drumkit” sample directory (like `feel`). My first few steps are usually to write something like `n (run 8 + "<0 1 0 2>" + "{0 1 3}%4")` and then start messing with `every`.

I use `inside m (every n f)` a lot, and made a shortcut `inev` for it (that I keep forgetting to use).

---

<div class="post-metadata">

**Author:** ![devNull](https://forum.toplap.org/user_avatar/forum.toplap.org/devnull/32/196_2.png) [@devNull](https://forum.toplap.org/u/devNull)\
**Post date:** [3 April 2019 20:20 UTC](https://forum.toplap.org/t/shortcuts-or-higher-level-tidal-functions-for-faster-pattern-composition/354/3 "2019-04-03T20:20:44Z")

</div>

Well I’ve recently starting using tidal. So far I have:

`wallOfSound p = (off (1/64) (#pan 0) . (#pan 1)) p`  
`retrolizer r = notchf (range 20 20000 $ slow r $ sine) # notchq 0.5`

where notchf and notchq are to custom params to a notch filter I added.  
wallOfSound can probably be rewritten using jux I think, but when I wrote it I wanted to be as explicit as I could.

Also I have a couple of fn to handle MIDI/OSC data.

`filterMidiKeys cond p = p + n(filterValues cond $ cP "[]" "notes")`

`keys p = (#octave 0) $ filterMidiKeys (>15) p`

I have a Akai MPKMini controller and the first 16 notes are on the pads, so I want to filter them out.  
Now I have to figure out how to remove “n” and replace it with a param so I can use in other contexts (#speed i.e.), but tidal is giving me an error (I thinks it has to do with infering types, and fn signatures…)

---

<div class="post-metadata">

**Author:** ![khoparzi](https://forum.toplap.org/letter_avatar_proxy/v4/letter/k/c37758/32.png) [@khoparzi](https://forum.toplap.org/u/khoparzi)\
**Post date:** [4 April 2019 21:22 UTC](https://forum.toplap.org/t/shortcuts-or-higher-level-tidal-functions-for-faster-pattern-composition/354/4 "2019-04-04T21:22:41Z")

</div>

let I’ve been meaning to put together a lot of pattern shortcuts, but these have lived in BootTidal for the past year or so.

```auto
let slowsine = (slow 4 (sine))
    slowersine = (slow 8 (sine))
    slowsaw = (slow 4 (saw))
    slowersaw = (slow 8 (saw))
    slowtri = (slow 4 (tri))
    slowertri = (slow 8 (tri))
    htime p = slow 2 $ p
    qttime p = slow 4 $ p
    dtime p = fast 2 $ p
    qdtime p = fast 4 $ p
    slow1 p = slow 1 $ p
    slow2 p = slow 2 $ p
    slow3 p = slow 3 $ p
    slow4 p = slow 4 $ p
    loop2 p = loopAt 2 $ p
    loop4 p = loopAt 4 $ p
    loop8 p = loopAt 8 $ p
    slice8 a p = slice 8 a $ p
    slice16 a p = slice 16 a $ p
    slice32 a p = slice 32 a $ p
    slice64 a p = slice 64 a $ p
    j p = jump $ p
    j4 n p = jumpIn n 4 $ p
    j8 n p = jumpIn n 8 $ p
    cl4 n p = clutchIn n 4 $ p
    cl8 n p = clutchIn n 8 $ p

```

---

<div class="post-metadata">

**Author:** ![telephon](https://forum.toplap.org/user_avatar/forum.toplap.org/telephon/32/209_2.png) [@telephon](https://forum.toplap.org/u/telephon)\
**Post date:** [6 April 2019 15:18 UTC](https://forum.toplap.org/t/shortcuts-or-higher-level-tidal-functions-for-faster-pattern-composition/354/5 "2019-04-06T15:18:20Z")

</div>

So far, I see that usually functions for function composition cover most use cases. Then, all is mainly a matter of naming them well, the rest is just moving code. Have you had cases where you need functions that take other functions as arguments?

---

<div class="post-metadata">

**Author:** ![ovitus](https://forum.toplap.org/letter_avatar_proxy/v4/letter/o/ea5d25/32.png) [@ovitus](https://forum.toplap.org/u/ovitus)\
**Post date:** [9 April 2019 18:43 UTC](https://forum.toplap.org/t/shortcuts-or-higher-level-tidal-functions-for-faster-pattern-composition/354/6 "2019-04-09T18:43:20Z")

</div>

This was helpful, I was able to make CC oscillation easier/faster:

(should be properly indented)  
sin a b c d = struct “t\*64” $ ccv (range a b $ slow c sine) # “midi” # d  
cc = s [  
sin 30 60 4 $ s[c 1,c 2,c 3,c 4,c 5] # ch 0,  
sin 50 60 8 $ s[c 1,c 2,c 3,c 4,c 5] # ch 1,  
sin 50 60 2 $ s[c 1,c 2,c 3,c 4,c 5] # ch 2,  
sin 55 60 6 $ s[c 1,c 2,c 3,c 4,c 5] # ch 3  
]  
d1 $ cc

And just making shortcuts for myself with function compositions.

I was trying something with euclid, but I’m seeing there are some limitations to that function.

Anyway, ‘up’ is a revelation too me right now in altering pitch. Simple way to create polymeter rhythms with midi:

d1 $ midichan “{0 ~ ~ 0 ~ ~ 0 ~, 1 ~ 1 ~ ~ ~ 1}%10” # “midi” # up “[10 20]\*2 -4 15/2”
