Monthly Archives: September 2014

Swift and AVMIDIPlayer

Swift Language

Swift and AVMIDIPlayer How to play MIDI data via the AVFoundation AVMIDIPlayer. Introduction Playing a MIDI File Playing NSData Playing a MusicSequence Update: Swift 2 Summary Resources Introduction Previously, I wrote about attaching a low level core audio AUGraph to a MusicSequence to hear something besides sine waves when played via a MusicPlayer. Here, I’ll […]

Posted in Computer Music, Swift | Tagged , | 11 Responses

Swift: AUGraph and MusicSequence

Swift Language

Swift AUGraph and MusicSequence The AudioToolbox MusicSequence remains the only way to create a MIDI Sequence programmatically. The AVFoundation class AVMIDIPlayer will play a MIDI file, but not a MusicSequence. AVAudioEngine has a musicSequence property. It doesn’t seem to do anything yet (except crash when you set it). So the way to get a MusicSequence […]

Posted in Computer Music, Swift | Tagged , , | 28 Responses

Swift: remove array item

Swift Language

Swift Array item removal without an index The surprising contortions that you need to go through in order to remove an item from an array in Swift if you do not have its index in the array. Introduction Comparing objects Summary Update Resources Introduction I’m writing an app that uses standard music notation for input. […]

Posted in Swift | Tagged | 8 Responses

Swift dragging a UIView with snap

Swift Language

Swift dragging a UIView Here is one simple way to drag a UIView. Introduction Beginning the drag Dragging Ending the drag Summary Resources Introduction There are many ways to drag a UIView around. In my example on Github, I drag a custom UIView subclass that does nothing special besides drawing itself. In real life you’d […]

Posted in Swift | Tagged , | 1 Response