This note focuses on the direct spectral problem for canonical Hamiltonian systems on the half-line \(\mathbb {R}_+\) . Truncated Toeplitz operators have been effectively used to solve the inverse spectral problem when the spectral measure is a locally finite periodic measure (see [23]). Here, we reverse the inverse problem algorithm to solve the direct spectral problem for step-function Hamiltonians. For a non-step-function Hamiltonian, we consider its step-function approximations and their corresponding spectral measures, and show that these spectral measures converge to the spectral measure of the original Hamiltonian.