ChordDefinition

struct ChordDefinition: Equatable, Codable, Identifiable, Hashable, Sendable

The structure of a chord definition

Database items

Other items

Coding keys

  • The coding keys

    Note

    Only those items will be in the database
    See more

    Declaration

    Swift

    enum CodingKeys: CodingKey
  • Custom encoder for the ChordDefinition

    Declaration

    Swift

    func encode(to encoder: Encoder) throws
  • Get the name of the chord for internal use

    Declaration

    Swift

    var getName: String

    Return Value

    A string with the name of the chord

  • Format the name of the chord for display

    Declaration

    Swift

    var display: String

    Return Value

    A formatted string with the name of the chord

  • Format the name of the chord with a flat version for display

    Declaration

    Swift

    var displayFlatForSharp: String

    Return Value

    A formatted string with the flat name of the chord

  • Try to validate a ChordDefinition

    Declaration

    Swift

    var validate: Chord.Status
  • Convert a ChordDefinition into a ChordPro {define}

    Declaration

    Swift

    var define: String
  • Play a ChordDefinition with MIDI

    Declaration

    Swift

    func play(instrument: Midi.Instrument = .acousticNylonGuitar)

    Parameters

    instrument

    The instrument to use

  • Mirror a Barre for a left-handed chord

    Declaration

    Swift

    func mirrorBarre(_ barre: Chord.Barre) -> Chord.Barre

    Parameters

    barre

    The original barre

    Return Value

    The left-handed barre

Init from the decoder

Init with all known values

Init with a definition

Init with a name

Init with a ChordPro JSON chord

Init with an unknown name