How does Spotify codes work if the design is so simple?

602 views

If you don’t know what I’m talking about it’s this [here](https://community.spotify.com/t5/Subscriptions/QR-Codes-for-tattoo/td-p/4693922) People can draw them on paper and they still work. They seem to work well and are very simplistic. And there are over 50 millions songs on Spotify, and infinite playlists. How does this work?

In: Technology

3 Answers

Anonymous 0 Comments

This is the patent: https://data.epo.org/publication-server/rest/v1.0/publication-dates/20190220/patents/EP3444755NWA1/document.pdf.

From the patent, here’s basically what happens. There are identifying marks in the code that let the software figure out the relative size of each bar. The tallest bar is in the middle, and the leftmost and rightmost bar are the shortest. Then, the other bars are ranked from 0 to 7 on how tall they are in relation to the references.

It seems like Spotify is using 23 bars as standard, but the patent notes these can be arbitrarily large. Currently, that leaves us with 8^20 different combinations. A parsed code looks like: 53526254731226474112

This is actually tiny when dealing with URLs. For example, that is not enough to encode the URL “https://www.reddit.com/r/explainlikeimfive/comments/irpfly/eli5_how_does_spotify_codes_work_if_the_design_is/”. The patent refers to using a random number or index counter that is associated on the server with the code. Essentially, this means that somewhere, there is a massive table that contains all the codes generated and links them to what they are supposed to refer you to.

Note: This sounds really inefficient because there’s a table running out there with at least 50 million code-song pairs, and more likely billions because of profiles, playlists, etc. In actuality, there are very efficient ways of dealing with this problem, and while billions sounds like a lot, on an enterprise scale, it’s minuscule.

You are viewing 1 out of 3 answers, click here to view all answers.