YAFCalc

Yet Another Fret Calculator

Calculate the fret locations for various stringed instruments using various methods.

Theory of Operation.   Instructions   Equations

Copyright Brian S. Kimerer © 2017
These numbers are based solely on theory and mathematics.
I accept no liability if you mess up a fret board using this tool.

Scale Length  
Number of Frets  
Units Temperament



Theory of Operation

This web page calculates the fret locations on the finger board for various types of stringed instruments. "Why", you might ask "does the web need Yet Another Fret Calculator?" If you Google "Fret Calculator", you will get thousands of hits. You could just go use one of those.

However, my experience is that most (if not all) of those calculators assume that you want to use the Equal Tempered scale when locating the frets. While that may be a normally valid assumption, it is not always true. For some instruments, you might want to use Just Intonation instead.

A Little Explanation

I will not attempt to repeat the entire history of Western music theory here. That is beyond my capability. But here is a summary of why you might want to use a different intonation system.

In Western music there are currently two prevailing ways of playing scales on a musical instrument.

  1. Just Intonation
  2. Equal Temperament

Some instruments that use the Just Intonation include:

Instruments that make use of the Equal Tempered scale include:

Just intonation is the original way that scales and chords were calculated. It is based on the principle that the notes of the scales result from frequency relationships to the tonic (the base note) that are ratios of small numbers. For example, the frequency of each note of the Diatonic Ionian scale can be calculated by multiplying the base note by multipliers as shown in the table below.

Note Ratio
C 1/1
D 9/8
E 5/4
F 4/3
G 3/2
A 5/3
B 15/8
C 2/1

That is simply the C Major scale. So the frequency ratio for a perfect fifth (C to G) is 3/2. That is called a "perfect fifth" because it is physiologically the most consonant and pleasing fifth interval. To calculate the frequency of note G, multiply the frequency of C by 3/2. The octave (C to C) is 2/1.

The scale above is a seven note scale called the Diatonic scale. This is also called, "Pythagorean tuning". You can look it up. The subject is too complex for me to address it here.

While the Just Intonation presents the purest form of consonance, there are issues that arise when changing keys. You basically have to tune the instrument to the key that you want to play in. If you begin playing the scale on any note other than the tonic, you end up playing in one of the original "modes", which does not sound like the Ionian major scale. This music was invented during simpler times.

Equal Temperament was invented to circumvent those issues and allow you to play in multiple keys without re-tuning. It is a compromise in the tuning of the intervals, hence the intervals are not exactly correct to the ear (e.g. a fifth is no longer a "perfect fifth" in any key), but the differences are small enough that most people do not notice the errors. The added value of Equal Temperament is that it allows you to play the instrument in any key without re-tuning. To many people, the value of being able to modulate between keys is worth more than the loss of perfect consonance in the intervals.

The Equal Tempered scale is calculated by using a fixed ratio for the frequency of each note to the frequency of the previous note. That ratio is the twelfth root of two, which is shown like this:

Twelfth Root

The twelfth root of two is a number that, when multiplied by itself 12 times, will result in the value 2. The value for that number is approximately, 1.05946309436. So, to calculate the frequency of the note C# in the C major scale, you would multiply the frequency of C, by 1.05946309436. The frequency of middle C is around 261.63 Hz., and therefore in the equal tempered scale, the frequency of note C# is around 277.187329377. The frequency of the note D is C# times 1.05946309436, or about 293.669745699.

If you calculate the frequency of the note D using Just Intonation, you multiply the frequency of C by 9/8 (from the table above). 261.63 * 9/8 = 294.33375. That is close to the Equal Tempered D, but not exactly the same note.

By multiplying the frequency of each note by the twelfth root of 2 to get the next note, you will obtain the ascending Chromatic Scale. Each step is a called a "semi-tone". When you get to the 12th note, you get the octave C. The ratio of the octave to the tonic, is exactly 2/1, so multiplying the twelfth root of two times itself 12 times gets you to that ratio. Hence, at the twelfth note, you obtain an exact octave, just like you do with the Just Intonation.

Since each note has exactly the same ratio to its previous note, you can begin a scale on any of the notes and end up with the same chromatic scale, but raised or lowered in pitch. Hence, you can play in any key on the same instrument, without re-tuning it.

Here is the equation that YAFCalc uses to calculate the locations of the frets using the Equal Tempered scale.

Equation

You can see the twelfth root of 2 to the nth power in the equation, but it is in the denominator of the fraction. That is because we are calculating the length of a string for a note, not the frequency of the note. The string length is inversely proportional to the frequency, i.e. the shorter the string the higher the frequency. So we have to divide by the number instead of multiplying.

