Record a midi file

Discussion in 'iOS Programming' started by Zelda, Feb 26, 2015.

  1. Zelda macrumors member

    Aug 10, 2014
    I have an app that creates midi files and would like to convert the midi file to a ringtone or mp3 or acc file.
    I can't find any info to help with my dilemma.
    Is it possible to record a midi file that is being played, using swift code?
    thanks heaps.
  2. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Not in Swift (yet). You can currently only record what you play on iOS if you use Audio Units to play synthesized midi, and Audio Unit callbacks have to be coded in C (at least partially).

    Look into the documentation on the AUSampler Audio Unit. You may also need to use the AVAssetReader and AVAssetWriter APIs to convert PCM audio samples into an .m4a or .m4r format. It's not simple code. Tons of documentation on Apple's web site, but very little sample code appropriate to what you need.
  3. Zelda thread starter macrumors member

    Aug 10, 2014
    Ok, i will look at your suggestions.
    Very much appreciated.

Share This Page