Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Song always stops incorrectly #29

Open
timothydillan opened this issue Nov 29, 2022 · 0 comments
Open

Song always stops incorrectly #29

timothydillan opened this issue Nov 29, 2022 · 0 comments

Comments

@timothydillan
Copy link

timothydillan commented Nov 29, 2022

Hi there.

I'd like to ask regarding this issue that I have, every time I try and use the library to play MP3 audio, it doesn't work, and the Song stopped incorrectly! error is always returned.
Here's a debug example.

19:58:01.060 -> ⸮⸮�⸮�⸮⸮⸮�%⸮⸮⸮LA%]A⸮0xee
19:58:01.060 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
19:58:01.060 -> mode:DIO, clock div:1
19:58:01.060 -> load:0x3fff0030,len:1184
19:58:01.145 -> load:0x40078000,len:12804
19:58:01.145 -> ho 0 tail 12 room 4
19:58:01.145 -> load:0x40080400,len:3032
19:58:01.145 -> entry 0x400805e4
19:58:09.247 -> DEBUG:        Connect to new host: "http://icecast.radiofrance.fr/francemusique-midfi.mp3"
19:58:11.271 -> DEBUG:        Song stopped incorrectly!
19:58:11.271 -> DEBUG:        after song stopped incorrectly
19:58:11.271 -> DEBUG:        REG            dec      bin               hex
19:58:11.271 -> DEBUG:        -----------  -------  ----------------  -------
19:58:11.271 -> DEBUG:        MODE          02056   0000100000001000   0808
19:58:11.271 -> DEBUG:        STATUS        00048   0000000000110000   0030
19:58:11.271 -> DEBUG:        BASS          00000   0000000000000000   0000
19:58:11.309 -> DEBUG:        CLOCKF        24576   0110000000000000   6000
19:58:11.309 -> DEBUG:        DECODE_TIME   00000   0000000000000000   0000
19:58:11.309 -> DEBUG:        AUDATA        44101   1010110001000101   AC45
19:58:11.309 -> DEBUG:        WRAM          00673   0000001010100001   02A0
19:58:11.309 -> DEBUG:        WRAMADDR      07686   0001111000000110   1E06
19:58:11.309 -> DEBUG:        HDAT0         00000   0000000000000000   0000
19:58:11.342 -> DEBUG:        HDAT1         00000   0000000000000000   0000
19:58:11.342 -> DEBUG:        AIADDR        00000   0000000000000000   0000
19:58:11.342 -> DEBUG:        VOL           00257   0000000100000001   0101
19:58:11.342 -> DEBUG:        AICTRL0       00000   0000000000000000   0000
19:58:11.342 -> DEBUG:        AICTRL1       00000   0000000000000000   0000
19:58:11.342 -> DEBUG:        AICTRL2       00000   0000000000000000   0000
19:58:11.342 -> DEBUG:        AICTRL3       00000   0000000000000000   0000
19:58:11.379 -> DEBUG:        PSRAM not found, inputBufferSize: 11903 bytes
19:58:11.884 -> DEBUG:        Connection has been established in 528 ms, free Heap: 249304 bytes
19:58:12.408 -> DEBUG:        chunked data transfer
19:58:12.408 -> BITRATE:      128000kBit/s
19:58:12.408 -> DEBUG:        icy-name: francemusique-midfi.mp3
19:58:12.408 -> STATION:      francemusique-midfi.mp3
19:58:12.408 -> lastURL:      http://icecast.radiofrance.fr/francemusique-midfi.mp3
19:58:12.408 -> DEBUG:        stream ready

I'm not sure why this keeps on happening. I've tried using the latest ESP32 board version, the ESP32 2.0.2 version, and it still gives the same error. I am using the example provided by the library, with the code as follows:

#include "Arduino.h"
#include "WiFi.h"
#include "SPI.h"
//#include "SD.h"
//#include "FS.h"
#include "vs1053_ext.h"

// Digital I/O used
//#define SD_CS        5
#define VS1053_MOSI   23
#define VS1053_MISO   19
#define VS1053_SCK    18
#define VS1053_CS     5
#define VS1053_DCS    21
#define VS1053_DREQ   22

