I have to amplify a microphone signal to be in the range -2.5 to +2.5V. It is currently providing a signal that has a peak amplitudes of around 2V. This, however, is highly dependent on the situation (how close you hold the microphone to your mouth etc.). I need to be able to variably amplify it somehow to make the signal be in the required range. Is there a method of achieving this? I have read a bit about automatic gain control. Do you think this is the way to go?
You need to rectify and filter the output, to get a DC signal that varies with the output level. A single-stage amplifier is often used before the rectifier. The DC signal is used to provide feedback to a gain control element at the amplifier input. Something like a FET is often used, with the feedback signal amplified by an op amp. The feedback has to be negative, of course. The system will need some tuning, to avoid problems with the gain rising when there are quiet periods, so that the first syllable of the next word comes out at high volume, before the AGC kicks in.
AGC is the way to go...
Low frequency automatic gain control (AGC) circuits are used in audio and power equipment for applications such as sensitive microphone preamplifiers (preamps) and regulators. An AGC circuit, a closed-loop feedback system, is shown in Figure 1. The loop consists of a controllable gain element, a detector, a stable reference and a comparison circuit.
Fast and simple: Microphone AGC amplifier
Datasheets can be a good source of information on a topic (even if you don't use the product specified). From Maxim...
The MAX9814 is a low-cost, high-quality microphone amplifier with automatic gain control (AGC) and lownoise microphone bias.
AGC can also be implemented in software: dsPIC DSC Automatic Gain Control Library
Your instinct about automatic gain control (AGC) is correct. AGC is also sometimes known as 'compression' in the audio world. Essentially it is a variable gain amplifier, that conditions a signal to keep its overall level within some desired range.
A signal that varies in intensity a lot is said to have a lot of 'dynamic range', which is often considered desirable when listening to music. However, broadcasters prefer to have a more level power output, and will typically compress the audio so that the modulated power output stays more constant. You'll also encounter AGC in shortwave radios, where atmospheric conditions can cause signal intensities of distant stations to fluctuate wildly.