Sometimes these types of errors are just a small oversight. Plugging your mic into the right port on your sound card can sometimes be confusing or easily mistaken when you're in a rush. Most analog mic connections are pink and belong in the corresponding pink connector on your sound device. Some devices aren't color coded, and that's when it is time to consult the manual for your sound device to be absolutely sure your mic is plugged into the right port. Checking this problem first may save you hours of troubleshooting.
Try swapping ports. If you're using a USB port on the front of your case, switch it to one of the ones in the back. If you're using a USB hub, try bypassing the hub and see if that makes any difference. You may be able to track down the issue a lot faster this way.
This applies to both your mic (if you're using a USB one) and your sound device. Sound device drivers are crucial, especially if you are running Windows Vista. Check the manufacturer of your sound device (such as Realtek, Creative, SigmaTel, etc) and visit their website for driver updates. If you're not sure where to find this information, check your motherboard's manual (for on-board sound) and/or consult the manufacturer of your PC.
So, you've made sure that your mic is correctly connected, properly configured in Windows and it has passed the device test. The next thing to look at is the mic settings in-game. Below is an example of the configuration menu:
You can also check to see if you can hear your mic is working by selecting the "Test Microphone" option on the panel (expect echoes if you don't have earphones!)
If it works, go ahead and test it in-game. Make sure you have your voice key correctly bound by checking Options > Keyboard > Use voice communication.
If it isn't working in-game, then the issue is probably that the mic input is being switched when you launch the game.
One last thing to keep in mind is that the Server can control if your mic is allowed to work at all, as well as what codec and sound quality is used. If you have everything configured properly and your mic still doesn't seem to work in-game, always try several different servers to make sure it isn't just a Server issue.
Note: Your microphone will not work while you are in Spectator mode.
Bad voice quality can stem from a few different causes. Below are some examples of situations where the quality is affecting the voice chat in-game:
Normally feedback will occur if you have your speakers cranked while using the mic. It is recommended that you use a headset with earphones so that your communication is clear to other players. Certain low-grade microphones are omni-directional, meaning they will pick up sounds from all directions - including your stereo/surround speakers. Turn your audio devices down and see if your voice quality improves.
Certain microphones need a boost. This can be configured by checking the Windows mic settings.
Many times bad voice quality is due to a faulty cable or a bad connection. Check the connection of your mic to your PC. If the connection is loose, it may be the reason why your voice quality is not clear. If you experience the same issue in other applications, you may want to consider getting a different mic to test with. Inexpensive, low-grade mics have often times been shunned on quality to keep the price low.
Also, make sure the mic is not too close to your mouth. If it is touching your face or lips as you use it, put it away so that it is about 1" away from your mouth. If there's no windscreen on the mic itself, try moving it even further away.