Loudspeakers produce nonlinear distortion. The authors present a method to compensate for this distortion in real time by nonlinear digital signal processing implemented on a digital signal processor (i.e., the TMS320C30 DSP). Based on the literature, an electrical equivalent circuit of an electrodynamic loudspeaker is developed, resulting in a linear lumped parameter model. The parameters in this model are matched with the measurements of a selected test loudspeaker. The linear model is extended to include nonlinear effects by developing the parameters as a function of the voice coil excursion of the loudspeaker in a Taylor series expansion. The resulting nonlinear system is described by a Volterra series. On the basis of this description, an inverse circuit is designed for the second-order nonlinear distortion. This circuit was implemented in real time on the DSP, using a high-level design and code generation system. Simulations and experiments are presented.<>