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 modi开发者_如何学Cfy 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.
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
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
精彩评论