I won't go into the derivation of the equation right now. If you are really interested, I have provided it in its own section below.

Go To The Derivation

You just need to understand that the calculation of these fret positions for Equal Temperament is different than it is when calculating the fret positions for an instrument that uses the Just Intonation. The differences are not large, but they are real.

OK. On to the instructions, or,   Go Back to the Calculator

How to Use the Calculator

Enough theory. Here is how to use the calculator.

There are four entries that you need to fill in to use the calculator:

  1. Scale Length
  2. Number of Frets
  3. Units
  4. Temperament

Fill in the entries for the calculations you want YAFCalc to perform. Then click the "Calcuate" button. YAFCalc will calculate the fret positions and format the results into text in the text area beneath the button. Once you have the numbers that you want, select the text, copy it, and paste it into whatever document you would like in order to view it or print it.

I set the program up this way instead of filling in a spreadsheet or a table because it seemed easier to export the results that way. The fields are described in the sections below.

Scale Length

Enter the length of the scale in this field.

The Scale Length is the entire distance between the nut and the bridge. Once you decide on the scale length that you want, enter the number into this field in the units you want to use for measuring the fret locations.

Number of Frets

In this field enter the number of frets for which you want to calculate the positions.

It is theoretically possible to have an infinite number of frets on a finger board, but that will not work on a real instrument. The frets get closer together as you go up the neck. As you move up the neck more and more frets will go into smaller and smaller space until too many frets will cause them to pile up at the end toward the bridge. You can calculate as many as you want, but you won't be able to install them after a certain point. Here are some common numbers of frets on various instruments.

Note

The Mountain Dulcimer is a special kind of exception to the rule. The dulcimer normally has the frets arranged in a Diatonic scale for 17 frets. However they often add what is called the "6 1/2" fret. It is, indeed an 18th fret, but the numbering scheme does not count it as the frets are named up the finger board. It is simply called the "6 1/2 fret". It sits between the 6th fret and the 7th fret. I have preserved this nomenclature in the YAFCalc program. When entering the number of frets for a Dulcimer, please use the traditional naming convention or you will get an extra fret (or two).

Note

Another odd convention for a Dulcimer is that there is only one 6 1/2 fret installed even though there is an additonal space where one would be appropriate (between fret 13 and fret 14). YAFCalc calculates the distance to that extra 6 1/2 fret, but it is not normally installed on an instrument. If you don't want it, skip it when you cut the fret slots.

Units

Select the desired units from the dropdown menu. The options are:

Make sure that the Scale Length is specified in the same units that you have chosen in this field, or, alternatively make sure that you choose the proper units for the Scale Length entry.

The "inches" units can be requested in either a fractional format or in a decimal format for partial inches. The fractional measurement goes only down to 1/128 of an inch. That is usually the smallest you can see or even estimate on any rule.

Temperament

Select the desired temperament from the dropdown menu.

This is where it gets interesting. There are several different temperaments that YAFCalc will use to calculate the fret differences.

I address the details of each of the temperament selections in the sections below, but first I need to describe what the Calculate button does.

When you click the Calculate button, YAFCalc calculates the distances to the frets as specified in the fields, and formats the output into text that is displayed in the text area beneath the button. The text is selectable, so you can select some or all of the output, paste it into whatever document format you want to use, and save it, print it, or send it out as you desire. This seemed to me to be a more efficient way of exporting the results than putting the output into tables or spreadsheets or whatever else the others do.

Equal Tempered Chromatic

This selection tells YAFCalc to calculate fret positions for an Equal Tempered Chromatic scale. That is the normal scale to use for instruments like guitars and banjos.

Diatonic Just Intonation

This selection tells YAFCalc to calculate fret positions for a Diatonic scale using Just intonation. The intervals are based on the small number ratios as explained above. If you want to make a dulcimer without the 6 1/2 fret you could use this option to do that. Other than that, I can't think of a lot of reasons you would want to use this. Maybe you could use it to calculate where to tie on gut frets for a lute or something like that.

Dulcimer Just Intonation

This selection tells YAFCalc to calculate fret positions for a Mountain Dulcimer. It uses the Just intonation for the notes, and it includes the 6 1/2 frets in each octave.

It is traditional to include only the first 6 1/2 fret on a dulcimer finger board, but YAFCalc calculates one for each octave anyway... just in case you might want to put one in. If you do not want to use the second 6 1/2 fret, simply delete it or don't cut the slot. You can also use this setting to calculate a dulcimer fret board with no 6 1/2 fret at all. Simply leave out all the 6 1/2 frets when you cut the fret slots.

