# How to transpose within a scale?

**URL:** <https://uzu.lurk.org/t/how-to-transpose-within-a-scale/3921>\
**Category:** TidalCycles\
**Tags:** questions\
**Created:** [6 March 2022 17:18 UTC](https://uzu.lurk.org/t/how-to-transpose-within-a-scale/3921 "2022-03-06T17:18:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johanw](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/j/278dde/32.png) [@johanw](https://uzu.lurk.org/u/johanw)\
**Post date:** [6 March 2022 17:18 UTC](https://uzu.lurk.org/t/how-to-transpose-within-a-scale/3921/1 "2022-03-06T17:18:16Z")

</div>

Hi, here's a beginner's question. I'm trying to figure out how to transpose a melodic sequence while staying within a scale -- using a "root note". Having looked around the reference and forums for a recipe, I just can't seem to find any (or, anything I'm able to understand).

For example, how do you turn this

```haskell
once $ n "c d e f e d c" # sound "midi"

```

into this (transposing from c to d within c major)?

```haskell
once $ n "d e f g f e d" # sound "midi"

```

An ideal solution would of course use `scale` -- so one could say things like, "play melodic sequence _x_ using the D minor scale, starting each time from notes in sequence _y_".

---

<div class="post-metadata">

**Author:** ![bgold](https://uzu.lurk.org/user_avatar/uzu.lurk.org/bgold/32/383_2.png) [@bgold](https://uzu.lurk.org/u/bgold)\
**Post date:** [6 March 2022 17:31 UTC](https://uzu.lurk.org/t/how-to-transpose-within-a-scale/3921/2 "2022-03-06T17:31:38Z")

</div>

Yes, `scale` is useful here, you can do something like:

```haskell
tidal> n (scale "major" "0 1 2 3 2 1 0")
  (0>⅐)|n: 0.0n (c5)
 (⅐>²₇)|n: 2.0n (d5)
(²₇>³₇)|n: 4.0n (e5)
(³₇>⁴₇)|n: 5.0n (f5)
(⁴₇>⁵₇)|n: 4.0n (e5)
(⁵₇>⁶₇)|n: 2.0n (d5)
 (⁶₇>1)|n: 0.0n (c5)
tidal> n (scale "major" $ "0 1 2 3 2 1 0" + 1)
  (0>⅐)|n: 2.0n (d5)
 (⅐>²₇)|n: 4.0n (e5)
(²₇>³₇)|n: 5.0n (f5)
(³₇>⁴₇)|n: 7.0n (g5)
(⁴₇>⁵₇)|n: 5.0n (f5)
(⁵₇>⁶₇)|n: 4.0n (e5)
 (⁶₇>1)|n: 2.0n (d5)

```

---

<div class="post-metadata">

**Author:** ![johanw](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/j/278dde/32.png) [@johanw](https://uzu.lurk.org/u/johanw)\
**Post date:** [6 March 2022 18:37 UTC](https://uzu.lurk.org/t/how-to-transpose-within-a-scale/3921/3 "2022-03-06T18:37:21Z")

</div>

Thanks a million, this was the help I needed! It's satisfying to see that this goes up the C major scale:

```haskell
d4 $ fast 2 $ n (scale "major" $ "0 1 [2 3]" + "<0 4>") # sound "midi"

```

(And I could mention that the meaning of numbers and letters had me confused -- for example, that `4` here means the fifth note in the scale.)

I should add that I have also been scratching my head over how to select the key, and proudly display the following (using [this post](https://club.tidalcycles.org/t/week-6-lesson-2-musical-scales-including-navigating-them-with-waveforms/1256/8)), going to D3:

```haskell
d4 $ fast 2 $ n (scale "major" $ "0 1 [2 3]" + "<0 4>") |+ n "d3" # sound "midi"

```

Looking at this, wouldn't it would be more convenient to have a variant of `scale` that accepted the key as an argument?
