These tools classify your Apple Music library by the actual playback format (as reported by macOS/Music logs) and create Apple Music playlists per Sample Rate (SR) and Bit Depth (BD). They also save a timestamped CSV for analysis.
| File | Purpose |
|---|---|
probe_from_logs.py |
Parses unified logs (Music/coreaudiod) to extract sample rate, bit depth, codec, tier, bitrate, etc. |
playlist_by_format.sh |
Plays each track briefly, probes logs, appends to CSV, and assigns into SR/BD/Codec/Tier playlists. |
now_playing_title.py |
Non-invasive now-playing title/artist/album probe via AppleScript (no playback control). |
- macOS with the built-in Music app.
- Python 3 (pre-installed on macOS 12+).
- Full Disk Access for your terminal/app (to read unified logs)
(System Settings ▸ Privacy & Security ▸ Full Disk Access). - Automation permission for Music
(System Settings ▸ Privacy & Security ▸ Automation).
-
Make scripts executable
chmod +x playlist_by_format.sh probe_from_logs.py now_playing_title.py
-
Run a small test (first 5 tracks, 2s settle)
LIMIT_N=5 ./playlist_by_format.sh "" 2 # Output goes to output/<YYYYMMDD-HHMMSS>-Library/results.csv
-
Scan a specific playlist (25 tracks, 3s settle)
LIMIT_N=25 ./playlist_by_format.sh "My Playlist" 3
-
A timestamped directory in
output/:results.csvcolumns:source,track,artist,album,device_bit_depth,sample_rate_hz,bitrate_kbps,lpcm_kbps,channels,codec,tier
failures.csv(if any):source,track,artist,album,persistent_id,reason
-
Generated playlist artifacts per SR+BD combination:
- CSV at
output/<stamp>-<source>/results-organized/<name>.csv(deduped by persistent_id) - Apple Music playlist XML at
output/<stamp>-<source>/playlists-xml/<name>.xml(import via Music: File → Library → Import Playlist…) - Example names:
BD 24-bit + SR 48kHz,BD 24-bit + SR 96kHz,BD 16-bit + SR 44.1kHz, …
- CSV at
- Logs must be readable; grant Full Disk Access and re-run your terminal/app.
- For true rate switching, use a device/path that actually changes clock (e.g., USB DAC as clock source with an Aggregate/Multi-Output device; BlackHole for capture).
- This does not modify your library content; it only creates/updates organizational playlists.
- Single-instance lock: the runner will auto-terminate any existing run by default (
KILL_EXISTING=1).
Override by settingKILL_EXISTING=0if you prefer to abort when another run is active. - Other useful environment variables:
LIMIT_N: cap number of tracksPLAY_START_MAX_SECS(default 10): per-track deadline to ensure the intended PID is playingPROBE_MAX_SECS(default 15): per-track probe deadline (logs stream)POST_CAPTURE_SECS(default 1): brief extra window to fill codec/tier/channels