From the help for Tune Smithy
Skip navigation Overview Seeds etc User guide Main Window Musical note intervals Scales Midi in Analyse sound
Contents
Hide Contents

Find the closest ratios for a scale

Quick start: enter the ratios or cents value for your scale.
Check that the Primes listed are the ones you want in the factorisation.
Then click "find ratios" to find some of the nearby ratios.
For various options, see below.

To halt the calculation, and try again, use your browser STOP button.

Cents or ratios Cents or n-et Decimal Hertz

Scale:

1/1 in Hz (middle C = 261.62556 Hz, A = 440)

Max quotient Decimal places Tolerance cents
How far from closest denumerator to search for each denominator steps (0 for no limit)

upper lower both closest

Primes (or composite factors)

Ratios

Factorisation

As cents

Cents diffs

Enter a single value in the Scale box, then click the find ratios button to see successive ratio approximations to it. The results start with a ratio with a small quotient and continue with ones with larger quotients that get closer and closer to the desired value and that fit the parameters, until they get close enough to be within the specified tolerance.

You can also enter an entire scale in the Scale box. When you click the button, the most accurate ratio for each entry gets shown in the Ratios box. Then scroll down this page to see the successive ratio approximations for each scale degree to see all the other ratios found for each entry on the way.

You can also use this applet to convert an entire scale from cents to hertz and back, or to n-et notation and back. Enter the entire scale into the Scale box as before, then change the selection for the notation. Choose how many decimal places you want to see. Values in hertz are shown with two extra decimal places, and decimals are shown with four extra decimal places. When converting to n-et, the tolerance is used a tenth of the tolerance selected for the scale results. All n-ets are checked up to 1200-et, and the best one used.

The n-et notation works like this: 7//17 means the 7th degree of seventeen equal temperament - so this is short for . 1200 * (7/17) cents. Another way of thinking about it is that 7//17 is an interval of seven seventeenths of an octave (so for instance the tritone is 1//2). It looks like a ratio but is actually a quick way of entering n-ets.

For the cents or ratios and cents or n-et selctions, use a '/' or '//' respecively when you want to enter a ratio or a value in n-et notation, e.g.as: 5/4, or 3/1 if it is a whole number. All other values are understood to be in cents: 250 (you don't need to include a decimal point to indicate cents values with this applet).

Set the tolerance to the minimum difference you want between the ratio and the cents value. Note that if you set the max quotient high, and the tolerance low, then the calculation will be slow, - this script isn't particularly speedy as it goes through the quotients one at a time testing them all. Also, it is written in javascript, which is a slow language because it is "interpreted" (each instruction gets parsed every time it is used, rather than it all being done at once in advance of the calculation in a separate build step when the program gets made)..

You can show the approximations found above the desired value only (positive cents diffs), below it only, both (i.e. both those sequences, interleaved - shown in order of the size of the quotient) or the closest ones. The difference between both, and closest, is that with closest the absolute values of the cents diffs keep decreasing each time, while with both, the positive values decrease, the negative ones do also, but sometimes a negative cents diff may be larger than the previous positive one or vice versa.

To halt the calculation, and try again, use your browser STOP button. The calculation may well be slow if you set the tolerance low as the method used is rather inefficient. It is just one that is easy to code and works for the small ratios of most interest in scale design.

List the primes you want to appear in the ratios for the Primes (or composite factors) field - e.g. 2 3 5 7 for 7-limit ratios - or if you want to see all approximations whatever their factors, leave the primes field blank.

You can also set a maximum power for a prime, do it like this: " 2^8 3^5 " to set max powers of 2^8 and 3^5. This means that three can only be used up to the eighth power in the ratio, and three only up to the fifth power.

To exclude a prime, show it as a negative number. E.g. use -7 to search for all numbers except those divisible by 7. This can be combined with the positive primes, e.g. use 3 -9 to allow any multiple of 3, except for those that are a multiple of 9 (not sure why one would want to do it, but it comes for free!).

To set a maximum power for a prime, do it like this: "2^8 3^5" to set max powers of 2^8 and 3^5.

Entries in the factors field can also be composite. So for instance, if you enter 6 as a value, you will find ratios with denumerator or denumerator a multiple of 6 .

Note to programmers: You are welcome to modify this code and copy it, and use it in your own web pages or programs - it is free source. Use View Source in your browser, and cut and paste. No restrictions, and no need to acknowledge the author anywhere including in your code - also of course also, no warranties of fitness for any purpose. 

Successive ratio approximations for each degree of the scale

Ratios for degree 1

Factorisation 1

As cents

Cents diffs

Ratios for degree 2

Factorisation 2

As cents

Cents diffs

Ratios for degree 3

Factorisation 3

As cents

Cents diffs

Ratios for degree 4

Factorisation 4

As cents

Cents diffs

Ratios for degree 5

Factorisation 5

As cents

Cents diffs

Ratios for degree 6

Factorisation 6

As cents

Cents diffs

Ratios for degree 7

Factorisation 7

As cents

Cents diffs

Ratios for degree 8

Factorisation 8

As cents

Cents diffs

Ratios for degree 9

Factorisation 9

As cents

Cents diffs

Ratios for degree 10

Factorisation 10

As cents

Cents diffs

Ratios for degree 11

Factorisation 11

As cents

Cents diffs

Ratios for degree 12

Factorisation 12

As cents

Cents diffs

Ratios for degree 13

Factorisation 13

As cents

Cents diffs

Ratios for degree 14

Factorisation 14

As cents

Cents diffs

Ratios for degree 15

Factorisation 15

As cents

Cents diffs

Ratios for degree 16

Factorisation 16

As cents

Cents diffs

Ratios for degree 17

Factorisation 17

As cents

Cents diffs

Ratios for degree 18

Factorisation 18

As cents

Cents diffs

Ratios for degree 19

Factorisation 19

As cents

Cents diffs

Ratios for degree 20

Factorisation 20

As cents

Cents diffs

Ratios for degree 21

Factorisation 21

As cents

Cents diffs

Ratios for degree 22

Factorisation 22

As cents

Cents diffs

Ratios for degree 23

Factorisation 23

As cents

Cents diffs

Ratios for degree 24

Factorisation 24

As cents

Cents diffs

Ratios for degree 25

Factorisation 25

As cents

Cents diffs

Ratios for degree 26

Factorisation 26

As cents

Cents diffs

Ratios for degree 27

Factorisation 27

As cents

Cents diffs

Ratios for degree 28

Factorisation 28

As cents

Cents diffs

Ratios for degree 29

Factorisation 29

As cents

Cents diffs

Ratios for degree 30

Factorisation 30

As cents

Cents diffs

Ratios for degree 31

Factorisation 31

As cents

Cents diffs

Ratios for degree 32

Factorisation 32

As cents

Cents diffs