MidiPlayer

actor MidiPlayer

Play a ChordDefinition with its MIDI values

  • Make it a shared actor

    Declaration

    Swift

    static let shared = MidiPlayer()
  • The MIDI player

    Declaration

    Swift

    var midiPlayer: AVMIDIPlayer?
  • The URL of the SoundBank

    Note

    A stripped version of the GeneralUser GS MuseScore bank

    Declaration

    Swift

    var bankURL: URL
  • Private init to make sure the actor is shared

    Declaration

    Swift

    private init()
  • Prepare a chord

    Declaration

    Swift

    func prepareChord(chord: Chord)

    Parameters

    chord

    The chord to play

  • Play a chord with its MIDI values

    Declaration

    Swift

    func playChord(notes: [Int], instrument: Midi.Instrument = .acousticNylonGuitar) async

    Parameters

    notes

    The notes to play

    instrument

    The Instrument to use

  • Struct for a chord

    See more

    Declaration

    Swift

    struct Chord