After months of esp8266 experimentation, I “just” discovered this little chip has also a I2S Audio digital interface. To discover it you must install the Arduino IDE adapter and code directly in C++ (brr, ok not a breeze but not boring like Java :)
I2S is a digital protocol to send your digital music to a DAC decoder. Esp8266 has a 16bit DAC.
The ESP8266Audio library is a very powerful and dynamic library. You can play a lot of file formats.
The clever part of this library is you need not a DAC circuit: the library come with a delta-sigma DAC emulator, to use a simple transistor to power an analog speaker.
A delta-sigma DAC encodes a high-resolution digital input signal into a lower-resolution but higher sample-frequency signal that is mapped to voltages, and then smoothed with an analog filter. In both cases, the temporary use of a lower-resolution signal simplifies circuit design and improves efficiency.
(From Wikipedia)
I just joined this library with the makeEspArduino Makefile, to get a fast compilation cycle.
This because Arduino compilation slow down a lot with this library (it seems to need a huge set of libraries).
Anyway, a very good library you should give a try!
References