Music playback with Apple Music

Good news everyone!

If you have an Apple Music account, you will be happy to know that you can now log in and play songs directly from ListenBrainz.

Head on over to the music services page to sign in with Apple Music.

Arriving at the end of a one month trial myself, I will not have access for long and would really appreciate any feedback you may have on this new playback option.

Thank you !

5 Likes

Awesome!

  1. It works!
  2. I had to disable the YouTube integration to get it to be used. Ideally I’d want both enabled and have it fall back to YouTube if it doesn’t find the song on Apple Music
1 Like

Awesome, many thanks! That seems to work fine so far, but I just have started with it.

Just to understand this correctly - it is currently not possible to import listens from Apple Music? Will this be possibile in the future, or are there technical limitations preventing this?

Both of you, thanks for helping with testing!

@fdsa Yes that’s in the plans, having on that same settings page a way to choose the order in which the music sources are used.

@lenniepaine There is indeed a technical limitation unfortunately, Apple Music doesn’t provide a timestamp for the listening history, and we depend on that for everything.
At the moment we don’t have a solution to remedy this lack of data and don’t have plans to record listens form Apple Music.
However we can make it so that the tracks you play on the ListenBrainz website are submitted. It’s not currently active as I wanted more time for testing, but that’s the next step.

Similarly to the answer above, I’d like to implement settings to activate/deactivate listen submission for each music service separately.

3 Likes

I’ve been using this again a little the past few days, and I’m noticing that it’s frequently playing the wrong tracks, even when they’re available on Apple Music. I think that used to work better.

E.g. this ListenBrainz plays BrujerĂ­a while the song is available on Apple Music: ‎La Clave â€“ Titel von El Gran Combo de Puerto Rico â€“ Apple Music

This ListenBrainz plays Sobredosis although the song is available ‎En Trance â€“ Titel von Los Titanes â€“ Apple Music

2 Likes

Yep, I confirm I’m seeing the same thing, thanks for reporting the issue and for the details

In short, we play the first result from the search response we get from the apple music API, and in this case it turns out to be the wrong one, even though the correct one is in the results.

Irritatingly, running the same search terms on the apple music website, I can see from their internal search response that they get the correct result at the top of the list…
So somehow, their API responses to third parties are biased in some way in order to return some other result they are pushing.

I have tried or will try a couple of things to improves the situation:

  • Remove the album title from the search terms (this helped in the case of spotify search, and seems to maybe help here too). This fixes the second example “En Trance”, where the album name was “Sobredosis de amor y salsa” which resulted in only various matches for the song “Sobredosis” by the same band. Makes sense considering the search terms.

  • Add another layer of processing the API response to see if any of the search results’ name matches the search term better. This is for your first example “La Clave”, where removing the album title did not fix the issue, and the expected song came in only as the third result. Doing a quick check to see if any of the results matches the expected song title could help in many cases.

2 Likes

are any of these improvements allready done? because i still notice a bunch of incorrect plays when selecting some files (if you play the album “come on and feel the love” from the band “the love” some songs have a totally different artist)

They are indeed in place already, thanks for reporting more issues, I will take a look.

if you test with ListenBrainz
only the following songs are correct:

  • donna
  • fool
  • hot fun
  • daily grind

all the other songs are totally random artists

here is the link to the album in apple music

1 Like

Thanks for the extra details!

The Apple Music search API is terrible.
Here are the results for the query terms “I’ve Got Love The Love”

Kendrick Lamar - LOVE. (feat. Zacari)
Kendrick Lamar - LOVE. (FEAT. ZACARI.)
Kendrick Lamar - i
Mos Def - Love
Jhené Aiko - LOVE

And here are the results for “Donna The Love”:

Donna Summer - I Feel Love
Donna Lewis - I Love You Always Forever
Lewis Capaldi - Someone You Loved
The Lumineers - Donna
Ozuna, Doja Cat & Sia - Del Mar

With the recent changes I added, the fourth result is selected as the song title is the closest to our search term (an exact match in this case).

I would add that for those same search terms, searching on the Apple Music website does not end up any better:

I see two more potential avenues of improvement:

  1. see if there are ways to improve the search terms, for example specifying that “Donna” is the song title and “The Love” is the artist name. This is possible in other music APIs like Spotify, but I haven’t found documentation for that for apple music. I’ll keep digging that subject.
  2. instead of getting the default 5 top results, get a lot more results and do some deeper comparison with song title and artist name to try to find a better match (don’t match “Donna” by “The Lumineers” if we are looking for a song by “The Love”). This could potentially lead to worse results in other cases so will have to be careful about it.
1 Like

could it help if the url to the album in apple music is in MB? can you then search for the song if you already have the album?

2 Likes

Yes, that would be ideal. We don’t currently have that set up (fetching that particular info from MB) but it is planned.
Searching by ISRC is also available on some music services, and could be very useful for this use case.

1 Like

Unfortunately, there is no way I could find to specify what part of the search terms are song title vs. artist name, or to search for exact matches, or any other way to improve the search results. :rage:

So the Apple music API will search using every word of the search term, and return what it thinks are the top results (i.e. the most popular). You can imagine that there are many results where either the song title or album name or artist name contains “I’ve” or “Got” or “Love”… This is why there are so many unrelated results. Wrapping terms in quotes (like you would in Google) to search only for “I’ve Got Love” (rather than “I’ve” or “Got” or “Love”) also changes nothing.

Apparently, people’s solution is to use Google to search for “Apple Music song name artist name” and click the first result…
Needless to say, not exactly an ideal solution for playing music in LB.

1 Like

and is it maybe possible to only look for the artist and then look deeper for the songs of that artist?

On their website, or for a single track, that wouldn’t be a problem.
But with an API and the arbitrary data we have on LB, that means:

  • One API call to search for the artist + find the right artist in those search results
  • One API call to get the albums for that artist
  • One API call per album to get its tracks, then check if any of the tracks matches the one we are looking for
  • In the case of The Love with 20 albums that’s a potential 22 API calls just to play a single song

That can potentially be a lot of API calls for each song you are trying to play, with additional associated problems of resource consumption, API rate-limiting and quotas, all of that without even the assurance that you found the right artist in the first step
The result would be an extremely wasteful and slow website and a user experience most likely on par with the current one (considering we still need to use the same :poop: search API)

3 Likes

maybe you should try to look for the next song while te previous one is playing. as long as it doesn’t take longer than the length oof the song it won’t be an issue. only the first song will take a longer time before it starts…

Something I can definitely think about, thanks for the suggestions!
We could potentially consider that if playing from an album page, instead of searching for each track separately we could search for the album instead and, as you say, pre-load some of the information we will need to play following tracks.

1 Like

i think you can also do that with playlist. i don’t see a shuffle or a way of chaning the order. if you load the upcomming 10 songs then i guess you are always safe, event if you skip a file.