The aim of the project describes approaches to building circuits amplifiers for microphones and speakers in microcontroller technology. One day I wanted to use a real-time speech synthesizer based on a libraryhttps://github.com/earlephilhower/ESP8266AudioThe author of the library library port suggests connecting a speaker using a single transistor 'Use the AudioOutputI2SNoDAC object instead of the AudioOutputI2S in your code, and the following schematic to drive a 2-3W speaker using a single $0.05 NPN 2N3904 transistor'
That's exactly what I did. But it turned out that the transistor is heating because The cascade operates in class A. The voltage regulator is 300 mA. Compared with an amplifier of class AB, B or C. I had to look for different options
Details
One of the series of board with Transistor Amplifiers for DAC and Electret Microphone