RhythmBox is an open source Swift library submitted by Manuel Escrig that simplifies the creation of rhythm patterns.
To use RhythmBox you simply need to assign a beat, and an optional sub beat and time signature and RhythmBox will execute your code at the correct time intervals. There are also further subdivisions for different note durations.
This example from the readme shows how one could create a RhythmBox at 90 bpm with a 3/4 time signature further subdividing into eigth notes:
rhythmBox.perform {CurrentBeat, CurrentSubBeat, CurrentNote in
<pre><code>print("CurrentBeat", CurrentBeat)
return .resume
</code></pre>
}
You can find RhythmBox on Github here.
A useful library for music apps.
Original article: RhythmBox – A Swift Library That Simplifies Creating Music Rhythm Patterns
©2017 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.