Building a decent microphone amplifier
How to faithfully amplify far-field microphone signals without overcomplicating your life.
If you’re coming here from Google search, this article is a part of a loose series on electronics. If you have a hard time keeping up with the text, start with my earlier articles on core concepts in electronics and on signal amplification.
About two months ago on this blog, I discussed the design of an audio playback toy. The circuit included a simple microphone amplifier; its run-of-the-mill design worked fine for recording near-field speech with reasonable fidelity, but it was nothing to write home about.
In today’s article, let’s do better. The goal is to build high-fidelity microphone circuit capable of faithfully picking up nature sounds, live music performances, or conversations happening across the room. This task is trickier than it appears, because as with eyesight, we’re unaware of the staggering dynamic range of our hearing. The speech of a person standing eight feet away can easily result in microphone readings 20-50x weaker than if they were standing next to you. In an electronic circuit, the resulting faint signals are easily drowned out by all kinds of electrical noise.
Familiar techniques such as microphone arrays, parabolic reflectors, and sophisticated digital processing might help work around some of the signal issues — but a good microphone and a well-designed amplifier is usually the best starting point.
Understanding microphone sensitivity
Let’s start with a seemingly simple question: how do we measure sound intensity? The usual answer is “in decibels”, but decibels are not units; they’re just awkwardly-spaced divisions on a logarithmic (log10) scale. In plain English, a change of +/- 1 dB tells us that the power delivered by something has changed by a (mildly oddball) factor of 1.26; it doesn’t tell us anything about the nature of the measured phenomenon, and it doesn’t explain the scale’s zero point.
For sound, the actual measurement is the pressure of the acoustic wave hitting your ears; the unit for this is the pascal (a tiny SI unit equal to ~0.000145 psi). Further, on that scale, “zero decibels” doesn’t correspond to perfect silence, but to a 1 kHz acoustic wave that exerts 20 μPa of pressure. This value was chosen because it’s roughly the threshold of human hearing. From that origin point, we then derive two different decibel-based sound scales: dB SPL, which measures nominal sound pressure with no regard to frequency; and dBA, which is frequency-weighted to approximate human hearing — i.e., it tapers off sharply below 200 Hz and above 10 kHz.
It would be too logical if the performance of microphones was characterized at the threshold of hearing. Instead, it’s done at another arbitrary point, with a sound wave about 50,000 times stronger — equal to 94 dB, or 1 Pa at 1 kHz. This is roughly comparable to operating a gas-powered lawnmower or standing next to a busy highway. A theoretical microphone that exhibits 1 volt (RMS) output swing under such conditions would be described at having 0 dBV sensitivity (yep, that’s a third distinct decibel-denominated scale). In practice, cheap electret capsule microphones will not get anywhere near that number; a common sensitivity figure is -45 dBV, translating to a lawnmower-induced voltage swing of about 6 mV.
Rock concerts and construction sites aside, most sounds we’d want to capture are not as loud; normal indoor voice is around 40-50 dBA, whisper is about 30 dBA, and ambient nature sounds hover in the vicinity of 20 dBA. In other words, in many applications, microphone output might be firmly into microvolts — and if we start with a low-quality mic, no amount of amplification is going to make things right. To illustrate the issue, I captured the following demo clip:
To understand what sets these microphones apart, we can look at a parameter known as equivalent input noise (EIN): it’s the loudness of a hypothetical noise source that, if placed next to a flawless mic, would produce the same amount of hiss as present in the actual device in question. In other words, EIN represents the microphone’s noise floor; sounds quieter than that will be more or less drowned out.
The EIN value is not always given in the datasheet, but it can be derived from the more reliably disclosed signal-to-noise (SNR) figure. SNR is the headroom between the aforementioned 94 dBA (“lawnmower”) reference point and the noise floor. The conversion is straightforward: EIN = 94 dBA - SNR.
Circling back to the demonstration: after the reference capture, the first microphone used in the recording is CUI CMA-6542PF — a $0.50 capsule with an SNR of 60 dBA (EIN = 34 dBA). It is essentially what you end up with if you buy a generic electret mic on the internet. The second capsule — PUI Audio AOM-5024L-HD-R — is an identically-looking part that retails for $3.50 and has an SNR of 80 dBA (EIN = 14 dBA).
It should be evident that if you’re designing a headset or an intercom, the first microphone is an eminently reasonable choice; but in far-field applications, a high-SNR mic makes a dramatic difference — and you should spend an extra buck or two instead of trying to fix the problems in post.
Selecting a suitable op-amp
In hi-fi audio applications, microphone amplification is almost always accomplished with an operational amplifier; the devices offer a good blend of linearity, adjustable gain, predictable frequency response, low part count, and low cost.
Compared to choosing a microphone, the choice of an op-amp is not nearly as consequential. The bulk of the noise in the circuit will be coming from the microphone; almost the entire remainder is the thermal noise of the feedback resistor that’s used to set gain, plus radio frequency interference (RFI) is the circuit isn’t shielded well. As for the amplifier, as long as you stay away from outdated or patently unsuitable designs, there should be no audible difference between a high-end model that features 3 nV/√Hz noise and 0.00005% total harmonic distortion; or a lower-tier one that barely manages 10 nV/√Hz and 0.001% THD+N (don’t worry about the jargon — I’m just making a point). Such parameters matter mostly when evaluating the cumulative effect of every single amplifier on the way from the recording studio to the consumer. It doesn’t make sense to deliberately pick a terrible chip, but it also isn’t necessary to overpay for audiophile-grade ICs.
As explained in an earlier article on op-amps, unity gain bandwidth of the device is an important constraint: although audible frequencies extend only to 20 kHz or so, the bandwidth of an op-amp must be derated proportionally to the desired amplification. We’ll go over the exact formula a bit later; for now, a good rule of thumb is to aim for at least 10 MHz for a single-stage design. Less bandwidth is OK if you’re using multiple amplification stages with lower gains, or if you’re not interested in higher frequencies (e.g., when processing voice commands in a home automation device).
The remaining considerations — supply voltage, output current capacity, rail-to-rail output, or slew rate — are fairly standard and should be chosen with a specific application in mind. The output of about 50 mA should be sufficient for most headphones; about a milliamp is enough to drive “line in” signals for portable audio recorders and desktop PCs.
For most of the schematics in this article, I’m using OPA1656 — a rather impressive amplifier package available from Texas Instruments. That said, I selected the chip not just because of its excellent noise or bandwidth specs, but because of its reasonable cost (about $1.25 per op-amp). Other sensible choices in the same ballpark are MAX4232, OPA2322, and OPA2323.
First draft of circuit architecture
A good number of hobby microphone amplifier circuits published on the internet are needlessly complicated, often because of their reliance on antiquated parts and outmoded design paradigms. If the microphone can be placed physically close to the amplifier, the simplest design is a single-supply, single-ended transimpedance amplifier (TIA) — a circuit that essentially converts the current flowing through the microphone directly to output voltage:
The electret microphone can be thought of a sound-controlled current-modulating device: it consists of an electrically-charged diaphragm connected to the gate of a field effect transistor, so its impedance varies in response to sound waves. In this circuit, the current flowing through the microphone can be sourced through the 4.7 kΩ resistor; but alternating currents can also easily flow through the 2.2 µF leg. That capacitor blocks DC, but presents a low impedance for AC.
In a steady state, the op-amp reaches an equilibrium near Vout = Vin- = Vin+ = Vdd / 2. Transient changes in FET conductivity upset this equilibrium, inducing momentary currents through the 2.2 µF capacitor and throwing the voltage on the inverting leg of the op-amp out of whack. When that happens, the output of the op-amp swings in the opposite direction — and to restore balance, it needs to swing far enough for the current through the feedback resistor (Rf) to match the current flowing through the input capacitor. In effect, the circuit functions as a current-to-voltage amplifier, with its gain equal to the value of Rf (in ohms).
Transimpedance bandwidth
In the earlier article on signal amplification, we talked about voltage-to-voltage amplifiers. In such circuits, closed-loop signal amplification is achieved by deliberately reducing the amplitude of the output signal as it’s looped back onto the IC’s negative input pin. This has the side effect of attenuating all the microscopic voltage nudges that piggyback on Vout and are a part of the feedback control mechanism. A bit counterintuitively, these nudges are the only thing that gets amplified; reducing their magnitude has the same effect as reducing the chip’s internal gain — and eventually, you reduce it below 1.
Transimpedance amplifiers are different; at low frequencies, the configured gain is theoretically free. If the input leg is connected to a pure current sink, then once a sufficient current is flowing through Rf, there is nothing to further attenuate the control nudges in the feedback loop. It doesn’t matter if Rf is 10 kΩ or 1 MΩ: voltages can get through.
In practice, the resistor has a bit of capacitance of its own (in the femtofarad range); but more importantly, a larger shunt capacitance is almost always found on the input pin. Even if it’s just 10 pF, the parasitic capacitor becomes a low-impedance path at a sufficiently high sine-wave frequency. At that point, it starts reducing voltages in the feedback loop — and just like in the voltage-to-voltage case, it causes the amplifier to eventually run out of internal gain.
In other words, the bandwidth of TIAs is still derated proportionally to the configured amplification ratio, but the formula for the maximum cutoff frequency is different. Further, transimpedance circuits generally hold a pretty robust speed advantage over their voltage-to-voltage peers:
In this equation, fGBP is the op-amp’s gain bandwidth product pulled from the spec, and Cin is the parallel (shunt) capacitance on the input, including op-amp parasitics. In an electret microphone circuit, input capacitances are usually tiny, so an op-amp with a GBP of 10 MHz should provide more than 100 kHz of usable bandwidth even with Rf values approaching 1 MΩ.
Improving the design
This basic circuit works, but has some limitations. Perhaps the most significant issue is its tendency to amplify supply power ripple and RFI artifacts present at the high-impedance Vin+ leg. The interference becomes more pronounced when higher resistor values are used for the voltage divider to conserve power in battery applications; 100 kΩ would be a lot worse than 10 kΩ. Either way, these issues can be mitigated by adding a decoupling capacitor on the non-inverting leg to “buffer” the voltage and make it less jittery.
Radio interference can also be picked up by microphone leads and PCB traces, and there is some wideband thermal noise coming from the feedback resistor (Rf). The bulk of the energy of these signals is outside audible frequencies, but it can manifest as hiss or squeals due to various corner-case nonlinearities in the circuit. The simplest solution is to add a lowpass capacitor in parallel with the feedback resistor, selectively reducing high-frequency gain. The dampening afforded by the capacitor also lessens the likelihood of ringing due to Cin — although in this particular circuit, the input capacitance is going to be very small.
The maximum feedback capacitor value that allows a given fpass frequency to be amplified without significant attenuation is given by the following formula:
In our circuit, around 2 to 20 pF is usually a good starting point, depending on the value of Rf. Capacitances approaching 100-300 pF will have a fairly pronounced lowpass effect, making the audio muffled. It’s essentially akin to setting “treble” to the lowest possible value on an audio rig, or listening with a cardboard box over your head. A sensible choice for speech — which doesn’t extend much beyond 4 kHz — but maybe not for Mozart or Bach.
The final tweak is the inclusion of a relatively small resistor on the output leg; somewhere around 47 to 100 Ω should be fine in most uses. The resistor limits peak op-amp current, and thus reduces the distortion of the feedback signal when the circuit is hooked up to capacitive or inductive loads:
Further improvements are possible; for example, multi-stage lowpass filters with sharp cutoff, such as MAX291, can be used to further reduce microphone hiss without affecting lower frequencies as much as a beefier feedback capacitor would.
Some microphone circuits also feature an optional highpass filter with a cutoff somewhere around 100-150 Hz. This hurts sound fidelity, but also cuts down on rumbling wind noise in outdoor environments. (Although it should be said that “dead kitten” synthetic fur sleeves placed over the microphone perform better than electronic filtering.)
Ouch! My ears!
With R1 around 470 kΩ and with a high-SNR microphone, the circuit pictured above gives its wielder superhuman hearing: the device can pick up conversations and footsteps in other rooms, and will greatly amplify the sound of your own breathing or body movements; with a parabolic reflector, the results can be even more impressive. On the flip side, the setup is far too easily overdriven by normal sounds; merely tapping your workbench will result in a deafening crack.
The simplest solution to this problem is to replace the feedback resistor with a potentiometer; an adjustment range of about 10 kΩ to 500 kΩ should be enough for most needs. This manual method of gain control works well and is preferred in pro audio, but it can be cumbersome if sound levels keep fluctuating over time. Just as importantly, the approach offers no protection against unanticipated loud noises if you’re monitoring live audio on your headphones. I don’t recommend this, but if you want to give headphones a try, be very careful — or be prepared for pain.
A more sophisticated solution is automatic gain control (AGC): a method for monitoring the amplitude of the output signal and then swiftly adjusting the resistance to keep the audio within the desired range. The monitoring part is fairly straightforward; one approach might be:
Whenever the input signal reaches a positive peak, the capacitor is charged through an input resistor and a Schottky diode, causing output voltage to rise; in the absence of peaks higher than the capacitor’s current voltage, the charge is slowly dissipated via the comparatively larger resistor on the right. Resistances and capacitances can be chosen to balance the circuit’s response time.
The second part of an AGC circuit — a voltage-controlled resistor — is a tad trickier to build. Some of the early solutions relied on a lightbulb or an LED placed next to a photoresistor. Another straightforward method was to use a field effect transistor — but you generally needed another op-amp to implement feedback and maintain some semblance of linearity.
Nowadays, analog techniques have largely fallen out of favor: it’s more common to employ an ADC-equipped microcontroller to continually sample the output signal, detect overload conditions based on software-defined criteria, and then talk to a device such as MCP4131 — a $0.90 SPI-controlled digital potentiometer that offers a range of 128 resistance settings. In addition to other benefits, the design also permits seamless switching between automatic and manual gain, or customizing the response to different types of noises.
A slightly simplified architecture of a digipot-based AGC could be as follows:
For readability, I omitted the supply voltages and decoupling caps for the three chips, as well as the microphone supply bits and the positive-leg voltage divider for OPA2322.
In the new design, the first half of the op-amp IC provides fixed (and comparatively modest) current-to-voltage amplification ratio for the electret microphone, while the second half implements a variable-gain voltage amplifier controlled by the MCU. Lowpass capacitors are proportionately larger due to lower feedback resistances involved at each stage.
An assembled version of this circuit, featuring an affordable AVR64DD32 microcontroller, is shown below:
Source code for this project and PCB files for manufacturing can be found here.
The number of parts could be reduced further. For example, there are programmable gain op-amps (PGAs) that combine digipots and amplifiers in a single package. Heck, the latest crop of AVR DB series MCUs packs a pair of PGAs directly on the MCU die — although their specs don’t seem good enough for hi-fi use.
Hol’ up… why did you switch to OPA2322?
Good catch! For the first couple of schematics in this article, I relied on OPA1656 — an excellent, low-cost amplifier designed for hi-fi audio. For the final AGC circuit, I replaced it with its close (and pin-compatible) relative, OPA2322 (now superseded by OPA2323). What gives?
Well, it boils down to an obscure design feature of the OPA1656. Similarly to some other low-noise op-amps, the IC features a pair of protection diodes placed across its input pins, as shown in this drawing from Texas Instruments:
Under normal circumstances, the use of a negative feedback loop in an op-amp circuit ensures that both input voltages track each other very closely. But at start-up — or perhaps if you bump the microphone real hard — it’s possible for the difference to briefly jump above the roughly 600 mV needed to make one of the protection diodes conduct.
In the single-amplifier design introduced earlier in the article, this transient, low-current short shouldn’t cause any headaches. But in the proposed two-stage AGC circuit, more serious problems can arise. A brief current flowing between the inputs of the stage 2 amplifier can backfeed into stage 1 by pulling the shared, relatively high-impedance Vdd / 2 line up or down. When this happens, the output of stage 1 abruptly shifts in the same direction, widening the voltage difference present on stage 2 inputs and creating a positive feedback loop.
There are ways to fix this problem without ditching OPA1656. The path of least resistance is to have separate Vdd / 2 voltage dividers for each amp. But then, I spotted the issue only after designing the PCB — and using a readily-available IC without this gotcha is an equally valid choice.
If you liked this article, please subscribe! Unlike most other social media, Substack is not a walled garden and not an addictive doomscrolling experience. It’s just a way to stay in touch with the writers you like.
For a thematic catalog of other articles on this site, click here.
By the way, the demo song is "All The Magic" by Karliene: https://karliene.com/track/2083873/all-the-magic
Greetings! I wish to kindly ask for your help about some component-codes for the jack connector, that you used on this project, also for the on/off switch, I try to replicate your design , I cannot find a way to hear my voice better, when singing at home, without complicating things for no reason.. And finally - can you please advice, how can I add a volume potentiometer, like - replacing the feedback resistor in the first opamp stage, or directly to the output..? Thank you for your generosity to share this project