# (Hopefully) Interesting snippet for making melodies

**URL:** <https://uzu.lurk.org/t/hopefully-interesting-snippet-for-making-melodies/2012>\
**Category:** TidalCycles\
**Tags:** resources\
**Created:** [24 August 2020 13:37 UTC](https://uzu.lurk.org/t/hopefully-interesting-snippet-for-making-melodies/2012 "2020-08-24T13:37:13Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![BongLebowski](https://uzu.lurk.org/user_avatar/uzu.lurk.org/bonglebowski/32/831_2.png) [@BongLebowski](https://uzu.lurk.org/u/BongLebowski)\
**Post date:** [25 August 2020 17:30 UTC](https://uzu.lurk.org/t/hopefully-interesting-snippet-for-making-melodies/2012/21 "2020-08-25T17:30:37Z")

</div>

I'm gonna try these out soon!

And, I am glad you enjoyed my set. It wouldn't have been possible without your initial pattern 🙂

---

<div class="post-metadata">

**Author:** ![ghales](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ghales/32/2171_2.png) [@ghales](https://uzu.lurk.org/u/ghales)\
**Post date:** [14 September 2020 17:13 UTC](https://uzu.lurk.org/t/hopefully-interesting-snippet-for-making-melodies/2012/22 "2020-09-14T17:13:53Z")

</div>

Here's a structure that allows changing the key of multiple running patterns at once (I've been finding it super useful!):

```haskell
-- boot.tidal
let getGlobalMode = cS "chromatic" "global_mode"
    setGlobalMode = setS "global_mode"
    getGlobalRoot = cF0 "global_root"
    setGlobalRoot = setF "global_root"
    tonal rr mm = note . (|+ rr) . scale mm
    t = tonal getGlobalRoot getGlobalMode
    setkey root mode = do
      setGlobalMode mode
      setGlobalRoot root

-- usage
setkey "<0 3>" "dorian"

do
  p "mel" $ t "0 2 4 7" # s "superpiano" # pan 0.4
  p "bass" $ t "0@3 4@3 7@2" # s "superpiano" # octave 5
  p "chords" $ t "[~ [-3,0,4,6]*<2 1>]*2" # s "superhammond" # pan 0.65

-- then
setkey 4 "locrian"
setkey (-2) "major"
...

```

Calling `setkey` changes the global root and mode. Hope someone finds this helpful!

btw. I discuss this solution in detail [here](https://youtu.be/HNmxtJyDc14)

---

<div class="post-metadata">

**Author:** ![artheist](https://uzu.lurk.org/user_avatar/uzu.lurk.org/artheist/32/594_2.png) [@artheist](https://uzu.lurk.org/u/artheist)\
**Post date:** [14 September 2020 19:28 UTC](https://uzu.lurk.org/t/hopefully-interesting-snippet-for-making-melodies/2012/23 "2020-09-14T19:28:33Z")

</div>

Really nice, I am going to try that out lately.  
The YT video is private, but I understand how it works, just need to try it for myself.

Thanks

[Previous page](https://uzu.lurk.org/t/hopefully-interesting-snippet-for-making-melodies/2012.md?page=1)
