Utils
enum Utils
Chord utilities
-
Get index value of a note
Declaration
Swift
static func noteToValue(note: Chord.Root) -> Int -
Return note by index in a scale
-
Transpose the chord
Declaration
Parameters
transposeTranspose key
noteThe root note
scaleKey scale
-
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] ) -> [Chord.Barre]Parameters
fretsThe frets of the chord
fingersThe fingers of the chord
Return Value
An array with fingers that should be barred
-
Get all possible chord notes for a
ChordDefinitionDeclaration
Swift
static func getChordComponents(chord: ChordDefinition, addBase: Bool = true) -> [[Chord.Root]]Parameters
chordThe
ChordDefinitionaddBaseBool to add the optional bass to the notes
Return Value
An array with
Rootarrays -
Create a
ChordDefinitionstruct 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 -> ChordDefinitionParameters
defineChordPro string definition of the chord
instrumentThe
Instrumentto useReturn Value
A
ChordDefinitionstruct, if found, else an Error -
Create a
ChordDefinitionstructure from a ChordPro JSON chordFor more information about the layout, have a look at https://www.chordpro.org/chordpro/directives-define/
Declaration
Swift
static func define(from chord: ChordPro.Instrument.Chord, instrument: Instrument) throws -> ChordDefinitionParameters
chordA ChordPro JSON chord
instrumentThe
Instrumentto useReturn Value
A
ChordDefinitionstruct, if found, else an Error
View on GitHub