-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathguitar-fretboard.tex
1006 lines (833 loc) · 28.6 KB
/
guitar-fretboard.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[a4paper]{article}
\newif\ifintroduction
\introductiontrue
\newif\ifannexes
\annexestrue
\usepackage[english]{babel}
\usepackage{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tcolorbox}
\tcbuselibrary{listings,documentation}
\tcbuselibrary{documentation,listings,minted}
\tcbuselibrary{breakable}
\tcbuselibrary{skins,raster}
\tcbset{%
listing engine=minted,%
index actual=~,
}
\usepackage{url}
\usepackage{minted}
\usepackage{calc}
\usepackage{makeidx}
\usepackage{multicol}
\tcbset{
doc-code/.style = {%
boxrule=0.1pt,
colframe=red!75!black,
%% left=8mm,
halign=flush center,
width=\linewidth,
breakable=true,
colback=white,
enhanced,
},
warning/.style = {%
colback=red!5!white,
colframe=red!45!white,
boxrule=0.5pt,
},
}
\newminted[macrocode]{latex}{
breaklines,
breakafter=()/+-\,
baselinestretch=0.5,
fontsize=\footnotesize,
linenos,
numbersep=3mm,
firstnumber=last}
\BeforeBeginEnvironment{macrocode}{%
\begin{tcolorbox}[doc-code]
}%
\AfterEndEnvironment{macrocode}{
\end{tcolorbox}
}%
\newminted[example]{latex}{
breaklines,
breakafter=()/+-\,
baselinestretch=0.5,
fontsize=\footnotesize}
\BeforeBeginEnvironment{example}{%
\begin{tcolorbox}[doc-code]}
\AfterEndEnvironment{example}{
\end{tcolorbox}
}%
\usepackage{guitar-fretboard}
\makeindex
\usepackage[super]{nth}
\newcommand{\pkg}[1]{\texttt{#1}}
\usepackage{longtable}
\newcommand{\mypitchline}[1]{
\texttt{#1} &
\FBgetNote{#1}{degree} &
\FBgetNote{#1}{semitones} &
\FBgetNote{#1}{tex} &
\FBgetNote{#1}{tex small} &
\texttt{\FBgetNote{#1}{reversed}} &
\texttt{\textbackslash{P#1}}
\\
}
\newcommand{\myintervalline}[1]{
\texttt{#1} &
%% \texttt{\FBgetNote{#1}{aliases}} &
\FBgetNote{#1}{degree} &
\FBgetNote{#1}{semitones} &
\FBgetNote{#1}{name} &
%% \csname I#1\endcsname &
\FBgetNote{#1}{tex} &
\FBgetNote{#1}{tex small} &
\FBgetNote{#1}{reversed}
\\
}
\newcommand{\mychordline}[1]{
\texttt{#1} &
\getScale{#1}{name} &
\showChord{C}{#1} &
\showChordFs{C}{#1} &
\getScaleIntervals{#1}
\\
}
\makeatletter
\newcommand{\ListSemitones}[1]{%
\begin{itemize*}[%
afterlabel={},
before={(},
after={)},
label={},
mode=unboxed,
itemjoin={,\space}]%
\edef\@current@tuning{\pgfkeysvalueof{/fb/tunings/#1}}%
\foreach \i in \@current@tuning{%
\item\i
}%
\end{itemize*}%
}%
\newcommand{\FBnotesFromList}[1]{%
\edef\@current@tuning{\pgfkeysvalueof{/fb/tunings/#1}}%
\foreach \i in \@current@tuning{%
\@transposepitch{C}{\i}%
\csname p\newpitch\endcsname%
}%
}%
\makeatother
\newcommand{\mytuningline}[1]{
\texttt{#1} &
\FBnotesFromList{#1} &
\ListSemitones{#1}
\\
}
\usepackage{colortbl}
\newcommand{\mycolorline}[1]{
\texttt{#1} &
{\cellcolor{RGBbg#1}{\textcolor{fg#1}{\texttt{RGBbg#1} / \texttt{fg#1}}}} &
{\cellcolor{bg#1}{\textcolor{fg#1}{\texttt{bg#1} / \texttt{fg#1}}}}
\\
}
\newcommand{\TikZ}{Ti\textcolor{orange}{\emph{k}}Z\xspace}
%% \newcommand{\PGF}{\textsc{PGF}}
\newcommand{\unstable}{%
\begin{tcolorbox}[warning]%
This option is susceptible to change. Do not use directly it in large
documents.
\end{tcolorbox}%
}%
\begin{document}
\title{the \pkg{guitar-fretboard} package }
\author {Sébastien Gross <seb -at- chezwam -dot- org>}
\date{This file describes version \fbfileversion\ (\fbfiledate)}
\maketitle
\tableofcontents
\begin{tcolorbox}[warning,before={\vspace{1cm}}]
\pkg{guitar-fretboard} is still in an early development stage. High-level
functions are stable enough to be used. Low-level functions and storage
are subject to change, especially the note definition. That said with
high-level functions you can yet do a lot of things.
\end{tcolorbox}
\ifintroduction
\section{Introduction}
The \pkg{guitar-fretboard} package can be used to generate some nice-looking
guitar fretboard diagrams. Those diagrams can highlight scales, arpeggios or
more generic intervals on the guitar neck.
It comes with batteries included to allow you to:
\begin{itemize}
\item Create scale diagrams in any tonality for any strung instruments
(including guitar, bass, ukulele) in both right and left handed
configuration.
\item Transpose notes or scales.
\item Create diagrams in alternate tuning.
\item Create generic diagrams with normal, shaded and highlighted notes.
\item and more.
\end{itemize}
As an example here is the Major scale in key of \pC:
\begin{tcblisting}{doc-code,text above listing}
\begin{fretboard}[frets before = 2, frets after = 2,
title = {Major scale (1, 2, 3, 4, 5, 6, 7)},
scale=0.35, fret numbers]
\foreach \i in {1, 2, 3, 4, 5, 6, 7} {
\FBnote[split]{\i}
}
\end{fretboard}
\end{tcblisting}
The major scale consists of following intervals from the tonic (root) note:
perfect unison, major second, major third, perfect fourth, perfect fifth,
major sixth and major seventh. These intervals are represented as
\brackets{1, 2, 3, 4, 5, 6, 7}. Each interval has its own color for an
easier lookup and memorization.
The note names can be displayed instead of intervals. The \pF Major scale is
composed of \pF, \pG, \pA, \pBb, \pC, \pD and \pE. The \pF scale is the same
as \pC but raised up by 5 semitones. \pkg{guitar-fretboard} is able to
transpose and convert the pitch name accordingly. Please note that the pitch
transposition is semitone-based and intervals are not used in the
process. Hence note names may not be always accurate in terms of harmony.
\begin{tcblisting}{doc-code,text above listing}
\begin{fretboard}[frets before = 2, frets after = 2,
transpose = 5,
transpose pitch,
title = {\pF Major scale\\\Large (\pF, \pG, \pA, \pBb, \pC, \pD, \pE)},
scale=0.35,
fret numbers]
\foreach \i in { C, D, E, F, G, F, A, B} {
\FBnote[split]{\i}
}
\end{fretboard}
\end{tcblisting}
Chords can also be displayed. In that case you can easily see new \pC chord
shapes showing up. If you are playing in \pC Major, the scale can also be
displayed. This helps you to find new embellishments when soloing:
\begin{tcblisting}{doc-code,text above listing, center upper}
\begin{fretboard}[frets before = 2, frets after = 2,
title = {\pC Chord (and \pC major scale)},
scale = 0.35,
fret numbers]
\foreach \i in {C, E, G} {
\FBnote{\i}
}
\foreach \i in {D, F, A, B} {
\FBnote[shade]{\i}
}
\end{fretboard}
\end{tcblisting}
The \pC chord can also be displayed in a more classical way. Use the
\meta{chord} option for that in addition with the \meta{limit} option which
helps to only show the \pG on the \nth{3} string.
\begin{tcblisting}{doc-code,text above listing}
\begin{fretboard}[frets min = 0, frets max = 3, fret numbers,
title = {\pC}, chord, scale=0.35]
\FBnote{C} \FBnote{E} \FBnote[limit={3}]{G}
\end{fretboard}
\end{tcblisting}
How this \pC chord looks like when the guitar is open \pG tuned? Again
\pkg{guitar-fretboard} does all the magic for you as long as you ask nicely.
\begin{tcblisting}{doc-code,text above listing}
\begin{fretboard}[frets min = 0, frets max = 3,
chord, tuning = \FBtuning{guitar/open g},
title = {\pC Chord (open \pG)},
fret numbers, scale=0.35]
\FBnote{C} \FBnote[limit={1,4}]{E} \FBnote{G}
\end{fretboard}
\end{tcblisting}
As you can see, setting the \meta{tuning} option updates the whole
fretboard. This is very easy to create some new diagrams in different
tunings.
Now let's figure out how a left-handed guitarist can practice the \pC\unskip{}M7
arpeggio (and the whole major scale) in open \pG tuning:
\begin{tcblisting}{doc-code,text above listing}
\begin{fretboard}[frets before = 2, frets after = 2,
tuning = \FBtuning{guitar/open g}, left handed,
title = {\pC\unskip{}M7 arpeggio in open \pG tuning},
fret numbers, scale=0.35]
\foreach \i in {C, E, G, B} {
\FBnote{\i}
}
\foreach \i in {D, F, A} {
\FBnote[shade]{\i}
}
\end{fretboard}
\end{tcblisting}
If you want to display a scale mode you can also emphasis the characteristic
note (the note that colors the mode, you want to play this particular
note). Here is an example with a generic Phrygian mode:
\begin{tcblisting}{doc-code,text above listing}
\begin{fretboard}[frets min=2, frets max=6,
transpose = -5,
title = {Phrygian scale}, scale=0.35]
\foreach \i in {1,b2, 3, 4, 5,b6,b7} {
\FBnote{\i}
}
\FBnote[highlight]{b2}
\FBnote[highlight, shade, limit={1}]{b2}
\end{fretboard}
\end{tcblisting}
\fi
\section{Definitions}
Under the hood all computations are semitones-based (from 0 to 11), relative
to \pC. In the annexes you can find all pitches (notes), intervals, tunings,
and colors defined in \pkg{guitar-fretboard}.
\subsection{Styles}
Several global \TikZ styles are defined and can be overridden if they
don't fit your needs. All their default values are not listed here, please
have a look to the \pkg{guitar-fretboard} definition file if you are curious
about it.
The main point is that you can override them globally using the \cs{tikzset}
command or just when you need in the \refEnv{fretboard} environment or when using
the \refCom{FBnote} command.
\begin{docKey}[tikz][]{fretboard}{=\meta{style}}{}
Style passed to the \TikZ picture. From here you can change the
background color and many other things supported by the \pkg{tikzpicture}
environment.
Both \meta{xscale} and \meta{yscale} are set here for an optimal render in
scale, chord and lefty modes. Don't change them unless you really known
what you are doing. By default the \pkg{x} size is twice the \pkg{y} size
in scale mode. In chord mode, the \pkg{x} \pkg{y} ratio is 1.2.
\end{docKey}
\begin{docKey}[tikz][]{fret}{=\meta{style}}{}
Style used to draw the frets. You can change it if you want colored frets
or larger lines for the frets.
\end{docKey}
\begin{docKey}[tikz][]{fret numbers}{=\meta{style}}{}
Style is used for the fret numbering. By default the font is given by
the \cs{fretfont} command.
\end{docKey}
\begin{docKey}[tikz][]{fret numbers position}{=\meta{style}}{\texttt{\{ shift = \{(0, 0.75)\}\}}}
Style used as a \TikZ scope to shift the fret numbers. The default
value should fit all cases. If you want to place the fret numbers
somewhere else, you can use this option but you might need to try several
values.
Be careful with shift values since they are cumulative. Thus use
$(0,~-0.75)$ to reset the position.
\end{docKey}
\begin{docKey}[tikz][]{string tuning}{=\meta{style}}{}
Style used for the string labeling. By default the font is given by the
\cs{stringfont} command.
\end{docKey}
\begin{docKey}[tikz][]{string tuning position}{=\meta{style}}{\texttt{\{ shift = \{(-0.75, 1)\}\}}}
Same as \refKey{/tikz/fret numbers position} but for the string labels.
\end{docKey}
\begin{docKey}[tikz][]{string}{=\meta{style}}{}
Identical to \refKey{/tikz/fret} but for the strings. You can control
everything but the string width which is overridden by both
\refKey{/fb/string width} and \refKey{/fb/string factor}.
\end{docKey}
\begin{docKey}[tikz][]{overlay}{=\meta{style}}{}
Style used to fade out the \refKey{/fb/frets before} and
\refKey{/fb/frets after} to help focus on the main part of the neck.
\end{docKey}
\begin{docKey}[tikz][]{title}{=\meta{style}}{}
Style used for the diagram title. By default the font is given by the
\cs{labelfont} command.
\end{docKey}
\begin{docKey}[tikz][]{title position}{=\meta{style}}{\texttt{\{ shift = \{(0, -0.75)\}\}}}
Identical to \refKey{/tikz/fret numbers position} but for the diagram
title.
Be careful when you change it because in chord mode, $(-0.75,~0.75)$ is
added to this value. Again you may need to experiment several values if
you really want to customize the label position..
\end{docKey}
\begin{docKey}[tikz][]{note}{=\meta{style}}{}
Style used for drawing a note on the fretboard. By default the
\cs{notefont} is used.
\end{docKey}
\begin{docKey}[tikz][]{note split}{=\meta{style}}{}
Style is used for drawing a split note on the fretboard. Used in
addition of \refKey{/tikz/note} to draw a circle split and reduce the font
size.
\end{docKey}
\begin{docKey}[tikz][]{note shade}{=\meta{style}}{}
Style used for shading a non important note on the fretboard. Used in
addition of \refKey{/tikz/note} to add an overlay to the note.
\end{docKey}
\begin{docKey}[tikz][]{note highlight}{=\meta{style}}{}
Style used for highlighting an important note on the fretboard. Used in
addition of \refKey{/tikz/note} to mark to the note.
\end{docKey}
\subsection{Fretboard}
\begin{docEnvironment}{fretboard}{\oarg{options}}
This is the main part of the \pkg{guitar-fretboard} engine which is
responsible for drawing the frets, the strings, the labels and putting
everything together.
You can control the default settings by defining several options all
relative to the \docAuxKey*{/fb} path.
\begin{docKey}[fb][]{tuning}{=\meta{tuning}}{\texttt{\{\FBtuning{guitar/standard}\}}}
The instrument tuning. You can select a pre-defined tuning with the
\refCom{FBtuning} command or provide your own. Each string is identified by
a semitone value (relative to \pC). The strings order is from low to
high.
\end{docKey}
\begin{docKey}[fb][]{frets min}{=\meta{number}}{0}
The value of the lowest fret on the main fretboard section.
\end{docKey}
\begin{docKey}[fb][]{frets max}{=\meta{number}}{12}
The value of the highest fret on the main fretboard section.
\end{docKey}
\begin{docKey}[fb][]{frets before}{=\meta{number}}{0}
Number of frets to extend the fretboard before the main part. This area
will be shaded.
\end{docKey}
\begin{docKey}[fb][]{frets after}{=\meta{number}}{0}
Number of frets to extend the fretboard after the main part. This area
will be shaded.
\end{docKey}
\begin{docKey}[fb][]{frets offset}{=\meta{distance}}{0.5}
By default the frets are shifted from the grid for an easier note
placement. Do not change this value or your fretboard will be mangled.
\end{docKey}
\begin{docKey}[fb][]{frets numbers}{=\meta{boolean}}{false}
Set to true to show the fret numbers.
\end{docKey}
\begin{docKey}[fb][]{string width}{=\meta{width}}{0.5pt}
The width of the higher string.
\end{docKey}
\begin{docKey}[fb][]{string factor}{=\meta{width}}{0.75pt}
The string width growing factor when drawing frets from highest to
lower.
\end{docKey}
\begin{docKey}[fb][]{show tuning}{=\meta{boolean}}{true}
Set to false to hide the string labels at the top of the neck.
\end{docKey}
\begin{docKey}[fb][]{split}{=\meta{boolean}}{false}
Set to false to show 2 labels in the notes when applicable (only when
\refKey{/fb/notes/NOTE/reversed} is set). If note is a pitch both flat
and sharp pitch are shown such as \pEb and \pFS. In the case of an
interval, the reversed interval is shown.
\end{docKey}
\begin{docKey}[fb][]{title}{=\meta{text}}{}
If not blank, the \meta{text} content is used for the diagram title.
\end{docKey}
\begin{docKey}[fb][]{transpose}{=\meta{semitone}}{0}
Number of semitone to use when transposing the whole fretboard
diagram. If your diagram is the \pC major scale and you want to show the
\pF major scale, you will need to change all the notes you
entered. Using the transposing option, \pkg{guitar-fretboard} will do
the job for you by setting a 5-semitone transposition.
\end{docKey}
\begin{docKey}[fb][]{transpose pitch}{=\meta{boolean}}{false}
When transposing a pitched diagram you may want to display the correct
note name on their frets. So you need to transpose pitches or let
\pkg{guitar-fretboard} do the job for you. Be careful when you use
pitches because the resulting names may be wrong (at least not correct
in terms of harmony).
\end{docKey}
\begin{docKey}[fb][]{chord}{=\meta{boolean}}{false}
Displays the diagram in chord mode (rotate the whole diagram by
90\textsuperscript{o} counter-clockwise and change the fret \texttt{x}
\texttt{y} ratio.
\end{docKey}
\begin{docKey}[fb][]{scale}{=\meta{ratio}}{1}
Scale ratio used to resize the whole diagram. Use this option if your
diagram does not fit in your document.
\end{docKey}
\begin{docKey}[fb][]{left handed}{=\meta{boolean}}{false}
Displays the diagram for left-handed musicians.
\end{docKey}
\end{docEnvironment}
\subsection{Useful commands}
\begin{docCommand}{FBnote}{\oarg{options}\marg{id}}
Places the note referenced by \marg{id} on the current fretboard. This
command only makes sense in the \refEnv{fretboard} environment.
You can override any parameter set in the \refCom{FBnewNote} command or
any \docAuxKey{/tikz} style since \oarg{options} is processed by
\cs{tikzset}.
\end{docCommand}
\begin{docCommand}{FBnoteAt}{\oarg{options}\marg{id}\marg{string}\marg{fret}}
Similar to \refCom{FBnote} but place note \meta{id} at \meta{string}
on \meta{fret}.
\end{docCommand}
\begin{docCommand}{FBtuning}{\marg{id}}
Retrieves the tuning referenced by \marg{id} under the
\docAuxKey*{/fb/tunings} path. See annexes for all pre-defined tunings.
\end{docCommand}
\subsection{Other commands}
From here are some commands you don't need for you daily usage except if you
want to define your own notes.
\begin{tcolorbox}[warning]
Warning internal nomenclature is subject to change. Don't use command from
here unless you really know what you are doing.
\end{tcolorbox}
\begin{docCommand}{FBnewNote}{\oarg{options}\marg{id}}
Creates a new note identified by \meta{id}. It should respect the
\pkg{pgfkeys} key syntax. It's better to only use alphanumerical
characters. By an arbitrary convention, flats are replaced by \texttt{b}
and sharps by \texttt{S}. Thus a \pCS is referenced as \texttt{CS} and
\pDb by \texttt{Db}. See the annexes for all defined pitches and
intervals.
The newly created note is placed under the \docAuxKey*{/fb/notes/NOTE} key
path. In addition you can add some \oarg{options} to the new note.
From here a pitch or an interval is referenced as a note.
\begin{docKey}[fb/notes/NOTE][]{name}{=\meta{name}}{}
The full textual name of the note that can be used for specific usage.
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{degree}{=\meta{degree}}{}
The note degree in the \pC major scale reference (1 or \pC, 2 for \pD, 3
for \pE, etc). the degree does not care about semitones, just about the
note base name.
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{tex}{=\meta{tex}}{}
\unstable
The note representation in a musical environment. This key is used by
the \cs{pX} command where \texttt{X} is the note \meta{id}. See the
annexes for further details.
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{tex small}{=\meta{tex}}{}
\unstable
Identical to \refKey{/fb/notes/NOTE/tex} but used for fretboard limited
space. Flats and sharps are smaller (\FBgetNote{CS}{tex}{} and
\FBgetNote{CS}{tex small}).
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{semitones}{=\meta{number}}{0}
Semitone distance from the \pC note. This is used to determine the
note's place on the fretboard.
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{reversed}{=\meta{note ref}}{}
\unstable
The reference to the reversed interval \meta{id} or equivalent note
name.
\end{docKey}
From this point all other options are only useful when placing a note on
the fretboard using the \refCom{FBnote} command to override default
behaviors.
\begin{docKey}[fb/notes/NOTE][]{limit}{=\meta{list of strings}}{}
A list of strings (order does not matter) to limit the note placement on
the fretboard. For example if you only want to place the note on both
\nth{5} and \nth{2} string, use \brackets{2,5} (or \brackets{5,2}).
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{style}{=\meta{style}}{}
A complement style definition to \refKey{/tikz/note}.
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{highlight style}{=\meta{style}}{}
A complement style definition to \refKey{/tikz/note highlight}.
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{split}{=\meta{boolean}}{false}
Split that specific note if set to true.
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{shade}{=\meta{boolean}}{false}
Shade that specific note if set to true.
\end{docKey}
\begin{docKey}[fb/notes/NOTE][]{highlight}{=\meta{boolean}}{false}
Highlight that specific note if set to true.
\end{docKey}
\end{docCommand}
\begin{docCommand}{FBcopyNote}{\oarg{options}\marg{src}\marg{to}}
Copies the note \meta{src} to \meta{to} and override parameters given in
\meta{options}. See \refCom{FBnewNote}.
\end{docCommand}
\begin{docCommand}{FBgetNote}{\marg{id}\marg{key}}
Retrieves the \meta{key} value of the note \meta{id}.
\end{docCommand}
\subsection{Colors}
Colors are predefined (see annexes for the full list).
\begin{docCommand}{FBnewColor}{\oarg{options}\marg{name}\marg{spec}}
Creates a new color \meta{name} using \meta{spec} specifications which are
the same as the \pkg{xcolor} package. This command creates 2 colors, one
for the background using \meta{spec} and one for the foreground which can
be either black or white depending on the background color. The
computation is based on the luminance\footnote{See
\url{https://en.wikipedia.org/wiki/HSL_and_HSV\#Lightness}} value.
You want to use either HTML or CMYK color definition. In case of HTML the
color \meta{spec} is \brackets{RRGGBB} which is the hexadecimal color
composition. If you choose CMYK the definition is \brackets{C, M, Y, K}
for cyan, magenta, yellow and black with a 0 to 1 valid range.
Some options can be passed to to \cs{FBnewColor} command:
\begin{docKey}[fb/colors][]{limit}{=\meta{limit}}{0.5}
The luminance limit. If the background color's luminance if greater than
\meta{limit}, the foreground color is set to black, white otherwise.
You shouldn't change it unless you experiment some strange behaviors.
\end{docKey}
\begin{docKey}[fb/colors][]{model}{=\meta{model}}{HTML}
The color model to use. See the \pkg{xcolor} documentation for further
information.
\end{docKey}
\begin{docKey}[fb/colors][]{derive}{=\meta{boolean}}{false}
If true, the new color is based on an existing color passed in the
\meta{spec} argument. Otherwise, a new color is created.
\end{docKey}
\end{docCommand}
\section{Tips}
Inserting a lot of diagrams in a document can take long time to build since
\TikZ is not very fast. If your diagrams do not change very often, you
can generate a standalone PDF and include it in your document.
A very simple example can be:
\begin{example}
% chords/c-major.tex
\documentclass[]{standalone}
\usepackage{guitar-fretboard}
\begin{document}
\begin{fretboard}[frets min=0, frets max=4, fret numbers,
left handed, title = {\pC}]%
\FBnote{C} \FBnote{E} \FBnote{G}
\end{fretboard}%
\end{document}
\end{example}
Now you can add the generated PDF using:
\begin{example}
\includegraphics[width=0.7\textwidth,keepaspectratio]{chords/c-major.pdf}
\end{example}
\ifannexes
\section{Annexes}
\subsection{pitches}
All semitones are relative to \pC.
\begin{small}
\centering
\begin{longtable}{l|c|c|c|c|c|l}
id & degree & semitones & tex & tex small & reversed & command \\
\hline
\endhead
\mypitchline{Cbbb}
\mypitchline{Cbb}
\mypitchline{Cb}
\mypitchline{C}
\mypitchline{CS}
\mypitchline{CSS}
\mypitchline{CSSS}
\hline
\mypitchline{Dbbb}
\mypitchline{Dbb}
\mypitchline{Db}
\mypitchline{D}
\mypitchline{DS}
\mypitchline{DSS}
\mypitchline{DSSS}
\hline
\mypitchline{Ebbb}
\mypitchline{Ebb}
\mypitchline{Eb}
\mypitchline{E}
\mypitchline{ES}
\mypitchline{ESS}
\mypitchline{ESSS}
\hline
\mypitchline{Fbbb}
\mypitchline{Fbb}
\mypitchline{Fb}
\mypitchline{F}
\mypitchline{FS}
\mypitchline{FSS}
\mypitchline{FSSS}
\hline
\mypitchline{Gbbb}
\mypitchline{Gbb}
\mypitchline{Gb}
\mypitchline{G}
\mypitchline{GS}
\mypitchline{GSS}
\mypitchline{GSSS}
\hline
\mypitchline{Abbb}
\mypitchline{Abb}
\mypitchline{Ab}
\mypitchline{A}
\mypitchline{AS}
\mypitchline{ASS}
\mypitchline{ASSS}
\hline
\mypitchline{Bbbb}
\mypitchline{Bbb}
\mypitchline{Bb}
\mypitchline{B}
\mypitchline{BS}
\mypitchline{BSS}
\mypitchline{BSSS}
\hline
\end{longtable}
\end{small}
\subsection{Intervals}
\begin{small}
\centering
\begin{longtable}{l|c|c|l|c|c|c}
id & degree & semitones & name & tex & tex small & reversed\\
\hline
\endhead
\myintervalline{d1}
\myintervalline{b1}
\myintervalline {1}
\myintervalline{A1}
\myintervalline{S1}
\hline
\myintervalline{bb2}
\myintervalline {d2}
\myintervalline {b2}
\myintervalline {m2}
\myintervalline {2}
\myintervalline {A2}
\myintervalline {S2}
\hline
\myintervalline{bb3}
\myintervalline {d3}
\myintervalline {b3}
\myintervalline {m3}
\myintervalline {3}
\myintervalline {A3}
\myintervalline {S3}
\hline
\myintervalline{d4}
\myintervalline{b4}
\myintervalline {4}
\myintervalline{A4}
\myintervalline{S4}
\hline
\myintervalline{d5}
\myintervalline{b5}
\myintervalline {5}
\myintervalline{A5}
\myintervalline{S5}
\hline
\myintervalline {d6}
\myintervalline{bb6}
\myintervalline {m6}
\myintervalline {b6}
\myintervalline {6}
\myintervalline {A6}
\myintervalline {S6}
\hline
\myintervalline {d7}
\myintervalline{bb7}
\myintervalline {m7}
\myintervalline {b7}
\myintervalline {7}
\myintervalline {A7}
\myintervalline {S7}
\hline
\myintervalline{d8}
\myintervalline{b8}
\myintervalline {8}
\myintervalline{A8}
\myintervalline{S8}
\hline
\myintervalline{d9}
\myintervalline{bb9}
\myintervalline{m9}
\myintervalline{b9}
\myintervalline {9}
\myintervalline{A9}
\myintervalline{S9}
\hline
\myintervalline{d11}
\myintervalline{b11}
\myintervalline {11}
\myintervalline{A11}
\myintervalline{S11}
\hline
\myintervalline {d13}
\myintervalline{bb13}
\myintervalline {m13}
\myintervalline {b13}
\myintervalline {13}
\myintervalline {A13}
\myintervalline {S13}
\hline
\end{longtable}
\end{small}
\subsection{Chords}
%% \begin{small}
%% \centering
\begin{longtable}{l|l|l|l|l}
id & name & tex & tex fs & interval \\
\hline
\mychordline {M}
\mychordline {m}
\mychordline {5}
\mychordline {b5}
\mychordline {S5}
\mychordline {sus2}
\mychordline {sus4}
\mychordline {aug}
\mychordline {dim}
\mychordline {7}
\mychordline {M7}
\mychordline {m7}
\mychordline {7sus4}
\mychordline {m7maj}
\mychordline {7majS5}
\mychordline {7S5}
\mychordline {7b5}
\mychordline {m7b5}
\mychordline {dim7}
\mychordline {6}
\mychordline {m6}
\mychordline {add9}
\mychordline {6add9}
\mychordline {maj9}
\mychordline {maj7S11}
\mychordline {maj13}
\end{longtable}
%% \end{small}
\subsection{Tunings}
%% \begin{small}
%% \centering
\begin{longtable}{l|l|l}
id & Notes & semitones from \pC \\
\hline
\mytuningline {guitar/standard}
\mytuningline {guitar/dadgad}
\mytuningline {guitar/drop d}
\mytuningline {guitar/double drop d}
\mytuningline {guitar/open g}
\mytuningline {guitar/7 string}
\hline
\mytuningline {bass/standard}
\mytuningline {bass/5 string}
\mytuningline {bass/5 string tenor}
\mytuningline {bass/6 string}
\hline
\mytuningline {ukulele/standard}
\end{longtable}
\subsection{Colors}
\begin{small}
\centering
\begin{longtable}{l|c|c}
id & RGB name & CMYK name \\
\hline
\mycolorline{1bb}
\mycolorline{1b}
\mycolorline{1}
\mycolorline{1s}
\mycolorline{1ss}
\hline
\mycolorline{2bb}
\mycolorline{2b}
\mycolorline{2}
\mycolorline{2s}
\mycolorline{2ss}
\hline
\mycolorline{3bb}
\mycolorline{3b}
\mycolorline{3}
\mycolorline{3s}
\mycolorline{3ss}
\hline
\mycolorline{4bb}
\mycolorline{4b}
\mycolorline{4}
\mycolorline{4s}
\mycolorline{4ss}
\hline
\mycolorline{5bb}
\mycolorline{5b}
\mycolorline{5}
\mycolorline{5s}
\mycolorline{5ss}
\hline
\mycolorline{6bb}
\mycolorline{6b}
\mycolorline{6}
\mycolorline{6s}
\mycolorline{6ss}
\hline
\mycolorline{7bb}
\mycolorline{7b}
\mycolorline{7}
\mycolorline{7s}
\mycolorline{7ss}
\hline