Google first debuted a feature called 'Now Playing' with the Pixel 2 and 2 XL, which listened for music being played around you and matched it with a locally-stored database (it doesn't send a continuous stream of audio to servers for matching). The Pixel 4 was announced today, and among its many upgrades include changes to Now Playing.

Now Playing should match far more songs than before, thanks to "federated analytics." Here's how a support page explains it:

The counts of songs recognized across Pixel 4 phones are aggregated using a privacy-preserving technology called federated analytics. This improves Now Playing's song database so it recognizes what’s playing more often. Google can never see what songs you listen to, just the most popular songs in different regions.

Since Now Playing relies on a locally-cached database of songs, which can fill up internal storage, Google only keeps patterns of current popular songs. Starting with the Pixel 4, the feature might be able to recognize more niche songs. There's no word on if these improvements will come to previous models, but I would assume not.

Source: Google Support