Important facts about commercial licenses

  • Licenses are perpetual. They do not expire and do not need to be renewed.
  • Licenses can be upgraded. You can upgrade to a more expensive license later paying only the difference in cost.
  • Pay attention to the distribution type - Hosted (sites / servers), binary (applications) or source (includes all the others). Choose according to your needs (more below).
  • All licenses allow commercial use unless otherwise indicated.
  • Read the full license by clicking on the icon.
  • Read more about licenses in our handy license guide.
$59

Application License

1 application Binary restricted distribution
$249

Developer License

5 projects Source and binary distribution
You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

  • Released: Sep 2, 2012
    Last Update: Nov 19, 2012
  • Language: Objective-C
  • Time / costs savings: 50h / $3000 *
(1 ratings)

Midi Animation Starter Kit for iOS

Featured Midi Animation Starter Kit for iOS
Developed by Ben Smiley, Released Sep 2, 2012

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.

Objective-C

Tags: animation , coreaudio , coremidi , ipad

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.

Back to top

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!
View all 1 reviews »

User Reviews

Read all 5 comments »

Questions & Comments


Or enter your name and Email
  • manish 3 months ago
    Hi,
    i am getting result error -43 for the method AudioUnitSetProperty(ios), while setting aud audio unit..???

    • Ben Smiley Developer 3 months ago
      Hi Manish,
      I can't really give you general CoreAudio related advice because this is the comment page for the CoreMidi starter kit. If you have a problem with the starter kit I'd be very help you. Equally, if you would like to know more about the starter kit I'd be pleased to answer your questions.
      Thanks,
      Ben
  • manish 3 months ago
    hello, i am stucked while using MIDI for ios,
    i m using method "MusicDeviceMIDIEvent" for generating sound,
    it is working but not beautiful sounds, also suggest me for different instrument sounds.
    • Ben Smiley Developer 3 months ago
      Hi Manish,
      I'm not entirely sure what you're asking. The MIDI animation starter kit should provide you with all the information you need to use MIDI on iOS. If you want a nicer sound, I recommend that you search for alternative instruments (SoundFont, EXS, DLS). The starter kit provides an example of how to load the instrument.
    • manish 3 months ago
      i m new to dev, i am using midi for generating sounds, only a very basic sound is generated but not able to generate different instruments sounds, which parameter generates different instrumnet sound like piano, flute etc.
You must be logged-in to vote. Log-in to your account or register now.