%% scale_length.txt %% Created by Laurence D. Finston (LDF) Sun 10 Jul 2022 09:22:37 AM CEST %% * (1) Copyright and License. %%%% Copyright (C) 2022 Laurence Finston %%%% You can redistribute this file and/or modify %%%% it under the terms of the GNU General Public License as published by %%%% the Free Software Foundation; either version 3 of the License, or %%%% (at your option) any later version. %%%% This file is distributed in the hope that it will be useful, %%%% but WITHOUT ANY WARRANTY; without even the implied warranty of %%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %%%% GNU General Public License for more details. %%%% You should have received a copy of the GNU General Public License %%%% along with this file; if not, write to the Free Software %%%% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA %%%% The author can be contacted at: %%%% Laurence Finston %%%% Laurence.Finston@gmx.de \input eplain \input epsf \input colordvi %% * (1) \special{papersize=297mm, 420mm} %% DIN A3 Portrait \hsize=297mm \vsize=420mm \advance\voffset by -1in \advance\hoffset by -1in \advance\voffset by 1cm \advance\hoffset by 1cm \advance\hsize by -1cm \advance\vsize by -1cm \parindent=0pt \parskip=0pt \headline={\hfil {\tt \timestamp}\hskip2cm} \font\largebx=cmbx12 scaled \magstephalf \font\small=cmr9 \font\smalltt=cmtt9 \pageno=-1 \begingroup \advance\hsize by -3cm \advance\hoffset by .25cm \parskip=.5\baselineskip \centerline{{\largebx Scale Length Generator}} \vskip\baselineskip \small Copyright (C) 2022 Laurence Finston \setbox0=\hbox{Last updated:\quad} \leavevmode\hbox to \wd0{Created:\hfil}July 10, 2022 \leavevmode\box0 July 13, 2022 %% Updated You can redistribute this file and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with This file; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA See the GNU Free Documentation License for the copying conditions that apply to this document. You should have received a copy of the GNU Free Documentation License along with this file; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA The author can be contacted at: Laurence Finston\hfil\break {\smalltt Laurence.Finston@gmx.de} \endgroup \vskip2\baselineskip \centerline{{\bf SEE FOLLOWING PAGE.}} \vfil\eject \skip0=9cm \centerline{{\bf Scale Layout Generator}} \vskip.75\baselineskip \hbox to 0pt{% %% %% \vbox to 0pt{\hbox to 0pt{Scale Length 15\thinspace cm, 19 Frets\hss} %% \vskip.5cm %% \hbox to 0pt{\epsffile{scale_length_1_001.eps}\hss}\vss}\hskip\skip0 %% \vbox to 0pt{\hbox to 0pt{Scale Length 20\thinspace cm, 21 Frets\hss} \vskip.5cm \hbox to 0pt{\epsffile{scale_length_1_002.eps}\hss}\vss}\hskip\skip0 %% \vbox to 0pt{\hbox to 0pt{Scale Length 25\thinspace cm, 17 Frets\hss} \vskip.5cm \hbox to 0pt{\epsffile{scale_length_1_003.eps}\hss}\vss}\hskip\skip0 %% \vbox to 0pt{\hbox to 0pt{Scale Length 30\thinspace cm, 21 Frets\hss} \vskip.5cm \hbox to 0pt{\epsffile{scale_length_1_004.eps}\hss}\vss}\hskip\skip0 %% \hss} \vfil\eject %% * (1) Quarter-tone scales \centerline{{\bf Quarter-Tone Scale Layouts}} \vskip.25\baselineskip \hbox to 0pt{\hskip.5cm %% \vbox to 0pt{\hbox to 0pt{Scale Length 30\thinspace cm, 38 Frets\hss} \vskip.5cm \hbox to 0pt{\epsffile{scale_length_1_021.eps}\hss}\vss}\hskip\skip0 %% \vbox to 0pt{\hbox to 0pt{Scale Length 35\thinspace cm, 50 Frets\hss} \vskip.5cm \hbox to 0pt{\epsffile{scale_length_1_022.eps}\hss}\vss}\hskip\skip0 %% \vbox to 0pt{\hbox to 0pt{Scale Length 38\thinspace cm, 47 Frets\hss} \vskip.5cm \hbox to 0pt{\epsffile{scale_length_1_023.eps}\hss}\vss}\hskip\skip0 %% %% \vbox to 0pt{\hbox to 0pt{Scale Length 30\thinspace cm, 21 Frets\hss} %% \vskip.5cm %% \hbox to 0pt{\epsffile{scale_length_1_024.eps}\hss}\vss}\hskip\skip0 %% \hss} \bye %% using namespace std; %% int %% main(int argc, char *arv[]) %% { %% printf("Entering `main'.\n"); %% float f = powf(2.0F, 1.0F/12.0F); %% double d = pow(2.0D, 1.0D/12.0D); %% long double ld = powl(2.0L, 1.0L/12.0L); %% cout << setprecision(128) %% << "f == " << f << endl %% << "d == " << d << endl %% << "ld == " << ld << endl; %% // f == 1.05946314334869384765625 %% // d == 1.0594630943592953098431053149397484958171844482421875 %% // (length "1.0594630943592953098431053149397484958171844482421875") == 54 %% // ld == 1.05946309435929526452345450504566315430565737187862396240234375 %% // (length "1.05946309435929526452345450504566315430565737187862396240234375") == 64 %% // Emacs-Lisp 1.0594630943592953 %% return 0; %% } %% (length "0594630943592953")16 %% %% This is a bit more technical, in case anyone is interested in the %% details (and doesn't know this already). %% The reason for using the %% 12th root of 2 is in order to lay out a scale using equal temperament. %% The reason for using the proportion 18/17 was because of the %% impracticality of doing it using direct calculation or a better %% approximation using the ratio of larger whole numbers before there %% were pocket calculators and computers. Nowadays, of course, we can %% let the computer do the calculations for us. %% So, why did I use %% 1.0595? Well, just in order to be able to use the values in the book %% by Benade. It would have been just as easy to let the computer use a %% better approximation. %% So, what would these approximations be? If %% I evaluate the Emacs-Lisp expression (expt 2 (/ 1 12.0)) in an Emacs %% buffer, I get the value 1.0594630943592953 with 16 places after the %% decimal point. It might be possible to get more decimal places, but I %% haven't bothered to look them up because Emacs-Lisp isn't really %% letting me get "close to the machine". One way to do this is to use %% the programming language C. %% In C, corresponding to the %% possibilites the hardware has of performing arithmetic, there are %% three kinds of "floating point" numbers for representing numbers with %% places to the right of the decimal point. They are called "float", %% "double" and "long double" and they have increasing degrees of %% precision. %% float f = powf(2.0F, 1.0F/12.0F); %% double d = pow(2.0D, 1.0D/12.0D); %% long double ld = powl(2.0L, 1.0L/12.0L); %% cout << setprecision(128) %% << "f == " << f << endl %% << "d == " << d << endl %% << "ld == " << ld << endl; %% // f == 1.05946314334869384765625 %% // d == 1.0594630943592953098431053149397484958171844482421875 %% // (length "1.0594630943592953098431053149397484958171844482421875") == 54 %% // ld == 1.05946309435929526452345450504566315430565737187862396240234375 %% // (length "1.05946309435929526452345450504566315430565737187862396240234375") == 64 %% // Emacs-Lisp 1.0594630943592953 %% Laurence Finston Posts: 215 Joined: Sunday 22 May 2022, 14:05 pm %% Location: Germany Contact: Contact Laurence Finston %% Scale Layout Generator %% Post by Laurence Finston ยป Sunday 10 July 2022, 13:21 pm After a %% discussion about scale layouts on another thread, I had the idea of %% programming a little scale layout generator, which I have now %% done. This is a PDF file with examples of the results: %% https://laurence-finston.de/graphics/scale_length_1.pdf This file, %% along with the source code, is on this page: %% https://laurence-finston.de/#Scale_Length_Generator %% The basic idea is as follows: To generate a scale layout, you need the %% length of the fretboard and the number of frets you want. For x >= 1, %% if d_x is the distance from the previous fret (or from the nut for x = %% 1), to fret f_x and d_x+1 is the distance from fret f_x to fret f_x+1, %% then d_x / d_x+1 is equal to the 12th root of 2. This number is %% irrational, so that an approximation must be used. This program uses %% the value 1.05946314334869384765625, which has 23 places to the right %% of the decimal point. It's the value of a 32 bit floating point number %% with 24 bits for the mantissa, 7 for the exponent and 1 for the sign %% (positive or negative). It is therefore quite a good approximation. %% Apart from calculating the positions of the frets, the rest of the %% program consists of drawing and labelling commands and some %% housekeeping. %% I plan on adding some more code to make it possible to do a complete %% layout conveniently, and also to break up the layout so that the parts %% fit on separate pages that can be printed out. Please note that it %% could be used without any trouble for layouts with fan frets and/or %% strings with different lengths. %% This may not be of any interest to professional luthiers, but it might %% be to amateurs or people who like to experiment. %% Edit: After fixing a few errors, I think this is correct now. \bye %% ** (2) %% * (1) Local variables for Emacs. %% Local Variables: %% mode:TeX %% eval:(outline-minor-mode t) %% eval:(read-abbrev-file abbrev-file-name) %% abbrev-mode:t %% outline-regexp:"%% [*\f]+" %% auto-fill-function:nil %% End: