I like smart playlists, and was hoping to use them to help come up with a good 90 BPM playlist for running, so I need to get iTunes to know about all those individual track tempos, but with thousands of tracks the idea of clicking on each one to get it to load is a nonstarter.
Solution #1
Lifehacker has this helpful receipe, which I'll rewrite in a little more detail here:
- Open iTunes
- Select Music library
- Make sure BPM is one of the columns displayed. If not, right-click on one of the other columns, and check "Beats per Minute"
- Click on the BPM column to sort it, so all of the tracks that don't have BPM info are all at the beginning
- Select all tracks showing blank BPM (or a subset if you have a lot of tracks and want to do this in batches)
- Right-click on the selection and click "Get Info"
- On the Multiple Item Information screen, click OK without modifying anything
- If there are a lot of tracks, a progress bar should come up. The total time it takes to update everything will depend on how many tracks are involved and the speed of your hard drive, but shouldn't be more than a minute or two in most cases.
- Close and reopen iTunes to refresh the music list
Only one problem: this didn't work for me, at least not consistently, and I was still left with thousands of "un-tempo'd" tracks. It may work for you; if it does, let me know in the comments.
Solution #2
(For the non-technical: skip to the bottom to download the app)
Time to write a little code. On Windows, iTunes has a COM interface (I hear you shuddering out there, but I'm nothing if not pragmatic). It doesn't appear to be well-documented, but a little web searching makes things clear enough. I'm working in C#/.NET/Visual Studio, but you could use Python, Powershell, or almost anything.
In Visual Studio, create a new Console Application project, add a reference, go to the COM tab, and select "iTunes 1.13 Type Library". Instantiate a new iTunesAppClass object representing the iTunes application:
var iTunesApp = new iTunesAppClass();
When done, in a finally block, be sure to release the object:
The LibraryPlaylist property contains all the tracks:
Marshal.ReleaseComObject(iTunesApp);
The LibraryPlaylist property contains all the tracks:
var mainLibrary = iTunesApp.LibraryPlaylist;
The collection of tracks for a playlist is on the Tracks property, from which you can enumerate individual tracks:
foreach (var track in mainLibrary.Tracks) { .. }
We want to limit ourselves to file-based tracks. One way to do that is to cast each track object to the IITFileOrCDTrack class, and only proceed if the cast succeeds.
var filetrack = track as IITFileOrCDTrack;
Finally, the IITFileOrCDTrack class has an UpdateInfoFromFile() method, which does what it sounds like:
filetrack.UpdateInfoFromFile();
If you're interested, you can download the source project, or the compiled application.
Links
- 90/180 BPM Running Playlists and Beat Detection Software
- Top 10 iTunes Smart Playlists (lifehacker.com)
- Set Up iTunes Smart Playlists to Give Every Song in Your Collection Its Due (lifehacker.com)
- Update Your iTunes Library (lifehacker.com)
- iTunes COM API in C# (Oh! Scope)
- Controlling Your Tunes In F# (The Life of a .NET Developer)