Bonjour,
je suis en train de me faire une web radio (wifi) sur base arduino (carte EPS32 et VS1053).
J'ai trouvé un code de départ et tout le matériel at cela fonctionne... presque.
En effet dans le code trouvé, il y à plusieurs "stations" mais celles-ci ne fonctionnent pas toutes.
Mais ma vraie préoccupation est d'ajouter mes "stations radio".
Je ne comprend pas comment les "ecrire" dans le code. un exemple de station:
https://www.static.rtbf.be/radio/classic21/m3u/wr-classic21-60-mp3.m3u
https://www.static.rtbf.be/radio/classic21/m3u/wr-classic21-60-mp3.pls
ou encore
Dans le meilleur des cas, la carte se connecte mais aucun son n'en sort.
voici le code et merci d'avance pour votre aide.
/*
airspectrum.cdnstream1.com:8114/1648_128 # 1 - Easy Hits Florida 128k Y
109.206.96.34:8100 # 0 - NAXI LOVE RADIO, Belgrade, Serbia
us2.internet-radio.com:8050 # 2 - CLASSIC ROCK MIAMI 256k
airspectrum.cdnstream1.com:8000/1261_192 # 3 - Magic Oldies Florida
airspectrum.cdnstream1.com:8008/1604_128 # 4 - Magic 60s Florida 60s Classic Rock
us1.internet-radio.com:8105 # 5 - Classic Rock Florida - SHE Radio
icecast.omroep.nl:80/radio1-bb-mp3 # 6 - Radio 1, NL
205.164.62.15:10032 # 7 - 1.FM - GAIA, 64k
skonto.ls.lv:8002/mp3 # 8 - Skonto 128k
94.23.66.155:8106 # 9 - *ILR CHILL and GROOVE
"http://wbgo.streamguys.net/wbgo96",
"http://wbgo.streamguys.net/thejazzstream",
"http://stream.srg-ssr.ch/m/rsj/mp3_128",
"http://37.187.79.93:8368/stream2",
"http://icecast.omroep.nl/3fm-sb-mp3",
"http://beatles.purestream.net/beatles.mp3",
"http://listen.181fm.com/181-beatles_128k.mp3",
Connections of the remaining pins of VS1053
XRST = EN (D3)
MISO = D19
MOSI = D23
SCLK = D18
VCC = 5V / 3.3 V
Gnd = Gnd
*/
// This ESP_VS1053_Library
#include <VS1053.h>
#include "helloMp3.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <esp_wifi.h>
char ssid[] = "WiFi-2.4-0AF3"; // your network SSID (name)
char pass[] = "stm17Mum44"; // your network password
// Few Radio Stations
char *host[7] = {"http://www.rtbfradioplayer.be","https://www.static.rtbf.be","https://www.internet-radio.com", "airspectrum.cdnstream1.com","skonto.ls.lv","icecast.omroep.nl","beatles.purestream.net"};
char *path[7] = {"/radio/liveradio/webradio-classic21-60","/radio/classic21/m3u/wr-classic21-60-mp3.pls","/station/douglassinclair/","/mp3 ","/radio1-bb-mp3","/beatles.mp3"};
int port[7] = {80,80,80,80,8002,80,80};
int status = WL_IDLE_STATUS;
WiFiClient client;
uint8_t mp3buff[32]; // vs1053 likes 32 bytes at a time
// Wiring of VS1053 board (SPI connected in a standard way)
#define VS1053_CS 32 //32
#define VS1053_DCS 33 //33
#define VS1053_DREQ 35 //15
#define VOLUME 100 // volume level 0-100
VS1053 player(VS1053_CS, VS1053_DCS, VS1053_DREQ);
int ledPin = 15;
void setup () {
Serial.begin(115200);
delay(500);
// initialize SPI bus;
SPI.begin();
// initialize VS1053 player
player.begin();
//player.switchToMp3Mode(); // optional, some boards require this
player.setVolume(VOLUME);
pinMode (ledPin,OUTPUT);
digitalWrite (ledPin, HIGH);
delay [100];
digitalWrite (ledPin,LOW);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi connected");
player.playChunk(hello2, sizeof(hello2)); //VS1053 is wake up & running
station_connect(6);
}
void loop() {
if (client.available() > 0) {
uint8_t bytesread = client.read(mp3buff, 32);
player.playChunk(mp3buff, bytesread);
}
}
void station_connect (int station_no ) {
if (client.connect(host[station_no],port[station_no]) ){
Serial.println("Connected now");
Serial.println(host[station_no]);
digitalWrite (ledPin,HIGH);
}
client.print(String("GET ") + path[station_no] + " HTTP" + "Host: " + host[station_no] + "\r\n" + "Connection: close\r\n\r\n");
}
[code]