A new nonlinear circuit with frequency locking capability in the case of a generic quasi-periodic input, is presented. Due to this capability the circuit is called a Quasi-Periodic Locked Loop (Q-PLL). The locked frequency is parametrically selected from among those prescribed by the theory of resonances in dynamical systems. In particular, the locked frequency forms a three-frequency resonance with the frequencies of the quasi-periodic input. The circuit is able to lock also in case of deterministic perturbation (additional frequency components) and stochastic perturbation (wide-band noise). The circuit is closely related to the pitch perception of complex sound in humans and, as such, can be considered a bio-inspired device. From the point of view of applications, it may be considered as an extension of the Phase Locked Loop (PLL) with the additional ability of locking simultaneously to more than one frequency. Due to the dynamical and structural robustness of the locked states, the Q-PLL represents a tangible advance for the development of specific applications, for example, in medicine (hearing aids, and cochlear implants), in robotics (artificial senses), and in industrial and consumer electronics (improvement of speech intelligibility, pitch-based processing, etc.).<br>