AlgoViz

Design a music streaming service like Spotify

hard 50 min

Any of 100 million songs starts within a fifth of a second, keeps playing on a bad network, follows the listener from phone to speaker, and is counted once so that artists are paid.

Where it shows up

The same pattern appears across everyday software.

  • Four music qualities

    Spotify's help page lists about 24, 96, 160 and 320 kbit/s plus lossless, and an automatic setting that depends on the network.

  • Thirty seconds

    Spotify for Artists says a stream is counted when somebody plays a song for at least 30 seconds. Counting rules decide payments, so they belong in the requirements.

  • Shared royalty pool

    Spotify explains that a rightsholder's part follows its share of all streams in a month. A fake play takes money from everybody else.

  • Online once in 30 days

    Spotify lets Premium members download up to 10,000 tracks on each of up to 5 devices, and asks them to go online at least once every 30 days, partly to collect play data.

  • Playlist snapshots

    Spotify's Web API gives every playlist change a snapshot id, so a client can say which version its change refers to.

  • Nearest neighbours

    Spotify's engineers published Annoy and later Voyager, libraries that find nearby vectors for personalization and search.

  • Volume without re-encoding

    Spotify measures loudness at upload and applies a gain at playback, aiming at -14 LUFS, without changing the track.