问题
i am trying to read bpm embedded in mp3 file like this one :
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?
回答1:
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
来源:https://stackoverflow.com/questions/37101093/how-to-read-beats-per-minute-tag-of-mp3-file-in-windows-store-apps-c