How to get BPM value from MPMediaItem class of ios?

207 views Asked by At

I did lots of R&D on BPM but did not get any answer that resolve my issue. I am trying to get BPM value from MPmediaItem class of ios for my iphone application.I have to categorize my app users on the basis of beats per minute of their library songs. So my first task to find out BPM of songs. How can I do that? I got some answers like: 1.using MPMediaItemPropertyBeatsPerMinute property and 2. Use @"beatsPerMinutes" instaed of MPMediaItemPropertyBeatsPerMinute property of MPMediaItem class and also some more answer, but didnot get any success. It has always same result for all songs (return null for all songs). Do you have any sample code or logic to get this.

Thanks in advance.

1

There are 1 answers

1
zombie On

Try this:

int BPM = [[mediaItem valueForProperty:MPMediaItemPropertyBeatsPerMinute]intValue];