Carlos Mbendera
1 min readMay 20, 2024

--

Hi Julien! Thanks for the kind words! I'm glad that my article helped you.

Changing Sound

In regards to changing the sound, I actually wrote another article documenting this process.

https://medium.com/codex/change-instruments-in-midi-tracks-with-swift-c6845d567b5d

You will want to change the data1 parameter in programChangeMessage to the drums you'd like.

All the relevant midi instrument codes can be found with a google search with "midi instrument codes"

I found this link http://www.ccarh.org/courses/253/handout/gminstruments/

Looping Content

To answer your first question, I would not recommend looping chords, rather it may be better to add a few more bars to the MiDi Track. I'm not sure how familiar you are with music production but essentially, it would be like having a list of sounds to play to play at specific beats and them coming after each other.

My code already supports this, so you would have to mainly change two things.

The BPM, I have a beat variable that's constantly getting faster, you don't have to do that. Just find one that works for you.

Secondly, when calling createMusicSquence() you should pass in a list of chords equal to the number of bars you want to play.

--

--

Carlos Mbendera
Carlos Mbendera

Written by Carlos Mbendera

Jazz Fusion Enthusiast writing about Swift and other Apple software development things.

Responses (1)