How can I get the BPM property of an MP3 file in a Windows Forms App
See the question and my original answer on StackOverflowYou can use Windows' Scriptable Shell Objects for that. The item object has an ShellFolderItem.ExtendedProperty method
The property you're after is an official Windows property named System.Music.BeatsPerMinute
So, here is how you can use it (you don't need to reference anything, thanks to the cool dynamic
C# syntax for COM objects):
static void Main(string[] args)
{
string path = @"C:\path\kilroy_was_here.mp3";
// instantiate the Application object
dynamic shell = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"));
// get the folder and the child
var folder = shell.NameSpace(Path.GetDirectoryName(path));
var item = folder.ParseName(Path.GetFileName(path));
// get the item's property by it's canonical name. doc says it's a string
string bpm = item.ExtendedProperty("System.Music.BeatsPerMinute");
Console.WriteLine(bpm);
}