Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

hectr/MRDetectBpmOperation

Repository files navigation

MRDetectBpmOperation

CI Status Version License Platform

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];

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

CocoaPods

MRDetectBpmOperation is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MRDetectBpmOperation"

Manually

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 to GCC_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.

License

MRDetectBpmOperation is available under the MIT license. See the LICENSE file for more info.

About

Subclass of NSOperation for detecting BPM using SoundTouch

Resources

License

Stars

Watchers

Forks

Packages

No packages published