Fretboards.MAJOR_SCALE_SEMITONES
— ConstantMajor scale in semitones. Used internally, for pitch parsing.
Fretboards.PITCH_NAMES
— ConstantPitch names for printing.
We always print sharp notes, eg C♯
instead of D♭
.
Fretboards.STANDARD_TUNING
— ConstantStandard tuning for 6-string guitar.
Fretboards.Annotation
— MethodAnnotation(mark::AbstractString, [crayon])
A string annotation, with an optional color or style using Crayons.Crayon.
Fretboards.DrawingChars
— Typestruct DrawingChars
Characters for drawing a Fretboard
.
Fields
string_char
Strings between frets.
fret_char
Fret-string crossings.
nut_char
Nut (fret 0).
Fretboards.Fretboard
— MethodFretboard(tuning, frets)
Create a fretboard which can be annotated with strings, either by as an AbstractMatrix
, or using annotate_matches!
(recommended).
Fretboards.Pitch
— TypeA pitch (pitch). It is recommended that the pitch"..."
constructor is used, see parse_pitch
.
+
and -
with integers change the pitch by a given number of semitones.
Fretboards.:≂
— Method≂(pitch1, pitch2)
Test if two pitchs octave equivalent (ie are separated by an integer number of octaves), ie are in the same pitch class.
Fretboards._print_ascii_all_annotations
— Method_print_ascii_all_annotations(io, drawing_chars, fret_spacing, open_pitch, all_annotations)
Print ASCII for all annotations for a string.
Arguments
io
: outputdrawing_chars
: character set for drawingfret_spacing
: the number of characters between fretsopen_pitch
: pitch of the open string (fret 0)all_annotations
: a vector ofVector{Annotation}
s
Fretboards._print_ascii_fret_annotations
— Method_print_ascii_fret_annotations(io, string_char, fret_spacing, annotations)
Print ASCII for a single fret annotation, for the space between frets.
Arguments
io
: outputstring_char
: character for depicting strings, eg-
,fret_spacing
: the number of characters between fretsannotations
: a vector ofAnnotation
s
Fretboards._print_ascii_fret_numbers
— Method_print_ascii_fret_numbers(io, fret_spacing, frets)
Print fret numbers.
Arguments
io
: outputfret_spacing
: the number of characters between fretsfrets
: the number of frets
Fretboards._textwidth_ascii_fret_annotations
— Method_textwidth_ascii_fret_annotations(string_char, annotations)
Text width of all the annotations for a fret, with string_char
.
Fretboards.annotate_matches!
— Methodannotate_matches!(predicate, annotation, fretboard; kwargs...)
Shorthand for inserting the same annotation when predicate
returns true
. See the other method of annotate_matches!
for details.
Example
julia> using Fretboards, Fretboards.Intervals
julia> fb = Fretboard(STANDARD_TUNING, 7);
julia> let root = pitch"C"
for (mark, semitones) in [("1", 0), ("3", M3), ("5", P5)]
annotate_matches!(x -> x.pitch ≂ root + semitones, Annotation(mark), fb)
end
end
julia> fb
0 1 2 3 4 5 6 7
E4 3|------|------|-----5|------|------|------|------|
B3 |-----1|------|------|------|-----3|------|------|
G3 5|------|------|------|------|-----1|------|------|
D3 |------|-----3|------|------|-----5|------|------|
A2 |------|------|-----1|------|------|------|-----3|
E2 3|------|------|-----5|------|------|------|------|
Fretboards.annotate_matches!
— Methodannotate_matches!(f, fretboard; skip_duplicates)
For each fret on each string, call f
with a value that has the following properties:
string
: the string number, from highest pitch (1), eg6
forpitch"E2"
open_pitch
: the pitch of the open string (egpitch"E2"
)pitch
: pitch of the fret (eg `pitch"G2")fret
: fret number, eg3
.
f
should return an Annotation
or nothing
.
Fretboards.get_frets
— Methodget_frets(fretboard)
Return the number of frets.
Fretboards.get_tuning
— Methodget_tuning(fretboard)
Return the tuning.
Fretboards.parse_pitch
— Methodparse_pitch(str)
Parse a pitch in scientific pitch notation, composed of
an upper- or lowecase letter A-G for the pitch
an optional accidental
b
,#
(plain ascii), or♭
,♯
(Unicode accidentals),an optional octave number (
0
if omitted, can be negative)
Example arguments: "C#2", "D♭-2" `.
Fretboards.print_ascii
— Functionprint_ascii(io, fretboard)
print_ascii(io, fretboard, drawing_chars)
print_ascii(io, fretboard, drawing_chars, min_fret_spacing)
Print fretboard
with the specified drawing_chars
character set.
Fretboards.@pitch_str
— Macropitch"..."
Parse the argument string as a Pitch
, eg
julia> pitch"C♭2"
pitch"B1"
See parse_pitch
for a full description.