String ssid = "Timothy Dillan’s iPhone";
String password = "***";

int volume=30;

VS1053 mp3(VS1053_CS, VS1053_DCS, VS1053_DREQ, VSPI, VS1053_MOSI, VS1053_MISO, VS1053_SCK);

//The setup function is called once at startup of the sketch
void setup() {
    //pinMode(SD_CS, OUTPUT);      digitalWrite(SD_CS, HIGH);
    Serial.begin(115200);
    SPI.begin(VS1053_SCK, VS1053_MISO, VS1053_MOSI);
    //SD.begin(SD_CS);
    WiFi.disconnect();
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid.c_str(), password.c_str());
    while (WiFi.status() != WL_CONNECTED) delay(1500);
    mp3.begin();
    mp3.setVolume(volume);
    mp3.connecttohost("icecast.radiofrance.fr/francemusique-midfi.mp3");
    //mp3.connecttohost("stream.landeswelle.de/lwt/mp3-192");                 // mp3 192kb/s
    //mp3.connecttohost("http://radio.hear.fi:8000/hear.ogg");                // ogg
    //mp3.connecttohost("tophits.radiomonster.fm/320.mp3");                   // bitrate 320k
    //mp3.connecttohost("http://star.jointil.net/proxy/jrn_beat?mp=/stream"); // chunked data transfer
    //mp3.connecttohost("http://stream.srg-ssr.ch/rsp/aacp_48.asx");          // asx
    //mp3.connecttohost("www.surfmusic.de/m3u/100-5-das-hitradio,4529.m3u");  // m3u
    //mp3.connecttohost("https://raw.githubusercontent.com/schreibfaul1/ESP32-audioI2S/master/additional_info/Testfiles/Pink-Panther.wav"); // webfile
    //mp3.connecttohost("http://stream.revma.ihrhls.com/zc5060/hls.m3u8");    // HLS
    //mp3.connecttohost("https://mirchiplaylive.akamaized.net/hls/live/2036929/MUM/MEETHI_Auto.m3u8"); // HLS transport stream
    //mp3.connecttoFS(SD, "320k_test.mp3"); // SD card, local file
    //mp3.connecttospeech("Wenn die Hunde schlafen, kann der Wolf gut Schafe stehlen.", "de");
}

// The loop function is called in an endless loop
void loop()
{
    mp3.loop();
}

// next code is optional:
void vs1053_info(const char *info) {                // called from vs1053
    Serial.print("DEBUG:        ");
    Serial.println(info);                           // debug infos
}
void vs1053_showstation(const char *info){          // called from vs1053
    Serial.print("STATION:      ");
    Serial.println(info);                           // Show station name
}
void vs1053_showstreamtitle(const char *info){      // called from vs1053
    Serial.print("STREAMTITLE:  ");
    Serial.println(info);                           // Show title
}
void vs1053_showstreaminfo(const char *info){       // called from vs1053
    Serial.print("STREAMINFO:   ");
    Serial.println(info);                           // Show streaminfo
}
void vs1053_eof_mp3(const char *info){              // called from vs1053
    Serial.print("vs1053_eof:   ");
    Serial.print(info);                             // end of mp3 file (filename)
}
void vs1053_bitrate(const char *br){                // called from vs1053
    Serial.print("BITRATE:      ");
    Serial.println(String(br)+"kBit/s");            // bitrate of current stream
}
void vs1053_commercial(const char *info){           // called from vs1053
    Serial.print("ADVERTISING:  ");
    Serial.println(String(info)+"sec");             // info is the duration of advertising
}
void vs1053_icyurl(const char *info){               // called from vs1053
    Serial.print("Homepage:     ");
    Serial.println(info);                           // info contains the URL
}
void vs1053_eof_speech(const char *info){           // called from vs1053
    Serial.print("end of speech:");
    Serial.println(info);
}
void vs1053_lasthost(const char *info){             // really connected URL
    Serial.print("lastURL:      ");
    Serial.println(info);
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant