What is the function of the two resistors (R4 and R5) and two diodes (D1 and D2) in the circuit below?
The diodes keep the bases of the transistors 1.4V apart. This reduces crossover distortion. The resistors are to provide a bias current for the diodes.
So the diodes keep the transistors "close" to being on. If they weren't there, as the input voltage went between ~0.7 and ~-0.7V the transistors would be in cutoff and the output voltage would be zero. This causes the output to have distortion around the zero crossing. Keeping them biased on like this is called class AB operation.
Feedback can be useful to help minimize distortion, but class AB operation helps as well. Another technique often used is a Vbe multiplier instead of the two diodes. The Vbe multiplier allows more control over how much bias you are providing the output transistors. (Google it for more info.)
Often the diodes are mounted on the same heatsink as the transistors (or sometimes in the same package as the transistors) in order to track the change in forward voltage/Vbe with temperature.
This question took me back to my university years when I was unsuccessfully trying to figure out how AC voltage passed through a 4-diode bridge analog switch. As far as I can remember, I thought at the time that AC voltage could pass in both directions through a forward-biased diode. Here and now I wondered how the AC input voltage passes through the diodes to reach the transistor bases, and that prompted me to write this answer.
How to understand AC diode circuits
I have long realized that, in order to intuitively understand circuits, in addition to the picture of voltages, it is very important to trace the actual paths of currents. For AC diode circuits, it is enough to do it for three values of the input voltage - zero, positive and negative peak. Let's then explore it using three separate (for each of the input voltages) conceptual circuits.
In this dual bias circuit, the property of forward-biased diodes to shift voltage changes is used. A string of two diodes is "stretched" by two (pull-up and pull-down) resistors between the supply rails (think of the two resistors as two "springs" and the two diodes as rigid "rods"). The input voltage is applied in the midpoint but can also be applied to some of the endpoints. Diodes are always forward-biased and the current through the input source is added to one diode or the other. Let's see how.
Exploring the circuit
In the CircuitLab experiments below, the transistor base-emitter junctions are represented by voltmeters. The input source is flipped horizontally to obtain a symmetrical circuit diagram with non-intersecting wires.
In these conceptual circuits, I have used "ideal" diodes with 1 V forward voltage. For simplicity, the values of the device parameters are multiples of 10.
Zero input voltage
In this initial state, the circuit is completely symmetrical with respect to the zero voltage level (ground); so the same current flows through the power supply and the R1-D1-D2-R2 network. The two bias voltages Vb1 and Vb2 are equal with opposite polarity.
Positive input voltage
When Vin increases (eg to 1 V), it "moves up" the two diode voltage drops. The input source passes its current through the forward-biased D2 and R2 thus adding it to the network current. Thus, all three voltage sources in the circuit produce currents in the same direction. The two bias voltages Vb1 and Vb2 shift up with 1 V.
Negative input voltage
When Vin decreases (eg to -1 V), it draws its current from the forward-biased D1 and R1 thus subtracting it from the network current. The two bias voltages Vb1 and Vb2 shift down with 1 V.
AC input voltage
Let's finally explore the bias circuit at AC input voltage.
As you can see, the two bias voltages are "shifted (up and down) copies" of the original input voltage.
A disadvantage of this R-D bias circuit is that the current through the diodes varies (more so the higher the input voltage). The reason is that the voltage across the resistors varies. The worst happens when the input voltage approaches the supply rails; then the respective voltage and current start to drop. But if we replace the “static” resistors But if we replace them with current-stabilizing dynamic resistors ("current sources") that change their resistance in the same direction of the input voltage, the current will remain constant.
Conceptual resistor circuit
It is interesting that the diodes are also dynamic but voltage stabilizing resistors. So this network of four dynamic resistors acts as a non-linear voltage divider. Let's see how this happens in the same three steps as above.
Vin = 0 V: I have adjusted the resistances so that the voltage drops across them and the currents through them are equivalent to those in Schematic 1.
Vin = 1 V: The overall voltage across RI1-RD1 decreases by 1 V and across RD2-RI2 increases by 1 V. The resistors seem to "come alive": RI1 decreases to increase the current and RD1 increases to increase the voltage across itself; RI2 increases to decrease the current and RD2 decreases to decrease the voltage across itself. As a result, the voltage drops and currents are equivalent to those in Schematic 2.
Vin = -1 V: Now the overall voltage across RI2-RD2 decreases by 1 V and across RI1-RD1 increases by 1 V. RI2 decreases to increase the current and RD2 increases to increase the voltage across itself; RI1 increases to decrease the current and RD1 decreases to decrease the voltage across itself. As a result, the voltage drops and currents are equivalent to those in Schematic 3.
Then let's replace them with these commonly accepted notations while still not forgetting that they are not real sources producing power.
Real transistor circuit
In amplifier circuits, they are implemented by transistors with constant base-emitter voltage V1 (V2). As you can see, I have (carefully) adjusted them to obtain the same currents as above.