In grade school you may have played with two magnets and learned they have a south and north pole. The same poles repulse each other and opposite poles attract each other. In fact, there is no magnet without both poles, so often scientists call a magnet a "magnetic dipole." Learn the ways magnets work in speakers and why they are needed inside.
How Speakers Work
All sounds are made by pushing air around in waves. An audio speaker is a mechanism for turning electrical waves into physical waves so that air can be moved. Electricity and magnetism are connected forces. In fact, winding up wires over and over again into a coil can make an electromagnet as long as some current is flowing inside. The speaker operates on the principle of how a permanent magnet will attract and repel an electromagnet.
A permanent magnet is attached to a frame inside the speaker. The electromagnet is fitted inside the permanent magnet, and is also attached to the diaphragm. The diaphragm is the part of the speaker that pushes air, and often looks like a cone.
When the alternating electrical current flows through the coil inside the permanent magnet, it is alternately attracted and repelled, causing it to move, and push the diaphragm. The frequencies at which the coil moves are equivalent to the frequencies at which the diaphragm is moved, and equal to the frequencies we hear. Higher current through the coil results in larger movements and louder sounds; likewise, lower currents result in hushed sounds. Higher frequencies cause higher pitch, whereas lower frequencies cause lower pitch.
Effect of Other Magnets Nearby
Recall science class when iron filings are dropped onto a piece of white paper over a magnet. The filings trace lines of magnetic force. If another magnet is pushed nearby, it changes the lines of force. Hence, a powerful magnet near your speaker is going to distort the lines of force and distort the sound. Keep your magnet away and the speaker should be fine, unless you are keeping very powerful magnets around the house.