Swiftpack.co -  gzqyl/R9MIDISequencer as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
play midi files
.package(url: "https://github.com/gzqyl/R9MIDISequencer.git", from: "2.0.1")


Platform support License MIT Carthage compatible CocoaPods Compatible

MIDI Sequencer for iOS on swift.



R9MIDISequencer now features a full MIDI Sequencer with EXS24 and SoundFont samplers which can be tied to your instruments for awesome, accurate playback.

Example Code

Play note using the sampler:

import R9MIDISequencer

let url = Bundle.main.url(forResource: “Sound Font File Name”,
        withExtension: "sf2",
        subdirectory: "Sounds")
let sampler = Sampler(bankURL: url!, program: 0, bankMSB: 0x79, bankLSB: 0, channelNumber: 1)

// Play the note C
// Play the note G

Play MIDI file using the Sequencer:

let sequencer = Sequencer(sampler: sampler, enableLooping: true)

let midiUrl = Bundle.main.url(forResource: “MIDI File",
        withExtension: "mid")

Callback from MIDI message

class GameScene: SKScene, MIDIMessageListener {
    override func didMoveToView(view: SKView) {
        ...Initialize sampler
        let sequencer = Sequencer(sampler: sampler, enableLooping: true)
        ...Play MIDI
    func midiNoteOn(note: UInt32, velocity: UInt32, channel: UInt32) {
        // Call back of note on message.
    func midiNoteOff(note: UInt32, channel: UInt32) {
        // Call back of note off message.
    func midiSequenceDidFinish() {
        // Call back of finish MIDI sequence.



You can install R9MIDISequencer via CocoaPods by adding it to your Podfile:


source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

pod 'R9MIDISequencer'


You can install R9MIDISequencer via Carthage by adding the following line to your Cartfile:

github "glassonion1/R9MIDISequencer"

R9MIDISequencer is enabled the Bitcode.


Stars: 0
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Related Packages

Release Notes

2 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics