earlephilhower / ESP8266Audio

Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
GNU General Public License v3.0
2.01k stars 432 forks source link

ESP32-S2, Internal DAC, not working #551

Open TheMechanos opened 2 years ago

TheMechanos commented 2 years ago

Hey, I try to play a .wav file from SPIFFS on internal DAC on ESP32-S2.

  #include "AudioGeneratorWAV.h"
  #include "AudioOutputI2SNoDAC.h"
  #include <AudioOutputNull.h>
  #include <AudioOutputI2S.h>
  #include <AudioFileSourceSPIFFS.h>

  AudioGeneratorWAV *wav;
  AudioFileSourceSPIFFS *file;
  AudioOutputI2S *out;

  void setup() {
    Serial.begin(115200);

    if (!SPIFFS.begin(true)) {
        Serial.println("An Error has occurred while mounting SPIFFS");
        return;
    } else {
        Serial.println("SPIFFS Ok!");
    }

    audioLogger = &Serial;
    file = new AudioFileSourceSPIFFS("/test.wav");
    out = new AudioOutputI2S(0,1);
    wav = new AudioGeneratorWAV();
    wav->begin(file, out);
  }

And I have a error: AudioGeneratorWAV::begin: output's begin did not return true

I think it's a problem with the dac implementation in ESP32-S2. After many changes, I was unable to start this.

Someone knows how to solve it?

GerLech commented 2 years ago

I had the same problem, and solved it by going back to ESP32 Version 1.0.6

FedericoBusero commented 1 year ago

To get sound out of ESP32-S2

include "AudioOutputI2SNoDAC.h"

define I2S_SPEAKER_SERIAL_CLOCK GPIO_NUM_4 // BCLK

define I2S_SPEAKER_LEFT_RIGHT_CLOCK GPIO_NUM_5 // WSEL

define I2S_SPEAKER_SERIAL_DATA GPIO_NUM_17

AudioOutputI2SNoDAC *out; ... out = new AudioOutputI2SNoDAC(); out -> SetPinout(I2S_SPEAKER_SERIAL_CLOCK, I2S_SPEAKER_LEFT_RIGHT_CLOCK, I2S_SPEAKER_SERIAL_DATA);