MRDetectBpmOperation
is a concrete subclass of NSOperation
that uses the SoundTouch Audio Processing Library for detecting BPM of a media resource.
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"song" withExtension:@"mp3"];
MRDetectBpmOperation *operation = [MRDetectBpmOperation bpmOperationWithAssetURL:fileURL];
[operation setCompletionBlockWithSuccess:^(MROperation *operation) {
NSLog(@"%f BPM", ((MRDetectBpmOperation *)operation).bpm);
} failure:^(MROperation *operation, NSError *error) {
NSLog(@"%@", error);
}];
[operation start];
To run the example project, clone the repo, and run pod install
from the Example directory first.
MRDetectBpmOperation is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MRDetectBpmOperation"
Perform the following steps:
- Add the SoundTouch library into your project (e.g. copy external/soundtouch-1.9.0/include and External/soundtouch-1.9.0/source/SoundTouch directories).
- Add
ANDROID=1 SOUNDTOUCH_INTEGER_SAMPLES=1
toGCC_PREPROCESSOR_DEFINITIONS
in your project settings. - Add the
MROperation
class into your project (e.g. copy submodules/MROperation/MROperation directory). - Copy MRDetectBpmOperation directory into your project.
MRDetectBpmOperation is available under the MIT license. See the LICENSE file for more info.