When you use this, keep in mind that the names of the frets do not take into account the existence of the 6 1/2 fret. The 7th fret comes after the 6 1/2 fret, not after the 6th fret. The fret numbers go 1, 2, 3, 4, 5, 6, 6 1/2, 7, 8, 9, 10, etc.

Dulcimer Equal Tempered

This selection tells YAFCalc to calculate fret positions for a Mountain Dulcimer. It uses the Equal Temperament scale for the fret positions, but it leaves out the semi-tones that it does not need for the Diatonic scale on the dulcimer. The calculations do include the 6 1/2 frets. This scale, as it turns out, is how most of the dulcimer frets are calculated. I measured the fret distances on my own dulcimer, and they match up with this scale.

I do not know if a dulcimer with Just intonation would sound different from one using Equal Temperament because I don't think I have ever heard one played. I will have to build one to find out.

That is about all there is to this tool. Now, Go Back to the Calculator and try it out.

Or, you can find out where the equation for the Equal Tempered fret locations came from, in the next section.

Derivation of the Equal Temperament Fret Equation

Here is the derivation of the equation that YAFCalc uses to calculate the locations of the frets for the Equal Tempered scale.

The equal tempered scale is based on each semitone being higher in frequency by exactly the twelfth root of two times the next lower tone. This was done as a compromise in tuning that is too complex to address here. But it makes some minor compromises on intonation and adds a very regular tuning on which you can play any key. Here is how it works.

The twelfth root of two is approximately 1.05946309436. To get the frequency of the string fretted at the first fret, you would multiply the frequency of the open string times 1.05946309436. To calculate the frequency at the second fret, you multiply the note at the first fret times the twelfth root of two.

I am tired of typing 1.05946309436, so let's just call it TR, for the Twelfth Root of 2. Also, lets call the note on the open string N0 (for Note 0). That would make the note at the first fret N1.

The frequency of N1 relative to N0 is N0 * TR. Here is an equation.

N1 = N0 * TR

The frequency of N2 relative to N1 is N1 * TR.

The equation:

N2 = N1 * TR

And so on all the way up the scale.

Using substitution, you can calculate the frequency of N2 relative to N0.

N2 = N1 * TR, so substituting N0 * TR for N1, we get

N2 = (N0 * TR) * TR.

So, N2 = N0 * TR2

In this case, the TR2 means to square the value, i.e multiply it by itself.

The frequency N3 = N0 * TR3

That is the open string note times the Twelfth Root of 2 cubed.... TR * TR * TR.

If you take the twelfth root of 2 and multiply it by itself 12 times, TR12, you will get exactly the value 2. That is how the equal tempered scale gives us the octave at the twelfth fret. 1.0594630943612 = 2

The frequency at N12 is N0 * TR12, which is exactly 2.

You can generalize this to say that the frequency of the note at any fret n is

Nn = N0 * TRn

Simply take the nth power of TR and multiply times the fundamental frequency of the open string.

OK so far.

The frequency of the string goes up because the string gets shorter. What we need to calculate is the length of the fretted string, not the frequency of the fretted string. You can get the actual length of the string using the following formula. The length when fretted at fret 1 we will call L1

L1 = Scale Length / TR

Notice that while we multiplied by TR to get the frequency, we divide by TR to get the string length. The length is inversely proportional to the frequency. As the frequency goes up, the string length goes down. Since the string length is directly proportional to its vibrating frequency we can divide the open length by TRn to get the new length.

This generalizes to any fret, i.e.

Ln = Scale Length / TRn

Since we are now calculating the length of the string, which is the the distance from the fret to the bridge, we can calculate the distance from the nut to the fret by subtracting the string length from the Scale Length.

Note

Always measure the distance to each fret from the nut. That is because on some instruments the bridge can be moved. The nut is always fixed.

Also, never measure from one fret to the next fret. You can theoretically calculate the distance from a fret you just installed to the next fret and measure that distance to install the next fret. You should never do that because any errors in measurement will be added fret to fret. Always measure the distance to any fret from the nut.

If the distance from the nut to the first fret is called d1 we can calculate it this way:

d1 = Scale Length - L1 (just the scale length - string length)

So, substituting for L1

d1 = Scale Length - Scale Length / TR1 (first power)

For the distance from the nut to the second fret, d2 we use

d2 = Scale Length - Scale Length / TR2 (second power)

So, now we can generalize this formula for any fret.

dn = Scale Length - Scale Length / TRn

We are almost there.

We can factor out the scale length value in the formula above to get

dn = Scale Length * (1 - 1 / TRn)

We represent the Twelfth root of 2, TR, in the following way:

Twelfth Root

If we show that symbol in the equation above, we get the following equation.

Equation

Aren't you glad you asked?

Go Back to the Calculator