MIDI Note Number Chart for iOS Music Apps
I’m regularly pulling this little chart up as I build music apps. I use it to translate scales and chords to numbers and to figure out what to name my samples.
Middle C in iOS
Middle C, in MIDI, is note number 60. Whether that note translates to C3 or C4 varies based on the platform.
With iOS and Apple’s sampler audio unit
AVAudioSamplerUnit, middle C is C4.
Impact of Middle C = C4
Apple’s sampler audio unit will automatically associate a sample to a MIDI note number based on the name of the audio file. This is where middle C = C4 becomes important.
If you have an audio file named
piano_C4.wav, and you load it into a sampler with
sampler.loadAudioFiles(at: audioFileURLs), it’ll automatically get mapped to note number
To trigger the sample is just:
sampler.startNote(60, withVelocity: 127, onChannel: 0).