-
I wanted to know wether if this package has the capability of playing a MIDI sequence? func playMidiFile(at url: URL?) {
guard let midiURL = url else { return }
do {
// Create an AVMIDIPlayer instance with the specified URL
player = try AVMIDIPlayer(contentsOf: midiURL, soundBankURL: nil)
player.prepareToPlay()
player.play() {
}
} catch {
print("Failed to play MIDI file: \n\(error)")
}
}
func stopPlayback() {
player.stop()
}
var currentPosition: TimeInterval? {
get { player.currentPosition }
set { player.currentPosition = newValue! }
}
var duration: TimeInterval? {
player.duration
} This is just a sample code of what I'm trying to achieve, but unfortunately there are some strange troubles accessing properties & methods other than the
using MIDIKit modules. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
MIDIKit doesn't offer any playback/sequencer abstractions (yet). The goal is to build a generalized module before the 1.0.0 release that simply provides an event callback with start and stop functions. It would not produce audio or embed any MIDI synthesis of any kind, as MIDIKit deals strictly in MIDI event types and I/O and not audio. The added MIDI synthesis portion could be added in an example project at some point once the base sequencer is built, or better yet it could be done in another package such as AudioKit. AudioKit V6 (in development) has adopted MIDIKit and it has playback/sequencer features. However if I recall it's still being actively developed but will be in before release. One of the reasons AudioKit does not have fully fledged MIDI playback currently is that AudioKit used to rely on AVFoundation which has been the source of a lot of issues. But V6 is factoring it out almost entirely which means a lot of the convenience classes that were provided by Apple in AVFoundation need to be rewritten by hand which takes time. |
Beta Was this translation helpful? Give feedback.
MIDIKit doesn't offer any playback/sequencer abstractions (yet). The goal is to build a generalized module before the 1.0.0 release that simply provides an event callback with start and stop functions. It would not produce audio or embed any MIDI synthesis of any kind, as MIDIKit deals strictly in MIDI event types and I/O and not audio. The added MIDI synthesis portion could be added in an example project at some point once the base sequencer is built, or better yet it could be done in another package such as AudioKit.
AudioKit V6 (in development) has adopted MIDIKit and it has playback/sequencer features. However if I recall it's still being actively developed but will be in before release.