https://github.com/manuelescrig/rhythmbox
A Rhythm Box System for your iOS app written in Swift. šµ
https://github.com/manuelescrig/rhythmbox
bpm bpm-signal cocoapods music-library rhythmbox swift swift-library
Last synced: 6 months ago
JSON representation
A Rhythm Box System for your iOS app written in Swift. šµ
- Host: GitHub
- URL: https://github.com/manuelescrig/rhythmbox
- Owner: manuelescrig
- License: mit
- Created: 2016-11-17T10:18:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-13T15:33:52.000Z (almost 9 years ago)
- Last Synced: 2025-06-19T03:18:18.884Z (7 months ago)
- Topics: bpm, bpm-signal, cocoapods, music-library, rhythmbox, swift, swift-library
- Language: Shell
- Homepage:
- Size: 66.4 KB
- Stars: 114
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# RhythmBox
A **Rhythm Box** System for your iOS app šµ. The easiest way to create **Music Rhythm Patterns** in Swift.
[](https://dashboard.buddybuild.com/apps/589332f8c8fcc401007586ce/build/latest?branch=master)
[](http://cocoapods.org/pods/RhythmBox)
[](http://cocoapods.org/pods/RhythmBox)
[](http://cocoapods.org/pods/RhythmBox)
[](https://developer.apple.com/swift)
## What can I do with RhythmBox?
- [x] Generate a BPM or RPM Tempo
- [x] Select the Time Signature
- [x] Create a Rhythm pattern
## Demo Project
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Getting Started
### Requirements
- iOS 8.0+ / tvOS 9.0+
- Xcode 8.0+
- Swift 3.0+
### Installation with CocoaPods
[CocoaPods](cocoapods.org) is a 3rd-party dependency manager for Swift and Objective-C projects. For more information, refer to the [CocoaPods Getting Started Guide](https://guides.cocoapods.org/using/getting-started.html). Otherwise, you can install CocoaPods with the following command:
```bash
$ gem install cocoapods
```
#### Podfile
To integrate RhythmBox into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
pod 'RhythmBox'
```
Then, run the following command:
```bash
$ pod install
```
### Installation Manually
To integrate RhythmBox into your Xcode project manually, just include the filest from [/Pod/Classes/](https://github.com/manuelescrig/RhythmBox/tree/master/RhythmBox/Classes) folder in your Appās Xcode project.
## Quick Guide
### Usage
To Generate a constant BPM signal is as simple as this.
###### 1. Import class
```swift
import RhythmBox
```
###### 2. Create a RhythmBox class
```swift
let rhythmBox = RhythmBox(bpm: 120, timeSignature: (4,4))
```
###### 3. Start the Rhythm
```swift
rhythmBox.perform {CurrentBeat, CurrentSubBeat, CurrentNote in
print("CurrentBeat", CurrentBeat)
print("CurrentSubBeat", CurrentSubBeat)
print("CurrentNote", CurrentNote)
return .resume
}
```
###### 4. Stop the Rhythm
```swift
rhythmBox.stop()
```
### Examples
###### Example 1
Create a 120 BPM signal with a block.
```swift
let rhythmBox = RhythmBox(bpm: 120)
rhythmBox.perform {CurrentBeat, CurrentSubBeat, CurrentNote in
print("CurrentBeat", CurrentBeat)
return .resume
}
```
###### Example 2
Create a 150 BPM signal with a time signature of 6/8 with default subdivision of 
```swift
let rhythmBox = RhythmBox(bpm: 150, timeSignature: (6,8))
rhythmBox.perform {CurrentBeat, CurrentSubBeat, CurrentNote in
print("CurrentBeat", CurrentBeat)
return .resume
}
```
###### Example 3
Create a 90 BPM signal with a time signature of 3/4 and subdivision of 
```swift
let rhythmBox = RhythmBox(bpm: 90, timeSignature: (3,4), subdivision: "11")
rhythmBox.perform {CurrentBeat, CurrentSubBeat, CurrentNote in
print("CurrentBeat", CurrentBeat)
return .resume
}
```
###### Example 4
Create a 90 BPM signal with a time signature of 3/4 and subdivision of
```swift
let rhythmBox = RhythmBox(bpm: 90, timeSignature: (3,4), subdivision: "111")
rhythmBox.perform {CurrentBeat, CurrentSubBeat, CurrentNote in
print("CurrentBeat", CurrentBeat)
return .resume
}
```
###### Example 5
Create a 90 BPM signal with a time signature of 3/4 and subdivision of 
```swift
let rhythmBox = RhythmBox(bpm: 90, timeSignature: (3,4), subdivision: "011")
rhythmBox.perform {CurrentBeat, CurrentSubBeat, CurrentNote in
print("CurrentBeat", CurrentBeat)
return .resume
}
```
###### Example 6
Create a 90 BPM signal with a time signature of 3/4 and subdivision of 
```swift
let rhythmBox = RhythmBox(bpm: 90, timeSignature: (3,4), subdivision: "10111")
rhythmBox.perform {CurrentBeat, CurrentSubBeat, CurrentNote in
print("CurrentBeat", CurrentBeat)
return .resume
}
```
## Roadmap
- [x] CocoaPods support
- [ ] Carthage support
- [ ] Swift Package Manager support
- [ ] Tests
## Change Log
See [Changelog.md](https://github.com/manuelescrig/RhythmBox/blob/master/CHANGELOG.md)
## Contribute
Contributions are welcomed and encouraged š.
## Author
- Manuel Escrig Ventura, [@manuelescrig](https://www.twitter.com/manuelescrig/)
- Email [manuel@ventura.media](mailto:manuel@ventura.media)
- Portfolio [http://ventura.media](http://ventura.media)
## License
RhythmBox is available under the MIT license. See the [LICENSE](https://github.com/manuelescrig/RhythmBox/blob/master/LICENSE) file for more info.