Engines get their power from combustion, which is quite noisy, and a lot of that noise finds its way out of the engine through the exhaust. The muffler is designed to reduce the volume of the engine as much as possible, while not reducing the flow of the exhaust gasses. Many conventional mufflers trade off some extra performance for even more sound reduction.
High Performance Mufflers
Mufflers tend to be quite restrictive when it comes to flow, and whenever exhaust flow is slowed down, the engine has to use more of its power to push the exhaust fumes out, and that means less power available to move the vehicle forward. Performance mufflers free up flow to varying degrees. Typically, the less restrictive the muffler is, the louder the result, so the buyer will choose a muffler based on the application. Some exhaust systems use parallel dual mufflers, so the restrictions aren't as much of a hindrance to begin with.
Some racing vehicles eliminate the muffler entirely, and active "muffler bypass" systems are available as well, which allows the driver to choose to dampen the sound by routing exhaust to the mufflers, or closing off that route while opening an immediate exhaust exit. Some degree of muffler bypass systems have found their way on to high performance road vehicles in recent years, with "race" or "track" modes usually being what switches to the muffler-free or minimally-muffled exhaust route. Using this setting on public roads is often illegal, sometimes for the sound level, but other times it may be due to other changes the mode makes to the way the engine runs, altering emissions.
Inside a Muffler by How a Car Works
The sound of the muffled exhaust depends largely on the muffler and engine, but also can be changed by altering the rest of the exhaust before the muffler's location, as well as the exhaust tip. Having a turbo equipped can sometimes muffle the sound as well.
Selecting a Muffler's Sound
Because there are so many variables, it's almost impossible to know exactly what a different style of muffler will sound like on a car unless an example of the same set-up is already available. This makes sound samples on web sites selling performance mufflers an estimation at best in most cases. Sometimes a performance parts store that specializes in a particular make or model may have sound examples that are closer to what you could expect to find on your vehicle, but other modifications to the engine and exhaust will still change the sound, especially when cams, displacement, or any exhaust component is modified or upgraded.