Category Archives: Swift

MIDIMetaEvent and that damn tuple

Swift Language

Swift and AudioToolbox pains Using C APIs in Swift is still a pain in the neck – even in Swift 4. Here is one of the problems with using the C AudioToolbox API. Introduction Summary Resources Introduction Table of Contents The problem is using C APIs in Swift where an array is imported to Swift […]

Also posted in Core MIDI | Tagged , , , , , | Leave a comment

KVO Quick Spec unit tests

Swift Language

If you’re using KVO, how can you test the changes on your classes/structs?

Also posted in Testing, Uncategorized | Tagged , , | Leave a comment

MusicSequence via a MIDI Virtual Source

Swift Language

MusicSequence via a MIDI Virtual Source Virtual MIDI sources and destinations are a bit confusing. This is one way to use a Virtual MIDI source. Introduction MIDI Setup MusicSequence Summary Resources Introduction Table of Contents If you want other apps to the “see” your app as a MIDI source, i.e. a producer of MIDI data, […]

Also posted in Core MIDI, MIDI | Leave a comment

Swift script to create a Cocoa window

Swift Language

Swift script to create a Cocoa window Create a Cocoa window with a functioning button from a command line Swift script. How To Summary Resources How To Table of Contents You probably know that you can run a swift program from the command line like a script.

Previously you had to use this incantation: […]

Also posted in Cocoa | 2 Responses

Multi-timbral AVAudioUnitMIDIInstrument

Swift Language

Multi-timbral AVAudioUnitMIDIInstrument in Swift Table of Contents Introduction Core Audio Unit AVFoundation Unit Summary Resources Introduction Table of Contents There is one sublcass of AVAudioUnitMIDIInstrument provided by Apple – the AVAudioUnitSampler. The only problem is that it is mono-timbral; it cannot play more than one timbre at a time. To create a new AVAudioUnit, we […]

Also posted in AVFoundation, Core Audio | Tagged , | 18 Responses

The Great AVAudioUnitSampler workout

Swift Language

The Great AVAudioUnitSampler workout Table of Contents Introduction Sampler from SoundFont Sampler from aupreset Sampler from sound files Multiple voices Summary Resources Introduction Table of Contents Little by little, AVFoundation audio classes are taking over Core Audio. Unfortunately, the pace is glacial so Core Audio is going to be around for another eon or so. […]

Also posted in AVFoundation | Tagged , | 11 Responses

Swift 2: AVFoundation to play audio or MIDI

Swift Language

Swift AVFoundation There are many ways to play sound in iOS. Core Audio has been around for a while and it is very powerful. It is a C API, so using it from Objective-C and Swift is possible, but awkward. Apple has been moving towards a higher level API with AVFoundation. Here I will summarize […]

Also posted in Core MIDI | Tagged , , | 13 Responses

Multiselect UITableView with limited selections

Swift Language

Multiselect UITableView with limited selections Simple example of creating a multi-select UITableView, but allow only a limited number of selected cells. Introduction How to Summary Resources Introduction Table of Contents I wanted a multi-select table view but limit the number of selected cells. The “answers” on StackOverflow were quite awful – which is true > […]

Posted in Swift | 2 Responses

Apple TV tvOS hello world app in Swift

Apple TV TVML tvOS hello world app in Swift Introduction Getting started Server side Swift code Security Summary Update Resources Introduction Table of Contents So, you saw the shiny new AppleTV demo on the Apple Live Event. Finally we can write apps for the beast! Like most of you, I downloaded the Xcode 7.1 beta […]

Also posted in Apple, tvOS | 2 Responses

Swift NSTableView and NSArrayController

Swift Language

Swift NSTableView and NSArrayController In my NSTableView column chooser example, I used a table data source and delegate to manage the table’s data. Just like iOS. Cocoa offers other options. In this example, I’ll look at “binding” to an NSArrayController. Introduction Data Model Array Controller Table View Binding the columns Adding/Removing rows Summary Resources Introduction […]

Also posted in Cocoa | Tagged , | 7 Responses