Skip to content

Instantly share code, notes, and snippets.

@Pash237
Last active December 30, 2019 10:08
Show Gist options
  • Save Pash237/95d0c1d377f390a544eaab6686e0f712 to your computer and use it in GitHub Desktop.
Save Pash237/95d0c1d377f390a544eaab6686e0f712 to your computer and use it in GitHub Desktop.
Creating MIDI file with AudioKit's AKSequencer
let sequencer = AKSequencer()
let track = sequencer.newTrack()
sequencer.setLength(AKDuration(seconds: 2.0))
track?.add(noteNumber: MIDINoteNumber(60),
velocity: MIDIVelocity(100),
position: AKDuration(seconds: 1, tempo: 120),
duration: AKDuration(seconds: 0.5, tempo: 120))
try! sequencer.genData()!.write(to: url)
@kevinloustau
Copy link

Thank you Pash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment