Category Archives: Computer Music

iOS MIDI interfaces

iOS MIDI Interfaces Here are a few current MIDI interfaces for iOS devices with Lightning connectors. If you know of any others, please let me know. Click the images to go to the product page. IK Multimedia iRig MIDI 2 iRig Pro Universal AUDIO/MIDI interface for iOS devices and macs iConnectMIDI1 Lightning Version, 1-in 1-out […]

Also posted in iOS, MIDI | 4 Responses

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, Swift | Leave a comment

tvOS: playing audio

Playing MIDI on tvOS According to Apple’s App Programming Guide for tvOS, AVFoundation is supported in tvOS. Groovy! Let’s use AVMIDIPlayer to play a file! Set up Result Summary Update Resources Set up Table of Contents AVMIDIPlayer’s init func wants two URLs: one to a MIDI file and another to a SoundFont or DLS file. […]

Also posted in MIDI, tvOS | Tagged , | 2 Responses

iOS: trimming audio files with Swift

Swift Language

iOS: trimming audio files I’ve written about how to record audio on iOS using Swift. But, how do you trim the recording? Introduction Summary Resources Introduction Table of Contents One way to trim an audio file is to use AVFoundation’s AVAssetExportSession. You create an export session instance, set its parameters, and then tell it to […]

Also posted in AVFoundation, Core Audio, Swift | Tagged , | 13 Responses

Swift 2 AVAudioSequencer

Swift Language

Swift 2 AVAudioSequencer There’s a brand new MIDI sequencer class in Swift 2 beta! It’s the AVAudioSequencer. Introduction AVAudioSequencer Setup AVAudioEngine Setup AVMusicTrack Summary Update Resources Introduction Table of Contents At WWDC15 there was a presentation entitled “What’s New in Core Audio“. If you were able to get past the first 29 minutes of a […]

Also posted in Apple, Core MIDI, MIDI, Swift | Tagged , | 12 Responses

Swift fail: MIDIClientCreate

Swift Language

Swift fail: MIDIClientCreate There is a problem with calling Core MIDI’s MIDIClientCreate function from Swift. N.B. This article was true when published. Apple has since fixed the problem. Introduction The Test Summary Resources Introduction Let’s start with a simple call to Core MIDI’s client create function. You need the midi client to create MIDI input […]

Also posted in Apple, Core MIDI, MIDI, Swift | 2 Responses

iOS 8 Bluetooth MIDI LE build tip

iOS Bluetooth MIDI LE Introduction The Bluetooth classes Summary Resources Introduction iOS 8 and OS X Yosemite now supports sending and receiving MIDI data using Bluetooth Low Energy connections on any iOS device or Mac that has native Bluetooth Low Energy support. I reminding myself here of a simple problem I had that wasted my […]

Also posted in Apple, MIDI, Swift | Tagged , , | Leave a comment

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 […]

Also posted in 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 […]

Also posted in Swift | Tagged , , | 28 Responses

AVFoundation audio recording with Swift

Swift Language

Swift AVFoundation Recorder Use AVFoundation to create an audio recording. Introduction Creating a Recorder Recorder Delegate Recording Summary Resources Introduction AVFoundation makes audio recording a lot simpler than recording using Core Audio. Essentially, you simply configure and create an AVAudioRecorder instance, and tell it to record/stop in actions. Creating a Recorder The first thing you […]

Also posted in AVFoundation, Swift | Tagged , | 30 Responses