#include <Arduino.h>
#include <WiFi.h>
#include "AudioFileSourceICYStream.h"
#include "AudioFileSourceBuffer.h"
#include "AudioGeneratorMP3.h"
#include "AudioOutputI2S.h"
// Credential of the local WiFi
//const char* ssid = "xxxxxxxxxxxxxxx";
//const char* password = "xxxxxxxxxxxxxxx";
const char* ssid = "Wokwi-GUEST";
const char* password = "";
// URL of internet radio station
const char *URL = "http://streaming.radio.rtl.fr:80/rtl-1-44-64?listen=webCwsBCggNCQgLDQUGBAcGBg"; // NON PASSE PAS
//const char *URL = "https://icecast.rtl.fr/rtl-1-44-128"; // NON PASSE PAS
//const char *URL = "http://streaming.radio.rtl.fr/rtl-1-44-128"; // NON PASSE PAS
//const char *URL = "http://streams.rsa-sachsen.de/80erhits/mp3-192/streams.rsa-sachsen.de"; //ok rfm allemagne
//const char *URL = "http://cdn.nrjaudio.fm/adwz2/fr/30601/mp3_128.mp3?origine=fluxradios"; //ok nostalgie
AudioGeneratorMP3 *mp3;
AudioFileSourceICYStream *file;
AudioFileSourceBuffer *buff;
AudioOutputI2S *out;
void setup()
{
WiFi.disconnect();
WiFi.softAPdisconnect(true);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
file = new AudioFileSourceICYStream(URL);
buff = new AudioFileSourceBuffer(file, 2048);
out = new AudioOutputI2S(0, 1); // use the internal DAC channel 1 (pin25) on ESP32
mp3 = new AudioGeneratorMP3();
mp3->begin(buff, out);
}
void loop()
{
if (mp3->isRunning()) {
if (!mp3->loop()) {
mp3->stop();
}
} else {
delay(1000);
}
}
Loading
esp32-c3-devkitm-1
esp32-c3-devkitm-1