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.05k stars 435 forks source link

Buffer underflow #438

Open podaen opened 3 years ago

podaen commented 3 years ago

I have an esp32 wroom with an external dac like this

2021-10-13_000307

I am able to play the link with reasonble quality. The problem start with this log: STATUS(buffer) '3' = 'Buffer underflow' I don't know how to solve this problem. Please any help would be appreciated.

#include <WiFi.h>
#include <WiFiServer.h>
#include <FS.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>
#include "SPIFFS.h"
#include <SD.h>
#include <SPI.h>
#include "AudioFileSourceHTTPStream.h"
#include "AudioFileSourceBuffer.h"
#include "AudioGeneratorMP3.h"
#include <WiFi.h>
#include <WiFiServer.h>
#include <FS.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>
#include "SPIFFS.h"
#include <SD.h>
#include <SPI.h>
#include "AudioFileSourceHTTPStream.h"
#include "AudioFileSourceBuffer.h"
#include "AudioGeneratorMP3.h"
#include "AudioOutputI2S.h"
// Enter your WiFi setup here:
#ifndef STASSID
#define STASSID "my_ssid"
#define STAPSK  "passkey"
#endif
const char* ssid = STASSID;
const char* password = STAPSK;
AudioGeneratorMP3* mp3 = nullptr;
AudioFileSourceHTTPStream* file = nullptr;
AudioFileSourceBuffer* buff = nullptr;
AudioOutputI2S* out = nullptr;
const char* URL= "http://kvbstreams.dyndns.org:8000/wkvi-am";
// Called when a metadata event occurs (i.e. an ID3 tag, an ICY block, etc.
void MDCallback(void* cbData, const char* type, bool isUnicode, const char* string)
{
    const char* ptr = reinterpret_cast<const char*>(cbData);
    (void)isUnicode; // Punt this ball for now
    // Note that the type and string may be in PROGMEM, so copy them to RAM for printf
    char s1[32], s2[64];
    strncpy_P(s1, type, sizeof(s1));
    s1[sizeof(s1) - 1] = 0;
    strncpy_P(s2, string, sizeof(s2));
    s2[sizeof(s2) - 1] = 0;
    Serial.printf("METADATA(%s) '%s' = '%s'\n", ptr, s1, s2);
    Serial.flush();
}
// Called when there's a warning or error (like a buffer underflow or decode hiccup)
void StatusCallback(void* cbData, int code, const char* string)
{
    const char* ptr = reinterpret_cast<const char*>(cbData);
    // Note that the string may be in PROGMEM, so copy it to RAM for printf
    char s1[64];
    strncpy_P(s1, string, sizeof(s1));
    s1[sizeof(s1) - 1] = 0;
    Serial.printf("STATUS(%s) '%d' = '%s'\n", ptr, code, s1);
    Serial.flush();
}
// the setup function runs once when you press reset or power the board
void setup() {
    Serial.begin(115200);
    delay(1000);
    Serial.println("Connecting to WiFi");
    WiFi.disconnect();
    WiFi.softAPdisconnect(true);
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid, password);
    // Try forever
    while (WiFi.status() != WL_CONNECTED) {
        Serial.println("...Connecting to WiFi");
        delay(1000);
    }
    Serial.println("Connected");
    //String MyString = "";//limited to 100 characters
    //  MyString = "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&tl=en&q=";
    ////MyString += "Your%2C+Text%2C+Here";//manual play
    //MyString += "Your%2CText%2CHere%21";//auto play
    //URL = MyString.c_str();
    //URL = "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&tl=en&q=Your%2CText%2CHere%21";
    audioLogger = &Serial;
    file = new AudioFileSourceHTTPStream(URL);
    buff = new AudioFileSourceBuffer(file, 4096);//2048//1024//4096//512
    buff->RegisterStatusCB(StatusCallback, (void*)"buffer");
    out = new AudioOutputI2S();
    mp3 = new AudioGeneratorMP3();
    mp3->RegisterStatusCB(StatusCallback, (void*)"mp3");
    mp3->begin(buff, out);
}
// the loop function runs over and over again until power down or reset
void loop() {
    static int lastms = 0;
    if (mp3->isRunning()) {
        //Serial.println("running");
        if (millis() - lastms > 1000) {
            lastms = millis();
            Serial.printf("Running for %d ms...\n", lastms);
            Serial.flush();
        }
        //Serial.println("here it stops working");
        if (!mp3->loop()) {
            Serial.println("stop");
            mp3->stop();
        }
        else {
        }
    }
    else {
        Serial.printf("MP3 done\n");
        delay(1000);
    }
}

log your example

