The best thing to do is to dry the carpet under the sunlight. You need to do it first, and then you need to clean the carpet with the deep cleaning procedure before you deodorize it with your preferred deodorizing agent. Deodorize the area that has a musty smell if the causes of the smell are mold and mildew.