The invention relates to the technical field of sound production, and discloses a sound generator. The sound generator comprises a shell with a mounting cavity, and a diaphragm mechanism arranged in the mounting cavity, wherein the diaphragm mechanism divides the mounting cavity into a first cavity and a second cavity side by side, characterized in that the sound generator further comprises a limiting component, an electromagnetic component and a magnetic generating component, wherein the limiting component is made of a soft magnetic material, the limiting component is provided with a closed cavity, one side of the closed cavity facing towards the diaphragm mechanism is provided with an opening, and the opening is bent from outside to inside to form a shrinkage opening; the electromagneticcomponent is located in a second cavity and mounted in the closed cavity, and is used for generating an electromagnetic field and transmitting the electromagnetic field to the limiting component; andthe magnetic generating component is fixed on the diaphragm mechanism, extends into the shrinking opening, and is used for providing a fixed magnetic field. According to the scheme of the invention,the electromagnetic field is limited in the closed cavity of the limiting component, the magnetic leakage is not easy to occur, the acting force between the magnetic fields can be enhanced, and thus the output efficiency and sound of audios can be improved.