As stated damp smell usually means damp.
If a filthy carpet is not cleaned totally, ie remove all the dirt, its the wet dirt that gives off the bad smell, so once dry the wet dirt no longer smells. You can be on a losing battle if the carpet is filthy, so i would recommended masking the smell with a strong de-ordorizer. Hopefully by the time the de-oirdorizer has stopped working the carpet is dry and the smell has gone.
You get the same problem with flooded carpets. If you have clean water, people always mention the carpet will start to smell. Well sorry clean water does not smell its the dirt in the carpet which is now activated by the water that smells.