# Functions for custom scales

**URL:** <https://in-thread.sonic-pi.net/t/functions-for-custom-scales/7637>\
**Category:** Creations & Ideas\
**Created:** [March 12, 2023, 7:30am UTC](https://in-thread.sonic-pi.net/t/functions-for-custom-scales/7637 "2023-03-12T07:30:12Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![cubicinfinity](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/cubicinfinity/32/2355_2.png) [@cubicinfinity](https://in-thread.sonic-pi.net/u/cubicinfinity)\
**Post date:** [June 26, 2023, 3:53am UTC](https://in-thread.sonic-pi.net/t/functions-for-custom-scales/7637/21 "2023-06-26T03:53:21Z")

</div>

To avoid conversions between midi and hz, `12*Math.log2(equave)` is effective.

---

<div class="post-metadata">

**Author:** ![jonny](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jonny](https://in-thread.sonic-pi.net/u/jonny)\
**Post date:** [March 22, 2024, 5:58pm UTC](https://in-thread.sonic-pi.net/t/functions-for-custom-scales/7637/22 "2024-03-22T17:58:11Z")

</div>

Just stumbled on this, silly question perhaps, but is this rationalize method being used to get rational numbers?

Also, the equave is 2 - is that because an octave is 2:1 ?  
And what’s an ‘equave’? Some [equave blues](https://www.youtube.com/watch?v=S19HNhc5ebE) - related?!

I’ve been studying these a while  
[Just Intonation Explained (kylegann.com)](https://www.kylegann.com/tuning.html)  
[A Plague of Ratios - Music (maa.org)](https://maa.org/book/export/html/116612)  
hoping to grasp enough to plug into SP to make some stuff ala mannfish, another recent discovery.

Highly recommend… apologies for going off-topic… bookmarking this, quite a lot to process!

---

<div class="post-metadata">

**Author:** ![cubicinfinity](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/cubicinfinity/32/2355_2.png) [@cubicinfinity](https://in-thread.sonic-pi.net/u/cubicinfinity)\
**Post date:** [March 31, 2024, 9:11pm UTC](https://in-thread.sonic-pi.net/t/functions-for-custom-scales/7637/23 "2024-03-31T21:11:02Z")

</div>

Sorry for the slow reply. Rationalize takes a value and finds the closest rational approximation, within the given parameters.

An “equave” as I’m using it and as used by the xenharmonic/microtonal community is a generalized term for the interval (usually being divided). You are correct; 2 is used to specify an octave, 2:1. The tritave is the 3:1 ratio. The Bohlen Pierce scale is a popular tuning that doesn’t use octaves, but instead divides a tritave into 13 notes (usually equal tempered, but BP scales sometimes use just intervals instead). The tuning Jumble used is a system that divides 4:1. I would assume he said 4/1 equave because there isn’t a well known name like “quartave”. Octave is a confusing name for what should be called a bitave (is an “octave” the 8:1 ratio?). An equave can be on anything, even an irrational value like pi.

Note that while 12ed2 (12 tone equal temperament) is an exact subset of 24ed2 (quarter tones), the math isn’t as simple when you change the equave: 19 divisions of 2.5 (19ed2.5) does not generate the same notes as 38 divisions of 5 (38ed5).

[Previous page](https://in-thread.sonic-pi.net/t/functions-for-custom-scales/7637.md?page=1)
