Cents and ratios Ratios with factors Mean tone in cents Under / Over UO, non octave & scale tree Quintic Music and virtual flowers

# Find the closest ratios for a scale - or convert to other notations

#### Tolerance cents, Max quotient How far from closest numerator to search for each denominator steps (0 for no limit)

Enter a single value in the Scale box to see successive ratio approximations to it. Shows ratios with increasing quotients until a ratio is reached within the specified tolerance.

You can also enter an entire scale in the Scale box. If there is more than one entry, only the most accurate ratio for each entry gets shown in the Ratios box. However, you can 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.

You can also use this applet to convert an entire scale betweenn the various notations. 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.

To convert to cents, just enter the scale in the selected notation and the scale in cents gets shown below.

The n-et notation works like this: 7//17 means the 7th degree of seventeen equal temperament - so this is short for . 7/17 * 1200 cents. So - a fractional mutliple of 1200 cents.

For the cents or ratios use a '/' when you want to enter a ratio. All other values are understood to be in cents. So you don't need to enter the decimal point - this is just to make it quicker to enter values by hand in the applet. Note - the standard SCALA notation requires all cents values to include a decimal point.

For the n-et notation then when entering data by hand / is understood as // when n-et notation is selected. Annything else is understood as centvs.

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.

#### More options for the list of primes

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 this 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.