Showing posts with label iTunes. Show all posts
Showing posts with label iTunes. Show all posts

Thursday, 17 October 2024

How to have a reasonable chance at getting correct album art in Mac OS Apple Music

TL;DR

Ignore the naysayers who claim it has nothing to do with the iTunes music store—they are wrong. Look up the album in iTunes and set the album title for your local files to the exact same title, with junk like “(Remaster)” and so on included. Then clear the artwork and download it again. Afterwards, you can rename the album back to what you want. If this doesn't work, then it will never work for that album, so stop wasting your time.

The Long Story

I still use Apple Music, the former iTunes, to manage an offline music library. I have never bought into the streaming game. It sucks for many reasons that I won't explain here. What also sucks, is how Apple Music handles album art, especially for music that has been ripped from CDs or obtained from somewhere else than the iTunes store. Very often, the album art is plain wrong. It will generally be from the correct artist, but older albums will often get the cover art of a very recent release, or a stupid compilation. I don't care about compilations, I want to know what album a song originally came from.

The cover art matching algorithm has always been bad, from the earlier days of iTunes to the latest Music app release in Mac OS Sonoma. The way in which it makes mistakes has changed over the years, but it has never made any sense. I would like to have a chat with the person who implemented it. I wonder how their mind works—if it works at all. Anyone with some vague sense of logic and a bit of programming experience can come up with a better algorithm than the current one.

And please don't tell me to add my own cover art by pasting it into the info window. Ever since it was first introduced in ID3 tags, I have hated this concept of copy-pasting the same JPEG or PNG file into the metadata tags of every single track of an album. What if I have an album with 50 tracks? Do I really need to duplicate the same image 50 times? That is conceptually idiotic. Album art should be stored once and then linked to the relevant tracks. It does not belong inside the music files themselves. This is one upside from how the artwork download system in iTunes/Music handles it, because it does exactly that: download a single file and then link it to each track. Now if only it would download the correct file…

Anyhow, I'll stop my rant and cut straight to the chase. How can one fix missing or incorrectly matched artwork even when you know the album is in the iTunes music store? After some experiments, I have found a way to fix some of the blatantly wrong album covers. For instance, practically all my Dire Straits albums got the same cover of some recent Mark Knopfler compilation with a red Stratocaster on a blue background. When using the “Show in iTunes Store” option on songs from those albums, it will indeed always send me to that compilation album in iTunes. However, the actual correct albums are also in the store. However, they will often be remasters, or “bonus track editions.” The title of the album in the store is for instance “Communiqué (Remastered),” while in my collection it is simply called “Communiqué” (because I care as much about what particular remaster a track came from as I care about compilations—I don't give a 💩.)

Therefore, despite many people claiming that the cover art matching has nothing to do with the iTunes store, I decided to clear the wrong artwork, rename the album to “Communiqué (Remastered),” and try to download the cover art again. And behold, it works. (Of course afterwards I restored the original album name.) The same worked for Neko Case - “Fox Confessor Brings the Flood,” which I had to rename to the silly “Fox Confessor Brings the Flood (Bonus Track Edition)” because that is the version which is available in the iTunes store.

The bad news is that this does not always work. For the Belgian band dEUS, it is totally hopeless. The matching algorithm gets stuck on linking all albums to Following Sea. I have no clue why. Again, I'd like to see the implementation of this “algorithm”—I really could use a good laugh. How can it be so bad? How can it break on stuff between brackets? Anyone who takes a quick glance at album naming should know that if something doesn't match exactly, but it does match when omitting stuff between brackets, it is likely a good match. And what about just giving the user the option to pick the correct match from multiple options if there is ambiguity? Oh no, that is totally un-Apple of course, because everything needs to be dumb and simple. Apple expects all their users to be dumb and simple.

It is rather obvious that Apple doesn't care about the ever shrinking niche of users who want to manage their own music library. This fares against their streaming income model. I even suspect this is why they subtly break functionality in the Music app, or refuse to fix bugs, like the failure to update the last played status in many cases, or the hiccups that make the whole Mac OS choke every 7 seconds when playing music on older Intel machines—see my older blog post about this.