Opening port Port open �Connecting to WiFi ...Connecting to WiFi ...Connecting to WiFi ...Connecting to WiFi Connected +0 0x3ffb1ed8 Running for 8926 ms... STATUS(buffer) '2' = 'Refilling buffer' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2701' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2701' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2701' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2701' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 3719' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4120' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4121' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4122' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4123' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4124' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4125' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4126' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4127' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4128' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4129' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4130' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4131' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4132' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4133' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4134' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4135' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4136' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4137' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4138' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4139' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4140' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4141' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4142' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4143' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4144' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4145' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4146' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4147' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4148' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4149' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4150' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4151' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4152' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4153' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4154' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4155' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4156' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4157' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4158' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4159' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4160' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4161' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4162' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4163' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4164' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4165' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4166' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4167' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4168' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4169' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4170' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4171' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4172' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4173' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4174' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4175' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4176' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4177' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4178' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4179' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4180' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4181' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4182' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4183' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4184' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4185' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4186' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4187' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4188' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4189' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4190' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4191' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4192' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4193' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4194' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4195' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4196' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4197' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4198' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4199' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4200' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4201' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4202' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4203' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4204' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4205' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4206' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4207' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4208' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4209' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4210' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4211' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4212' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4213' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4214' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4215' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4216' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4217' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4218' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4219' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4220' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4221' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4222' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4223' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4224' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4225' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4226' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4227' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4228' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4229' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4230' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4231' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4232' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4233' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4234' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4235' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4236' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4237' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4238' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4239' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4240' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4241' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4242' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4243' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4244' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4245' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4246' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4247' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4248' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4249' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4250' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4251' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4252' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4253' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4254' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4255' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4256' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4257' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4258' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4259' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4260' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4261' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4262' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4263' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4264' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4265' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4266' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4267' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4268' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4269' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4270' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4271' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4272' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4273' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4274' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4275' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4276' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4277' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4278' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4279' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4280' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4281' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4282' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4283' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4284' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4285' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4286' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4287' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 4288' STATUS(mp3) '565' = 'Decoding error 'bad main_data_begin pointer' at byte offset 428' STATUS(mp3) '565' = 'Decoding error 'bad main_data_begin pointer' at byte offset 449' STATUS(mp3) '565' = 'Decoding error 'bad main_data_begin pointer' at byte offset 470' Running for 10800 ms... Running for 11801 ms... Running for 12802 ms... Running for 13803 ms... Running for 14804 ms... Running for 15805 ms... Running for 16806 ms... Running for 17807 ms... Running for 18808 ms... Running for 19809 ms... Running for 20810 ms... Running for 21811 ms... Running for 22812 ms... Running for 23813 ms... Running for 24816 ms... Running for 25817 ms... Running for 26818 ms... Running for 27820 ms... Running for 28821 ms... Running for 29822 ms... Running for 30825 ms... Running for 31826 ms... Running for 32827 ms... Running for 33829 ms... Running for 34830 ms... Running for 35831 ms... Running for 36832 ms... Running for 37833 ms... Running for 38834 ms... Running for 39835 ms... Running for 40836 ms... Running for 41837 ms... Running for 42838 ms... Running for 43839 ms... Running for 44840 ms... Running for 45841 ms... Running for 46842 ms... Running for 47843 ms... Running for 48844 ms... Running for 49845 ms... Running for 50846 ms... Running for 51847 ms... Running for 52854 ms... Running for 53855 ms... Running for 54856 ms... Running for 55857 ms... Running for 56858 ms... Running for 57859 ms... Running for 58860 ms... Running for 59861 ms... Running for 60862 ms... Running for 61863 ms... Running for 62864 ms... Running for 63865 ms... Running for 64872 ms... Running for 65873 ms... Running for 66874 ms... Running for 67875 ms... Running for 68876 ms... Running for 69877 ms... Running for 70878 ms... Running for 71879 ms... Running for 72880 ms... Running for 73882 ms... Running for 74883 ms... Running for 75884 ms... STATUS(buffer) '3' = 'Buffer underflow' Running for 77103 ms... STATUS(buffer) '2' = 'Refilling buffer' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537730' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537731' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537732' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537733' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537734' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537735' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537736' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537737' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537738' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537739' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537740' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537741' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537742' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537743' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537744' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537745' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537746' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537747' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537748' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537749' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537750' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537751' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537752' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537753' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537754' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537755' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537756' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537757' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537758' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537759' STATUS(mp3) '259' = 'Decoding error 'forbidden bitrate value' at byte offset 537760' STATUS(mp3) '260' = 'Decoding error 'reserved sample frequency value' at byte offset' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537762' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537763' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537764' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537765' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537766' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537767' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537768' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537769' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537770' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537771' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537772' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537773' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537774' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537775' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537776' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537777' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537778' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537779' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537780' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537781' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537782' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537783' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537784' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537785' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537786' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537787' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537788' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537789' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537790' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537791' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537792' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537793' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537794' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537795' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537796' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537797' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537798' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537799' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537800' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537801' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537802' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537803' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537804' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537805' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537806' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537807' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537808' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537809' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537810' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537811' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 537812' STATUS(mp3) '565' = 'Decoding error 'bad main_data_begin pointer' at byte offset 537' STATUS(mp3) '565' = 'Decoding error 'bad main_data_begin pointer' at byte offset 538' Running for 78156 ms... Running for 79157 ms... Running for 80158 ms... Running for 81159 ms... Running for 82160 ms... Running for 83161 ms... Running for 84162 ms... Running for 85163 ms... Running for 86164 ms... Running for 87165 ms... Running for 88166 ms... Running for 89167 ms... Running for 90168 ms... Running for 91169 ms... Running for 92172 ms... Running for 93173 ms... Running for 94174 ms... Running for 95180 ms... Running for 96181 ms... Running for 97182 ms... Running for 98183 ms... Running for 99184 ms... Running for 100185 ms... Running for 101186 ms... Running for 102187 ms... Running for 103188 ms... Running for 104190 ms... Running for 105191 ms... Running for 106192 ms... Running for 107195 ms... STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(mp3) '1' = 'Decoding error 'input buffer too small (or EOF)' at byte offset' MP3:ERROR_BUFLEN 0 STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' stop MP3 done MP3 done MP3 done MP3 done MP3 done MP3 done MP3 done MP3 done MP3 done

