Help for Tune Smithy

# Ratios with factors

## Quick Start

Enter the ratios or cents value for your scale.

Check that the Primes listed are the ones you want in the factorisation.

Click "find ratios" to find some of the nearby ratios. After you've found the scale, to see more ratios visit #Succession of Closest Ratios for each degree of the scale

## Find the closest ratios for a scale

#### Cents diffs

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

## How to use

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 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 7//17 type n-et notation for the applet

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

## Tolerance

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.

## The primes list

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 .

## Succession of Closest Ratios for each degree of the scale

#### Cents diffs

#Find the closest ratios for a scale

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