Musty smell is mould, spray an anti microbial on it, moisture has feed it also water is a carrier of molecules.
It works like this, tiny droplets rise into the air as carpet dries, raising the humidity in the room, these water particules will carry molecules which are what we smell.
So smell will go when drying process finished.
But you have feed the mould so it will have multiplied and will smell worse with each clean, unless sanitized.
This is why drying carpets ASAP is important, get it dry!