Necessary and sufficient conditions are presented for a measure to be the spectral measure of a finite range perturbation of a
Jacobi or CMV operator from a finite gap isospectral torus. The special case of eventually periodic
operators solves an open problem of Simon
[28, D.2.7].
We also solve the inverse resonance problem: it is shown that an operator is completely determined by the set of its eigenvalues and resonances, and we provide necessary and sufficient conditions on their configuration for such an operator to exist.