# Tempered Pitch Ratios with Groove

I would like to use groove as a real time sampler, kind of like the casio keyboards of old, where you can record a note and then get a couple of octaves of pitch appropriate equal tempered tuning from it. Obviously .5 playback speed is an octave down, and 2 times play back speed is an octave up. To make an equal tuning, is it as simple as dividing the distances by 12? from 1 to .5, and then from 1 to 2? I have the feeling I need some kind of equation with a log function or something. Would be great to use the kslider somehow with this as well… Any suggestions?

Thanks!

there’s probably a better way, but this is what you need:

**all**of the following text. Then, in Max, select

*New From Clipboard*.

```
----------begin_max5_patcher----------
592.3ocuVtrbSCCEFdsySgFOrHo3lQW7UXEq3g.XXThkSEXKkwVoDnS6yNxG
GSaJwDkwDuQi0QWl+ym9Ox5gYd9qz6EM9n2g9Dxy6gYddPn1.dG564Ww2utj
2.SyuRzzv2H7C5FyH1af3r39PpcURUov.ym9bP8NSeTxgnxbXs5Ue6VRR+56
lm4maEc5x2G8kCCUnUFEuBFv+C0RdY+h1xMquSp170ZwZS25HoYKwAnTbaKi
tLJ.QhWhOZyZj+B1LhcRsQeb1r1l.GggR7Cq1+KVTp44q3pMmjHDmIRzfDA1
7QQkHBzRaaIoSBU1Tq02KdBspjeRvvNIXnm.LrAASibipM8+yWiBRgTfRwrI
jRq1UTHpGlRDmoDcPJUXMnlVHMBeDijzREJCJuhRmPDYOZeZjkVjy4fFkugk
ANFZ10.J1COa9MRuA9p5M5wPTD3MvSn23snjw8envAIiTYFfGeTnD2yOOPnw
PYBEpbHYC.jr+m73FjEujwgjjyXVF.J7cFdkzAaBID9Oc2srISAUD62VilGF
hWhtAY6LeINJIIlRiirAl+lBB5Vj8vJNZwhEu+y0i61lzK8kMN6mxvc2AGdE
LTeuoTlKpu.qyotn4eVME7phJcQQi.RQRxYSdBEd7BiECWxvZS9Wjlvl5WJU
u94svN1F+3buQuqdcu35ePJ5YflKZLRE2H0pWNoilycx7bALL9PjJY9VsMGO
ngiTXvkKoHWjTxzpIhKZhMsZB6hll1yNmbS3oESNHovIUQgNnnzIUQoNnnwT
vY673reCXXljEA
-----------end_max5_patcher-----------
```

not at Max here so I don’t see the patch, but the twelfth root of 2 is approx:

1.0594631

written as 2 ^ (1/12)

if you take A=440 for example, multiply 440 by the above number to get B flat…multiply that by the above number again to get B… etc. It’s just like compound interest.

so you can see that if you multiply any starting number by that number twelve times, you’ll get double the number = 12 steps = one octave.

Feel free to use the **transratio** abstraction which is somewhere in the examples folder.

"To make an equal tuning, is it as simple as dividing the distances by 12?"

you dont even need to do that, because your input (midi notes 60, 61,62)

has that already, isnt it?

"from 1 to .5, and then from 1 to 2? I have the feeling I need some kind

of equation with a log function or something"

exactly, and what you need is [mtof] – converting note numbers to frequency

in hertz.

then you add an offset, which is your base note.

i have chosen middle C to be the base note, at which the playspeed is 1. :

[expr exp(0.057762265*($f1-60.))]

that will work with 12-tone temperament as well as with any other scale …

-110

Much easier to use pow() inside [expr] because you don’t need to worry about an equation with all those extra decimal places. You can also change it to different ET scales, want 6 notes per octave? Or 15? Just change the value in the [expr].

**all**of the following text. Then, in Max, select

*New From Clipboard*.

```
----------begin_max5_patcher----------
320.3ocuS9sSCBCEF+5xSQyIdwVBNW6Btf24ygawTftsZfVBTxPW16tskhiY
bJF+yMmj9cN7c93WgCAHHQ0xqA7c3GvHzg.DxIYEP9yHnf0llypciAaxUxlB
HrqkpQmy05mK4cdXayzPHFRXxs.dsetMJotV7haJBc1burwIgzXfyZhWrjoS
2Ijaerhmp6r81ElGAuL1VilaqTS8M2EYtnoRd55XXvFkrB2Fg6qDrb3zR6hs
aqTq3wf.aIbjLv3PBu5hLPH+qHvhnul.Q+KDfu2rqd+z7VWLAdaYEtTseBc1
pUgStZC4FBc5zKRpeY7DszVIznOiOzuKeHC3iyPHWHe+OMtLY0OGZ0plpz92
V+sC9Trx30ZgjoEJ4fYnmMyNQVF20tGJEhrRk4iLeDvq+vKvwlH5HRT7OHQl
CGCdELNUEXE
-----------end_max5_patcher-----------
```