Utils
enum Utils
Chord utilities
-
Get index value of a note
Declaration
Swift
static func noteToValue(note: Chord.Root) -> Int
-
Calculate the chord components
Declaration
Swift
static func fretsToComponents( root: Chord.Root, frets: [Int], baseFret: Int, instrument: Instrument ) -> [Chord.Component]
-
Check if fingers should be barred
Declaration
Swift
static func fingersToBarres( frets: [Int], fingers: [Int], baseFret: Int ) -> [Chord.Barre]
Parameters
frets
The frest of the chord
fingers
The fingers of the chord
baseFret
The base fret of the chord
Return Value
An array with fingers that shoud be barred
-
Get all possible chord notes for a
ChordDefinition
Declaration
Swift
static func getChordComponents(chord: ChordDefinition, addBase: Bool = true) -> [[Chord.Root]]
Parameters
chord
The
ChordDefinition
addBase
Bool to add the optional bass to the notes
Return Value
An array with
Root
arrays -
Create a
ChordDefinition
struct from a string which defines a Chord with a ChordPro define directiveFor more information about the layout, have a look at https://www.chordpro.org/chordpro/directives-define/
Declaration
Swift
static func define(from define: String, instrument: Instrument) throws -> ChordDefinition
Parameters
define
ChordPro string definition of the chord
Return Value
A
ChordPostion
struct, if found, else an Error