我正在尝试读取嵌入在此MP3文件中的BPM,例如:
我已经尝试使用
Windows.Storage.FileProperties.MusicProperties
但是它只包含标题、歌手等信息,无法读取我之前显示的BPM。
我正在研究https://taglib.github.io/,它似乎也没有这样的功能。有什么解决方法吗?
我已经尝试使用
Windows.Storage.FileProperties.MusicProperties
但是它只包含标题、歌手等信息,无法读取我之前显示的BPM。
我正在研究https://taglib.github.io/,它似乎也没有这样的功能。有什么解决方法吗?
当您将音乐文件加载到StorageFile中后,您需要在代码中放置类似于以下的调用:
var fileProps = await file.Properties.RetrievePropertiesAsync(null);
这将为您获取所有公开的系统属性列表,以Dictionary<string, object>
的形式呈现。
然后,您可以按如下方式获取BPM值:
if (fileProps.ContainsKey("System.Music.BeatsPerMinute"))
{
var bpmObj = fileProps["System.Music.BeatsPerMinute"];
if (bpmObj != null)
{
var bpm = bpmObj.ToString();
}
}