Latest 0.0.3
Homepage https://github.com/cemolcay/MIDISequencer
License MIT
Platforms ios 9.0, osx 10.11, requires ARC
Dependencies AudioKit, MusicTheorySwift
Authors

MIDI Sequencer that sends MIDI events to other apps.
Built top on AKSequencer of AudioKit for iOS and macOS.
Create smart MIDI sequencer instruments with just focus on notes.

Requirements

  • Swift 3.0+
  • iOS 9.0+
  • macOS 10.11+

Install

pod 'MIDISequencer'

Usage

MIDISequencer built top on AudioKit‘s AKSequencer with MusicTheory library to create sequences just focusing on notes with multiple track support.

  • Create a MIDISequencer instance.
let sequencer = MIDISequencer(name: "Awesome Sequencer")
  • Create a MIDISequencerTrack and add it to sequencer’s tracks.
let track = MIDISequencerTrack(
    name: "Track 1", 
    midiChannel: 1)
sequencer.tracks.append(track)
  • Set tempo and time signature
sequencer.tempo = Tempo(
  timeSignature: TimeSignature(
    beats: 4,
    noteValue: .quarter),
  bpm: 80)
  • Add some MIDISequencerSteps to track’s steps
track.steps = [
    MIDISequencerStep(
      note: Note(type: .c, octave: 4),
      noteValue: NoteValue(type: .quarter),
      velocity: .standard(100)),
    MIDISequencerStep(
      note: Note(type: .d, octave: 4),
      noteValue: NoteValue(type: .quarter),
      velocity: .standard(100)),
    MIDISequencerStep(
      note: Note(type: .e, octave: 4),
      noteValue: NoteValue(type: .quarter),
      velocity: .standard(100)),
    MIDISequencerStep(
      note: Note(type: .f, octave: 4),
      noteValue: NoteValue(type: .quarter),
      velocity: .standard(100)),
    ]
sequencer.addTrack(track: track1)
  • You can even add chords or multiple notes or even both to any step.
MIDISequencerStep(
  chord: Chord(type: .maj, key: .c),
  octave: 4,
  noteValue: NoteValue(type: .quarter),
  velocity: .standard(60))

MIDISequencerStep(
  notes: [Note(type: .c, octave: 4), Note(type: .d, octave: 4)],
  octave: 4,
  noteValue: NoteValue(type: .quarter),
  velocity: .standard(60))

MIDISequencerStep(
  notes: Chord(type: .maj, key: .c).notes(octave: 4) + [Note(type: .c, octave: 4), Note(type: .d, octave: 4)],
  noteValue: NoteValue(type: .quarter),
  velocity: .standard(60))
  • Create arpeggiated steps with any notes from chords, scales in any octave range with MIDISequencerArpeggiator.
let arpeggiator = MIDISequencerArpeggiator(
  scale: Scale(type: .blues, key: .a),
  arpeggio: .random,
  octaves: [4, 5])

let melody = MIDISequencerTrack(
  name: "Melody",
  midiChannel: 3,
  steps: arpeggiator.steps(noteValue: NoteValue(type: .quarter), velocity: .random(min: 80, max: 120)))

sequencer.addTrack(track: melody)
  • Set isMuted property to true to mute any MIDISequencerStep.

  • Call one of play() or playAsync() functions to play sequance.
state = .loading
sequancer.playAsync(completion: {
    self.state = .playing
})
  • Call stop() to stop playing.
sequencer.stop()

Documentation

See full documentation

AppStore

This library used in my app ChordBud, check it out!

alt tag

Latest podspec

{
    "name": "MIDISequencer",
    "version": "0.0.3",
    "summary": "MIDI Sequencer that sends MIDI events to other apps.",
    "description": "MIDISequencern===nnMIDI Sequencer that sends MIDI events to other apps.nBuilt top on AKSequencer of AudioKit for iOS and macOS.nCreate smart MIDI sequencer instruments with just focus on notes.nnRequirementsn----nn- Swift 3.0+n- iOS 9.0+n- macOS 10.11+nnInstalln----nn``` rubynpod 'MIDISequencer'n```nnUsagen----nnMIDISequencer built top on `AudioKit`'s `AKSequencer` with [`MusicTheory`](https://github.com/cemolcay/MusicTheory) library to create sequences just focusing on notes with multiple track support.nn- Create a `MIDISequencer` instance.nn``` swiftnlet sequencer = MIDISequencer(name: "Awesome Sequencer")n```nn- Create a `MIDISequencerTrack` and add it to sequencer's tracks.nn``` swiftnlet track = MIDISequencerTrack(nname: "Track 1",nmidiChannel: 1)n```nn- Add some `MIDISequencerStep`s to track's `steps`nn``` swiftntrack.steps = [nMIDISequencerStep(nnote: Note(type: .c, octave: 4),nnoteValue: NoteValue(type: .quarter),nvelocity: .standard(100)),nMIDISequencerStep(nnote: Note(type: .d, octave: 4),nnoteValue: NoteValue(type: .quarter),nvelocity: .standard(100)),nMIDISequencerStep(nnote: Note(type: .e, octave: 4),nnoteValue: NoteValue(type: .quarter),nvelocity: .standard(100)),nMIDISequencerStep(nnote: Note(type: .f, octave: 4),nnoteValue: NoteValue(type: .quarter),nvelocity: .standard(100)),n]n```nn- You can even add chords or multiple notes or even both to any step.nn```nMIDISequencerStep(nchord: Chord(type: .maj, key: .c),noctave: 4,nnoteValue: NoteValue(type: .quarter),nvelocity: .standard(60))nnMIDISequencerStep(nnotes: [Note(type: .c, octave: 4), Note(type: .d, octave: 4)],noctave: 4,nnoteValue: NoteValue(type: .quarter),nvelocity: .standard(60))nnMIDISequencerStep(nnotes: Chord(type: .maj, key: .c).notes(octave: 4) + [Note(type: .c, octave: 4), Note(type: .d, octave: 4)],nnoteValue: NoteValue(type: .quarter),nvelocity: .standard(60))n```nn- Set `isMuted` property to `true` to mute any `MIDISequencerStep`.",
    "homepage": "https://github.com/cemolcay/MIDISequencer",
    "license": "MIT",
    "authors": {
        "cemolcay": "[email protected]"
    },
    "platforms": {
        "ios": "9.0",
        "osx": "10.11"
    },
    "source": {
        "git": "https://github.com/cemolcay/MIDISequencer.git",
        "tag": "0.0.3"
    },
    "source_files": "Source/*.swift",
    "requires_arc": true,
    "dependencies": {
        "AudioKit": [],
        "MusicTheorySwift": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This