acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

README.md (3517B)

      1 # ESP32-audioI2S
      2 Plays mp3, m4a and wav files from SD card via I2S with external hardware.
      3 HELIX-mp3 and -aac decoder is included.
      4 Works with MAX98357A (3 Watt amplifier with DAC), connected three lines (DOUT, BLCK, LRC) to I2S.
      5 For stereo are two MAX98357A necessary. AudioI2S works with UDA1334A (Adafruit I2S Stereo Decoder Breakout Board) and PCM5102A.
      6 Other HW may work but not tested. Plays also icy-streams and GoogleTTS. Can be compiled with Arduino IDE. [WIKI](https://github.com/schreibfaul1/ESP32-audioI2S/wiki)
      7 
      8 ```` c++
      9 #include "Arduino.h"
     10 #include "WiFi.h"
     11 #include "Audio.h"
     12 #include "SD.h"
     13 #include "FS.h"
     14 
     15 // Digital I/O used
     16 #define SD_CS          5
     17 #define SPI_MOSI      23
     18 #define SPI_MISO      19
     19 #define SPI_SCK       18
     20 #define I2S_DOUT      25
     21 #define I2S_BCLK      27
     22 #define I2S_LRC       26
     23 
     24 Audio audio;
     25 
     26 String ssid =     "*******";
     27 String password = "*******";
     28 
     29 void setup() {
     30     pinMode(SD_CS, OUTPUT);      digitalWrite(SD_CS, HIGH);
     31     SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
     32     Serial.begin(115200);
     33     SD.begin(SD_CS);
     34     WiFi.disconnect();
     35     WiFi.mode(WIFI_STA);
     36     WiFi.begin(ssid.c_str(), password.c_str());
     37     while (WiFi.status() != WL_CONNECTED) delay(1500);
     38     audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
     39     audio.setVolume(21); // 0...21
     40 
     41 //    audio.connecttoFS(SD, "/320k_test.mp3");
     42 //    audio.connecttohost("http://www.wdr.de/wdrlive/media/einslive.m3u");
     43 //    audio.connecttohost("https://stream.srg-ssr.ch/rsp/aacp_48.asx"); // SWISS POP
     44 //    audio.connecttohost("http://mp3.ffh.de/radioffh/hqlivestream.aac"); //  128k aac
     45       audio.connecttohost("http://mp3.ffh.de/radioffh/hqlivestream.mp3"); //  128k mp3
     46 //    audio.connecttohost("https://github.com/schreibfaul1/ESP32-audioI2S/raw/master/additional_info/Testfiles/sample1.m4a"); // m4a
     47 //    audio.connecttohost("https://github.com/schreibfaul1/ESP32-audioI2S/raw/master/additional_info/Testfiles/test_16bit_stereo.wav"); // wav
     48 //    audio.connecttospeech("Wenn die Hunde schlafen, kann der Wolf gut Schafe stehlen.", "de");
     49 }
     50 
     51 void loop()
     52 {
     53     audio.loop();
     54 }
     55 
     56 // optional
     57 void audio_info(const char *info){
     58     Serial.print("info        "); Serial.println(info);
     59 }
     60 void audio_id3data(const char *info){  //id3 metadata
     61     Serial.print("id3data     ");Serial.println(info);
     62 }
     63 void audio_eof_mp3(const char *info){  //end of file
     64     Serial.print("eof_mp3     ");Serial.println(info);
     65 }
     66 void audio_showstation(const char *info){
     67     Serial.print("station     ");Serial.println(info);
     68 }
     69 void audio_showstreamtitle(const char *info){
     70     Serial.print("streamtitle ");Serial.println(info);
     71 }
     72 void audio_bitrate(const char *info){
     73     Serial.print("bitrate     ");Serial.println(info);
     74 }
     75 void audio_commercial(const char *info){  //duration in sec
     76     Serial.print("commercial  ");Serial.println(info);
     77 }
     78 void audio_icyurl(const char *info){  //homepage
     79     Serial.print("icyurl      ");Serial.println(info);
     80 }
     81 void audio_lasthost(const char *info){  //stream URL played
     82     Serial.print("lasthost    ");Serial.println(info);
     83 }
     84 void audio_eof_speech(const char *info){
     85     Serial.print("eof_speech  ");Serial.println(info);
     86 }
     87 
     88 ````
     89 Breadboard
     90 ![Breadboard](https://github.com/schreibfaul1/ESP32-audioI2S/blob/master/additional_info/Breadboard.jpg)
     91 Wiring
     92 ![Wiring](https://github.com/schreibfaul1/ESP32-audioI2S/blob/master/additional_info/ESP32_I2S_PCM5102A.JPG)
     93 Impulse diagram
     94 ![Impulse diagram](https://github.com/schreibfaul1/ESP32-audioI2S/blob/master/additional_info/Impulsdiagramm.jpg)