Anyhow, if you are as masochistic as me and want to stick to the Music app to manage an offline music collection, now you have at least some chance to fix some of your broken artwork. However, it is likely I will not only ditch the Music app for something else, but the whole Apple ecosystem in the near future, because I have figured out that I have switched to open source alternatives for pretty much everything lately. Ironically, iTunes/Music was one of the few remaining things that I liked and kept me on the platform, but since they are now also enshittifying this, it leaves me with no real reason to stick with MacOS…

Friday, 19 May 2017

Making Prosoft Hear work again with iTunes 12.6

The only reason why I stick with iTunes is that I have been suckered into it from the start when it still was a pretty good application for managing an offline collection of music files. Lately, the app has shifted towards cloud-based stuff and artificial stupidity algorithms that try to suck all the joy out of being your own virtual DJ. It is still usable for its original intent however so I haven't tried to move to an alternative… yet.

Lately, Apple has done two more stabs at endlessly annoying me and making me regret that even my alarm clock is tightly coupled to iTunes by means of Koingo's Alarm Clock Pro. The first thing they did was break the visualizer plug-ins, in the typical Apple fashion that has since many years made me shy away from developing anything specific for OS X. This fashion is of course doing it in total silence, without warning anyone or even mentioning it in the release notes. Starting with iTunes 12.6 the visualizer menu simply only shows the two built-in visualisers, ignoring any installed plugins. I am pretty glad I never took the effort to polish up my now obsolete Spectrograph plug-in. Maybe I unconsciously saw it coming.

The second thing they did, and what this post really is about, is that they also broke the Hear audio enhancer from Prosoft. I heavily rely on Hear to make listening with headphones more enjoyable. When properly set up, Hear can make even the cheapest headphones sound like expensive Sennheisers. Or in my case, make mid-priced Sennheisers sound like an explosion of aural bliss. It can also squeeze extra fidelity out of simple Bluetooth speakers or other sound systems. Great was my frustration when I noticed the controls had no effect anymore after iTunes had sneakily upgraded itself to 12.6.1, and it was even greater when I saw on the Hear product page that Prosoft officially does not support iTunes anymore. That's right, they admit that their product primarily geared towards enhancing your music experience, does not work with the de facto standard for music playback in Mac OS. I commend them for that, but it doesn't make the fact less annoying.

My guess is that iTunes has become yet another application in the row of ‘sandboxed’ apps like Safari, which are nailed shut to avoid exploits from malware and the like. After all, iTunes is linked to a store and the store is linked to credit card details. Why this also has to break the ability to manipulate the audio stream, beats me. I contacted Prosoft and they are looking if the problem can be fixed, but I'm not sure if they'll be able to circumvent the sandbox restriction.

However, I noticed that applications like Nicecast still work fine with iTunes. This made me pretty confident that I can still make the audio go through Hear after all, albeit by means of a pretty clumsy roundabout. And indeed, after the necessary cursing and kludging I made it work as follows.

Making it work

The strategy is quite simple: re-route iTunes' audio output through another non-sandboxed program that plays the stream on standard output. We can do this by means of two different free, open source projects: SoundFlower and Audacity.

  1. First install SoundFlower, the current 2.0b2 release from mattingalls' GitHub seems to work fine, at least in El Capitan. Don't bother with trying to get the Soundflowerbed application to work, you don't need it.
  2. In your Sound system preferences, set the ‘Soundflower (2ch)’ device as output device.
  3. Open Audacity and select the ‘Soundflower (2ch)’ device as the microphone device. Select the ‘Built-in Output’ as your output device.
  4. In Audacity's preferences, Recording, enable ‘Software Playthrough’.
  5. Drag both the input and output volume sliders in the top-right corner of Audacity's main window to maximum. Now press ‘Click to Start Monitoring’ and start playing some music. You should see Audacity's VU meter start to move, and hear the sound as usual. You may need to give the Hear control panel a kick by toggling the on/off button or nudging a slider to make it hook itself to the audio output, but it should work.

