Page 1 of 2

【Feedback】I2S sound output and MP3 decoding in an ESP8266

Posted: Fri Jun 05, 2015 6:49 pm
by ESP_Sprite
As you all may know, the specsheet for the ESP8266 describes the chip as having an I2S port, which is a port to which you can connect an I2S DAC to get sound in and out of the chip. Unfortunately, up until now no documentation or examples about this port were available. We're working on these documents and examples right now, and I have taken the preliminary documentation and with the help of some colleagues here at Espressif have whipped up a little demonstration which uses HTTP to stream an MP3 stream (eg. webradio) to an I2S DAC. It basically is a standalone webradio streamer, everything (WiFi, HTTP streaming, MP3 decoding) happens inside the ESP8266. The only components you need to get good audio quality are an I2S audio DAC for audio output and a 23LC1024 SPI RAM chip for buffering of the MP3 stream. If bad quality audio and stuttering is acceptable, there even is a mode where you can stream audio without these two components: using only an ESP module (in theory, an ESP01 would work), a power supply and an amplifier/speaker you can get reasonable quality sound.

The code is at the official Espressif Github: https://github.com/espressif/esp8266_mp3_decoder
Be sure to read the README.md in the archive, configuration and use of the decoder can be a bit tricky.

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Sun Jun 07, 2015 12:34 pm
by rudi
ggggggrrrrrrreeeeeáaaaaaaaaattttt!!!!

sprite!
ESP8266 goes MP3 (320 Kb)
DONE!
;-)
you did it again. ( 2:1 )
;-) perfect - no problems - test without the 2 ICS - hear with in ear phone'S and
it runs perfect!

i hear just in time in 320 kb/s streaming mp3 "summerbeat 2013" from simpy test IIS7 server.

my extended favorit tip:

run mediaserver (media encoder...) - stream audio ( voice, or other src ) over media server and you will have the babyphone ( wifi speaker ) with ESP8266 mp3

;-)

"10K thanks button"
txs! great work - sprite clear code - fine struct -
and espressif - fine documented - nice!!!
now its time for next surprise ...

best wishes
rudi ;-)

btw ;-)

welcome to espressif team!

;-)

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Mon Jun 15, 2015 6:22 am
by mikewen
This is awesome!!! Thanks!

Do you know how to use I2S input device such as MEMS microphone?

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Tue Jun 16, 2015 9:47 pm
by Roie
What do you mean?

if my understanding is current, the MEMS Microphone get a clock and push data over I2S

btw,
i also try to loop every 20ms I2SRXFIFO, but still not working
data = (uint8)(READ_PERI_REG(I2SRXFIFO)&0xff);

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Sat Jan 02, 2016 1:03 am
by rojer
thanks for this, a very useful example!

i have question regarding bit/word clock generation: i am considering ESP8266 for an application which does both output (to a speaker) and input (from a microphone). i see that bit and word clock lines on ESP are separate, but the DAC/ADC i am considering uses the same BCK/WS for input and output. so the question is: (1) does ESP generate I2S clock only when there is data to output? and (2) can it use its own clock for I2S input, preferably without physically connecting I2SI_{BCK,WS} to their I2SO counterparts (to free up pins for other functions)?

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Wed Jun 29, 2016 2:43 am
by micke_s
Hi Sprite_tm. Great work.

Is it possible to upgrade to newest SDK?
The new SDK use less ram so it will be nice to use it i think...

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Thu Jun 30, 2016 11:54 am
by ESP_Greg
You can try with the latest SDK. Some guy already make it work.

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Thu Jul 28, 2016 4:09 am
by ozzoxy
I get it from github. However i am not able to load it to esp8266. How can i do it? Could you explain it openly please ESP_Sprite.

Best regards

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Thu Jul 28, 2016 7:59 pm
by ESP_Rubin
hello,
please refer to the README as link:https://github.com/espressif/ESP8266_MP3_DECODER/blob/master/README.md

Re: I2S sound output and MP3 decoding in an ESP8266

Posted: Fri Jul 29, 2016 1:23 am
by ozzoxy
Many many thanks ESP_Rubin,

I have gotten some questions,

In the README file I get some information

Configuration options, building

All high-level options can be configured in mp3/user/playerconfig.h. Edit that file to set up your access point and a webradio stream or other source of MP3 data served over HTTP.

1. I have *.h editor like Pic C Complier And also i can edit this file taking knowledge in the playerconfig.h explanation

To build the code, try running make.sh in the mp3/ directory. Alternatively, the way to use 'make' to build this code is: make COMPILE=gcc BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE=1024

2. How can i run make.sh to generate .bin files as eagle.flash.bin eagle.irom0text.bin. i mean are there any compier for windows.

After that i have to flash esp8266 with these .bin files. What kind of program should i use. Could you give me a name? to success.

I have bought VS1003
http://www.aliexpress.com/item/Free-Shipping-5PCS-23LC1024-I-SN-23LC1024-SRAM-1MBIT-SDI-SQI-20-MHZ-SOP8/32653345044.html?spm=2114.13010608.0.74.xrvjXB
and 23LC1024 ram
http://www.aliexpress.com/item/Free-Shipping-5PCS-23LC1024-I-SN-23LC1024-SRAM-1MBIT-SDI-SQI-20-MHZ-SOP8/32653345044.html?spm=2114.13010608.0.74.xrvjXB

3. These components can be run with this project.


Best regards.