iHS
iHS

Reputation: 5432

How to determine the bpm (beats per minute) of any song, using iPhone SDK?

I am working on an iPhone app that can determine the bpm (beats per minute) of every song in the iTunes library, and then adjust the songs to 140 bpm (or 70) for the perfect workout tempo.

I have worked on the AVAsset library for capturing the songs from the itunes library, and this part is working fine. Now I want to capture and then modify the bpm (beats per minute) of that song.

I would really appreciate, if someone can show me the way that how this can be achieved, and if there is any sample available.

Upvotes: 2

Views: 3757

Answers (2)

ykonda
ykonda

Reputation: 527

If anyone's running into this problem today... I made a github repo which estimates bpm of a local audio file.

https://github.com/yaizudamashii/BPMDetection-iOS

Upvotes: 1

girish_vr
girish_vr

Reputation: 3061

Load the song in AVPLayer. It has setRate functionality to change the tempo of the song.

To read BPM of a song you need to use MPMediaItem. ex.

 MPMediaItem *mediaItem = ...;
 int BPM = [[mediaItem valueForProperty:MPMediaItemPropertyBeatsPerMinute]intValue];

let me know if you need more explanation

Upvotes: 0

Related Questions