Of course this has some disadvantages, like needing to keep Audacity open, and a noticeable extra delay on the audio as well. You will have no sound at all if you break any component in the whole chain. This can be pretty annoying if like me, you use your Mac as an alarm clock (it will be trying to wake you with silence which results in you being late for work). Moreover, when you switch back to direct playback through internal speakers, two things require attention. First, your volume will be at 100%, which can lead to unpleasant surprises if you forget to turn it down. Next, when you have switched back to internal speakers in the Sound control panel and plug or unplug something from the headphone jack, OS X will once more switch back to Soundflower output, and you must again select internal speakers.
In other words, not only do you need a whole ritual to set up this workaround, you also need to do a little dance to tear it down. For all these reasons I hope Prosoft manages to find a solution. I wouldn't mind if it would simply implement this workaround under the hood and have some extra delay, if only it is reliable.

This hack does have some extra advantages however, for instance Hear will also work with Safari or any other sandboxed application's audio. And, if at any time you would want to record what's playing, all you have to do is hit the record button in Audacity.

Saturday, 1 November 2014

iTunes 12: hacking the playlist font sizes

In iTunes 11, there were only two options for the font size in list views. The ‘small’ size corresponded to a font size of 12, the ‘large’ size was 15. It was possible to change these font sizes by editing the TextStyles.plist file (for your specific language) inside the iTunes app bundle. The two relevant keys were 9002 and 9003.

In iTunes 12, the old choice between three list sizes was reintroduced. However, the font sizes associated with ‘small’, ‘medium’, and ‘large’ have been assigned dubious values: they are 11, 12, and 13 respectively. There is even less difference between smallest and largest than in iTunes 11. The row heights do change quite drastically, resulting in an overly spacious display for the large size.



Editing the same keys in the plist as before has no effect. After looking around a bit, I found the keys that are currently used: they are respectively #17920, named “Label” (this is actually the large size), #18688, named “Label_Medium”, and #18944, named “Label_Small”. It may be necessary to edit the other keys with similar names to get a consistent result. For instance, to revert the ‘large’ size back to its former 15 point size, you would need to ensure the Label, Label_Emphasized, etc. entries look like this:

        <key>17920</key>
        <dict>
                <key>- loc hint -</key>
                <string>Label</string>
                <key>font</key>
                <string>_HelveticaNeueSystem</string>
                <key>size</key>
                <integer>15</integer>
        </dict>

Of course, this hack needs to be re-applied after every iTunes update. You may want to keep a backup of the edited plist file so you can simply copy it (although you should check whether no other values have changed in the update).

Friday, 4 January 2013

Approximating iTunes DJ in iTunes 11

iTunes 11 has generated both praise and revolt in the online community because it is a mix of both improvements and regressions. One of the most annoying things for me and many others is the omission of the iTunes DJ feature. Apple's idea was to replace it with the “Up Next” feature, but it is not the same. What I liked a lot about iTunes DJ is that it was a regular playlist that I could easily tweak and I could see all the desired information about upcoming songs at a glance. The Up Next feature requires a click on a button to temporarily view a severely limited list of what is coming next, and manipulating it is a hassle.
It is possible however to create a smart playlist that more or less behaves like the good old iTunes DJ.
The screenshot is pretty straightforward, it shows the most basic setup but you can tailor it to your needs with additional rules. The only essential things are the fixed limit “selected by random”, the “Live updating”, and the “Last played not in the last …”. All these things combined will automatically remove a played song and cause a new one to be added to the queue, just like in iTunes DJ. The time span for the “last played” rule is not essential, anything starting from 5 seconds should work. You can use a larger value if you want to avoid hearing the same song twice within a certain time span.

Next, make sure the playlist is sorted on the very first column (the one with the numbers and no header title), and disable shuffle. Then you can arrange the songs to your liking, and start playing. You will notice that whenever you remove songs, new ones will be added at the bottom just like in iTunes DJ. The only aspects in which this differs are:
  • The biggest drawback is that it is impossible to add specific songs to the playlist. If you want to play one or more specific songs that were not randomly picked, your best option is to use “Up Next” after all.
  • There is no practical way I know of to increase the chance that higher rated songs are played more often. Not a big deal for me since I never used this.
  • One cannot see the played songs, you will need to use a separate “recently played” smart playlist for this.
  • Of course the feature to let people vote for upcoming songs is still missing.