UPDATED: Flush Apple Music Cache Files v2.0
For macOS 10.15 and later. Apple Music stores the audio files it plays in ~/Library/Caches/com.apple.Music/SubscriptionPlayCache/. This script will simply delete that folder.
The files in this folder are specially protected audio files that are downloaded and cached when you play a track from Apple Music on your Mac. They can't be user-played and are only useful to Apple Music, ostensibly so they needn't be re-downloaded if they are played again. (This cache folder doesn't pertain to Radio music. Or to Apple Music you've added to your library for offline listening, the files of which are stored in your "Media" folder.)
Latest version:
- Accommodations for macOS 10.15 Catalina and the Music app
- Performance and security enhancements
More information for Flush Apple Music Cache Files v2.0 and download link is here.