Monday, July 8, 2013

Guitar Fret Position Calculator

I've been using the googles a lot to get hints, tips and plans for my lutherie. One weak spot seems to be fret position calculators and/or templates. The few I found wanted to give me inches in a decimal representation, and that's not so useful unless I can find a ruler that will let me measure 1.3470 inches. I haven't found one yet. What I really need is a calculator with the ability to get inches as a fraction, or convert those inches to millimeters. So I wrote my own.

Calculating the positions of the frets was historically done with a technique called the rule of 18, whereby you successively divide the scale length minus the offset to the previous fret by 18. This could be done with a pencil and paper. Calculators and computers allow us to easily use a more accurate constant, and so the rule of 18 became the rule of 17.817.

Even with the more accurate constant of 17.817, there is a bit of cumulative error, as you add layers of approximation with each successive calculation. Calculators and computers to the rescue again, we can use a different calculation. The pitch of an ideal string goes up one octave if the length of the string is halved, and that midway point is coincidentally the position of the 12th fret. Thus, fret position offset will be a function of the twelfth root of two and the offset of any fret from the nut can therefore be calculated with the following formula:
    d = s – (s / (2 ^ (n / 12)))
That is the algorithm I use for my calculator. I convert to a fractional amount using a conventional formula with the default JavaScript rounding, and I convert to millimeters by multiplying the decimal inches by 25.4.

To use the calculator, enter the scale length you want in inches and hit the Calculate button. Typical scale length values are 24.75 for a Les Paul and 25.5 for a Stratocaster. You can adjust the precision, so that the fractional amounts are calculated as 16ths, 32nds, or 64ths. If your computer is slow give it a second, there is a lot of number crunching going on.

Calculate Fret Offsets from the Nut


Scale:
Fret# Inches (Decimal) Inches (Fractional) Millimeters
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

1 comment: