What I set out to build.
RateAlign is a native Windows audio utility written in Rust. It follows the track playing in Apple Music, resolves its reported sample rate and bit depth from several available sources, and attempts to align a selected Windows playback endpoint with that format. The project combines media-session monitoring, external metadata lookups, local playback telemetry, device capability checks, and a Win32 interface rather than placing a web frontend inside a desktop shell.
The problem
A playlist can move between tracks with different audio formats while Windows keeps one endpoint configuration. Changing that configuration manually interrupts listening, but automating it also requires handling incomplete track metadata, delayed telemetry, unsupported device formats, and playback transitions. Track identification and output configuration therefore need to be treated as separate parts of the problem.
The approach
A background coordinator combines SMTC media-session information with Apple catalog lookups, local ETW traces, and downloaded package manifests where available. The audio layer checks endpoint support before applying a format through Windows audio configuration APIs. The interface presents the reported source format, current output format, and coordinator state so the listener can distinguish an exact format match from an intentional bit-depth difference or a device limitation.
What it does
- Track, artist, album, artwork, and playback-state monitoring through Windows SMTC.
- Format resolution using Apple catalog data, local ETW playback telemetry, and available downloaded manifests.
- Seamless mode follows sample rate with a 24-bit output target; Purist mode follows both reported rate and depth.
- Selected-endpoint targeting or default-output behavior, with supported-format validation and fallback.
- Main and compact mini views, tray controls, configurable settling delay, and always-on-top preferences.
- JSON preferences, catalog caching, portable storage, and an attempt to restore captured endpoint formats on normal exit.
Reported formats are metadata and telemetry, not independent PCM measurements. Format matching does not guarantee bit-perfect or exclusive output, and switching may pause and resume playback.
A closer look.

How it works.
From track change to output update
The coordinator monitors the active media session and resolves the track’s reported format using the available metadata and telemetry. It then validates a suitable format for the selected endpoint and attempts the configuration change. Switching can temporarily pause and resume Apple Music; the application is coordinating playback and device settings rather than decoding or re-encoding the track itself.
Keeping native rendering separate from background work
Rust modules separate media-session access, catalog resolution, ETW reading, endpoint enumeration, format application, and presentation. A worker thread performs monitoring and switching, while the Windows message loop owns the interface. Shared coordinator snapshots let the UI display status without placing catalog requests inside paint handlers.
Compact mode and device limits
Mini mode reuses the same window, coordinator, metadata controls, and artwork. Returning to the main view restores the previous bounds and always-on-top preference. DPI-aware layout and width-aware text truncation handle the compact presentation.
A displayed source format is metadata or telemetry, not an independent measurement of decoded PCM. Endpoint matching does not establish exclusive output or bit-perfect playback, and the driver still determines which formats can be applied.
What each layer does.
Native application
- Rust with Win32 controls and GDI/GDI+ rendering
- Windows media-session APIs (SMTC)
- Core Audio endpoint access and Windows policy configuration
Resolution and persistence
- Apple catalog requests through ureq
- Local ETW trace conversion through tracerpt
- Serde/JSON preferences and cached catalog results
- Inno Setup for Windows installer packaging