Midi Animation Starter Kit for iOS

Midi Animation Starter Kit for iOS

Released 3 years ago , Last update 1 year ago

A starter kit and PDF tutorial that demonstrates and explains how to load, parse and play multi-instrument MIDI files in iOS, and how to create a real-time animation based on the MIDI notes.

The iPhone and iPad come with a very powerful audio library in the form of CoreAudio. It's fully featured, extremely flexible and consistently written. With a good knowledge of CoreAudio, you can make your audio processing dreams come true.

So you've read Apple's blurb and you're excited, time to crack open CoreAudio and find out that CoreAudio is written in C, it doesn't use object orientation and there's almost no documentation. It's also closed source and very unforgiving for the uninitiated.

This component is an objective-C library that wraps around CoreAudio and includes a comprehensive PDF guide of how to work with it to create MIDI based iOS apps.

What's included

  • Loading and parsing a MIDI file using CoreMidi: I'll show you how to load a MIDI file using CoreMidi and then access the MIDI events (Note, Tempo, Time Signature, etc...) individually. This puts you in full control and gives you access to all the information the file contains. I also clearly explain how the MIDI file fits together and what the important MIDI messages mean.

  • Lots of background information: In the tutorial I don't just explain how the example project works. I also give lots of background information and useful tips when processing MIDI files. I explain: bitwise operations, hex and binary, General Midi, how the percussion track work and much more! In fact the guide alone is over 5000 words long!

  • Writing a fully functional MIDI player: Step by step, I'll explain how to interpret the sequence of messages you retrieved from the MIDI file. The MIDI player uses multi-threading to play the sequence of MIDI messages in real-time. The MIDI clock class ensures that the MIDI file plays smoothly at the correct tempo. The MIDI player provides easy to use callback functions which give you access to all MIDI events in real-time. If you need events which I've aren't included it's easy to extend the framework to support all existing MIDI messages.

  • Audio Manager provides multi-timbral playback: CoreAudio on the iPhone only comes with a mono-timbral sampler. This means that you can only play your MIDI notes using one instrument sound. The Audio Manager which is included in the tutorial makes it easy to play your MIDI file using up to 10 instruments using a custom SoundFont. I show step by step how to setup a complex audio graph. I'll also show you how to set up the instruments based on information provided in the MIDI file. Doing this provides a rich sound as demonstrated in the video.

  • Putting it all together: In the final part of the tutorial I'll show how you can put all this together to create a rich MIDI based animation. The animation visualizes the notes as circles traveling from left to right across the screen. The vertical position of the circle depends on the value of the note. Notes pulse based on the metronome beat. Sharps and flats are circles with a random fill. This is a simple example but it could easily provide the basis of a cool game or MIDI playing app.

  • More than just a tutorial: The sample project, provided with the tutorial, provides a solid framework for your CoreMidi iOS project. The license allows you to use the framework in any number of your own projects. You can use this project as a learning exercise to learn CoreAudio and CoreMidi or base your whole project on the code.

This tutorial took me well over 100 hours to research and write. The information contained in this project just isn't available on the internet. If you're planning to write an app based on CoreMidi it's guaranteed to save you a substantial amount of time.

5.0
  • 5 1
  • 4 0
  • 3 0
  • 2 0
  • 1 0
1 Reviews Read Reviews

Pricing

14 day 14-day money-back guarantee

$69.99

Application License

  • Perpetual license

  • 1 application

  • Can distribute binary products only

  • Commercial use

Need custom services for this product? Get a quote

Installation Instructions

When you've downloaded the sample project unzip the directory to the desired location.

  • The directory contains the Xcode sample project and a PDF document containing a detailed explanation of the code.
  • In order for the MIDI file to be played it's necessary to download a SoundFont file. The SoundFont provides the instrument sounds for the MIDI file. Due to it's size, the SoundFont file is not included with the sample project.
  • The SoundFont can be downloaded here. Once downloaded, place the SoundFont file in the "Resources" directory of the Xcode project and you're ready to go!
2 licenses, starting from From » $69.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.

or Get a quote

for customization or integration services


Or enter your name and Email
  • BU Brandon Uhlir 4 weeks ago
    hey im very interested in this my question though is. Is it very specifically coding animation for midi or does it have everything that you would need to know about midi protocol and iOS.. i.e. i want to build an app on the iPad that acts as a midi controller so it uses midi out functions. would the tutorials help me comply everything i need for midi and iOS?
    • Ben Smiley Publisher 4 weeks ago
      Hi Brandon, This tutorial mainly covers retrieving and playing MIDI commands from a MIDI file (it contains a custom MIDI player implementation). It also contains quite a lot of information about the MIDI protocol. However it doesn't cover MIDI input or output specifically. For that I'd recommend this library: https://github.com/petegoodliffe/PGMidi If you need information on how to parse MIDI, how the MIDI clock works, synthesising MIDI using CoreAudio and general MIDI background etc... This tutorial would be useful. Thanks, Ben
    • BU Brandon Uhlir 4 weeks ago
      awesome! thanks for the reply. ill keep this in mind for the future much appreciated!
  • JS joe S 1 year ago
    Hi Ben, With your midi animation starter kit is it possible to have a palette of midi instruments to pick from and then make MusicSequence objects to comprise MusicTrack objects? I am looking for a way to make midi music by selecting music elements and appending them together to make a nice sounding track. How many voices would one have access to? If not in your lib where would one buy a library of midi voices to pick from? Thanks, Joe
    • Ben Smiley Publisher 1 year ago
      Hi Joe, The current kit has a number of different voices - it uses a general MIDI SoundFont so it has over 100 instruments. Currently each instrument has to have it's own AUSampler because, so far Apple hasn't made their DLSSynth AudioUnit available on iOS. It would require a fair amount of extra work to do what you're trying to do but this kit would provide a solid foundation. Thanks, Ben
    • JS joe S 1 year ago
      would a Swift version of you code be in the works?
    • Ben Smiley Publisher 1 year ago
      Hi Joe, At some point I may convert the library to SWIFT - but not until iOS 8 comes out in September. I've been wanting to add some new features to this component for a while so that may be a good time to upgrade it to SWIFT. Cheers, Ben
    • RM Ray M 10 months ago
      I would be very interested in a SWIFT version as that's where all my developments are going, so i am voting this up.
  • KZ Kenis Zhu License holderApplication License
    Purchased on Feb 4, 2014
    1 year ago
    Hi Ben, how to obtain the MIDI file Key Signature by using Midi Animation Starter Kit for iOS? Any example or tutorial? Many thanks Kenis