Conculsion: radio stops playing and stops emmiditly

log of TTS

Opening port Port open �Connecting to WiFi ...Connecting to WiFi ...Connecting to WiFi ...Connecting to WiFi Connected +0 0x3ffb1ec8 Running for 8356 ms... STATUS(buffer) '2' = 'Refilling buffer' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2048' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2049' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2050' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2051' STATUS(mp3) '257' = 'Decoding error 'lost synchronization' at byte offset 2052' Running for 9358 ms... Running for 10359 ms... STATUS(buffer) '3' = 'Buffer underflow' Running for 248806 ms... STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' STATUS(mp3) '1' = 'Decoding error 'input buffer too small (or EOF)' at byte offset' MP3:ERROR_BUFLEN 0 STATUS(buffer) '2' = 'Refilling buffer' STATUS(buffer) '3' = 'Buffer underflow' stop MP3 done MP3 done

Conculsion: code stops running here "if (!mp3->loop()) {" and after minutes it returns running.

podaen commented 3 years ago

I toke a piek at...

Readme

And reduced the sample rate like this

out->SetRate(22050);//44100

The example is running more stable now in my first test. Mybe it has something to do with with my custom partition table of spiffs. I don't know.

Name,   Type, SubType, Offset,  Size, Flags

nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x1E0000, app1, app, ota_1, 0x1F0000,0x1E0000, eeprom, data, 0x99, 0x3D0000,0x1000, spiffs, data, spiffs, 0x3D1000,0x2F000,

For the TTS, it plays now but it still keeps being in the loop. When I enable the debug level too debug, I get this log.

[ 12395][D][HTTPClient.cpp:385] disconnect(): tcp keep open for reuse

After a while I get

[248395][D][HTTPClient.cpp:385] disconnect(): tcp keep open for reuse [248895][D][WiFiClient.cpp:528] connected(): Disconnected: RES: 0, ERR: 128 [248895][D][HTTPClient.cpp:400] disconnect(): tcp is closed

[248896][D][HTTPClient.cpp:400] disconnect(): tcp is closed

STATUS(buffer) '3' = 'Buffer underflow' [248912][D][HTTPClient.cpp:400] disconnect(): tcp is closed

[248917][D][HTTPClient.cpp:400] disconnect(): tcp is closed

Running for 248917 ms... STATUS(buffer) '2' = 'Refilling buffer' [248933][D][HTTPClient.cpp:400] disconnect(): tcp is closed

[248934][D][HTTPClient.cpp:400] disconnect(): tcp is closed

STATUS(buffer) '3' = 'Buffer underflow' [248948][D][HTTPClient.cpp:400] disconnect(): tcp is closed

[248953][D][HTTPClient.cpp:400] disconnect(): tcp is closed

STATUS(buffer) '2' = 'Refilling buffer' [248963][D][HTTPClient.cpp:400] disconnect(): tcp is closed

... STATUS(buffer) '3' = 'Buffer underflow' [249337][D][HTTPClient.cpp:400] disconnect(): tcp is closed

[249342][D][HTTPClient.cpp:400] disconnect(): tcp is closed

STATUS(buffer) '2' = 'Refilling buffer' [249351][D][HTTPClient.cpp:400] disconnect(): tcp is closed

[249352][D][HTTPClient.cpp:400] disconnect(): tcp is closed

STATUS(buffer) '3' = 'Buffer underflow' [249366][D][HTTPClient.cpp:400] disconnect(): tcp is closed

STATUS(mp3) '1' = 'Decoding error 'input buffer too small (or EOF)' at byte offset' MP3:ERROR_BUFLEN 0 STATUS(buffer) '2' = 'Refilling buffer' [249384][D][HTTPClient.cpp:400] disconnect(): tcp is closed

[249384][D][HTTPClient.cpp:400] disconnect(): tcp is closed

STATUS(buffer) '3' = 'Buffer underflow' [249399][D][HTTPClient.cpp:400] disconnect(): tcp is closed

stop [249399][D][HTTPClient.cpp:400] disconnect(): tcp is closed

MP3 done

It toke only 1 second to stop after the tcp was closed. But this is going no where. Mybe if I could detect the state of this play button... A radio doesn't have that issue.

2021-10-20_090948

And now I see the type of audio is mpeg, Could this be the cause?