Creating MIDI files on the fly with Audiokit

I am currently using the following method to play stems in a song:

  • Download stem_01.mp3 to AKAudioFile
  • Add AKAudioFile to AKMIDISampler
  • Add AKMIDISampler to AKMixer
  • repeat 1-3 for the number of stems
  • Create an AKSequencer using a custom MIDI file: this MIDI file has a separate track for each stem in the song. Each track has one note in the MIDI file (in C3) that lasts for the duration of the song.
  • I add a new track to the AKSequencer for each stem and use a sequencer to control the playback of the stems.

My question is this: is there a way to automate the creation of this MIDI file. I know the number of stems and the duration of the song; Can I dynamically create the MIDI file that Audiokit requires to enable AKSequencer?

Any thoughts or ideas on this subject are very welcome, as this will save a lot of manual work when adding new songs. 😎 Thank you!

+4
source share

Source: https://habr.com/ru/post/1689779/


All Articles