Swiftpack.co - glassonion1/R9MIDISequencer as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by glassonion1.
glassonion1/R9MIDISequencer v1.5.7
MidiSequencer for iOS on swift
⭐️ 31
🕓 2 years ago
.package(url: "https://github.com/glassonion1/R9MIDISequencer.git", from: "v1.5.7")


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.


Swift Package Manager

Create a Package.swift file.

import PackageDescription

let package = Package(
  name: "RxTestProject",
  dependencies: [
    .package(url: "https://github.com/glassonion1/R9MIDISequencer.git", from: "1.5.1")
  targets: [
    .target(name: "RxTestProject", dependencies: ["R9MIDISequencer"])


R9MIDISequencer is available under the MIT license. See the LICENSE file for more info.


Stars: 31
Last commit: 2 years ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Related Packages

Release Notes

Fix bug of loop playing on Sequencer
2 years ago

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