3

i am trying to read bpm embedded in mp3 file like this one :

bpm tag im trying to read

i have tried using

Windows.Storage.FileProperties.MusicProperties

but it only contains title, singer, etc. it can't read the bpm i showed before.

im looking into https://taglib.github.io/ they seems not having such function too. is there any workaround to this?

RJJatson
  • 99
  • 9
  • MusicProperties.RetrievePropertiesAsync returns a dictionary. Try asking for "TBPM", the ID3 tag for beats per minute. – Hans Passant May 08 '16 at 15:03

1 Answers1

2

When you've loaded your music file into a StorageFile, you'll want to place a similar call in your code like this:

var fileProps = await file.Properties.RetrievePropertiesAsync(null);

This will get you a list of all the system properties exposed as a Dictionary<string, object>.

You can then get the BPM value as follows:

if (fileProps.ContainsKey("System.Music.BeatsPerMinute"))
{
    var bpmObj = fileProps["System.Music.BeatsPerMinute"];
    if (bpmObj != null)
    {
        var bpm = bpmObj.ToString();
    }
}

You can find a complete list of available file properties here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd561977(v=vs.85).aspx

James Croft
  • 1,680
  • 13
  • 25