Chord

struct Chord

Struct for a chord

  • The Music Sequence

    Declaration

    Swift

    var musicSequence: MusicSequence?
  • The tracks

    Declaration

    Swift

    var tracks: [Int : MusicTrack]
  • Init the chord

    Declaration

    Swift

    init()
  • Compose a chord

    Declaration

    Swift

    func compose(notes: [Int], instrument: Midi.Instrument) -> Chord

    Parameters

    notes

    The notes of the chord

    instrument

    The instrument to use

    Return Value

    A Chord

  • Add a track to the chord

    Declaration

    Swift

    mutating func addTrack(instrumentID: UInt8) -> Int

    Parameters

    instrumentID

    The ID of the MIDI instrument

    Return Value

    The track ID

  • Add a note to the track

    Declaration

    Swift

    func addNote(trackID: Int, note: UInt8, duration: Float, position: Float)

    Parameters

    trackID

    The ID of the track

    note

    The MIDI note

    duration

    The duration

    position

    The position in the track