- WLAN, WiFi, vezeték nélküli hálózat
- Vírusirtó topic
- Kodi és kiegészítői magyar nyelvű online tartalmakhoz (Linux, Windows)
- Windows 11
- Windows Insider Program
- Visszavonta az Intel és a Qualcomm Huawei-hez kiadott exportlicencét az USA
- Még több AI-t hozna a Windowsba a Microsoft
- Az Apple szerint ejteni kell az USA trösztellenes perét
- Proxmox VE
- Windows 8 / 8.1
Új hozzászólás Aktív témák
-
bagarol
junior tag
Egyszerű webrádió esp32-vel, nem kell hozzá külső alkatrész. Mono, belső DAC, kijelző nélkül.
Soros konzolon lehet beírni a rádió címét, egyből elkezdi lejátszani, stop-ra leáll, lehet új címet megadni. DAC2-őn (gpio26) adja ki a jelet.Nekem konyhába így is megfelel, persze kijelzővel + egyebek, úgy értem, hogy mono, belső dac. Az esp8266audio[link] library kell hozzá.
Ellenőrizni nem tudtam,nincs most esp32-m, remélem működik.#include <WiFi.h>
#include <AudioFileSource.h>
#include <AudioFileSourceBuffer.h>
#include <AudioFileSourceICYStream.h>
#include <AudioGeneratorMP3.h>
#include <AudioOutputI2S.h>const char* ssid = "";
const char* password = "";
String s;
char URL[96];
const int preallocateBufferSize = 32*1024;
const int preallocateCodecSize = 29192;
void *preallocateBuffer = NULL;
void *preallocateCodec = NULL;
AudioGeneratorMP3 *mp3;
AudioFileSourceICYStream *file;
AudioFileSourceBuffer *buff;
AudioOutputI2S *out;void setup() {
preallocateBuffer = malloc(preallocateBufferSize);
if (!preallocateBuffer) {
Serial.begin(115200);
Serial.printf_P(PSTR("FATAL ERROR: Unable to preallocate %d bytes for app\n"), preallocateBufferSize);
while (1) delay(1000);
}
Serial.begin(115200);
initwifi();
Serial.printf("STATUS(System) Ready \n\n");
out = new AudioOutputI2S(0, 1);
out->SetOutputModeMono(true);
out->SetGain(0.5);
}void loop() {
if(Serial.available()){
s = Serial.read();
if(s == "stop") StopPlaying();
else if(s.startsWith("http://")) {
s.trim();
s.toCharArray(URL,s.length()+1);
StartPlaying();
}
}
}void StartPlaying() {
file = new AudioFileSourceICYStream(URL);
file->RegisterMetadataCB(MDCallback, (void*)"ICY");
buff = new AudioFileSourceBuffer(file, preallocateBuffer, preallocateBufferSize);
buff->RegisterStatusCB(StatusCallback, (void*)"buffer");
out = new AudioOutputI2S(0, 1);
out->SetOutputModeMono(true);
out->SetGain(0.5);
mp3 = new AudioGeneratorMP3(preallocateCodec, preallocateCodecSize);
mp3->RegisterStatusCB(StatusCallback, (void*)"mp3");
mp3->begin(buff, out);
Serial.printf("STATUS(URL) %s \n", URL);
Serial.flush();
}void StopPlaying() {
if (mp3) {
mp3->stop();
delete mp3;
mp3 = NULL;
}
if (buff) {
buff->close();
delete buff;
buff = NULL;
}
if (file) {
file->close();
delete file;
file = NULL;
}
Serial.printf("STATUS(Stopped)\n");
Serial.flush();
}void initwifi() {
WiFi.disconnect();
WiFi.softAPdisconnect(true);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.println("Connecting to WiFi");
delay(1000);
}
Serial.println("Connected to WiFi");
}void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string) {
const char *ptr = reinterpret_cast<const char *>(cbData);
(void) isUnicode;
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();
}void StatusCallback(void *cbData, int code, const char *string) {
const char *ptr = reinterpret_cast<const char *>(cbData);
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();
}[ Szerkesztve ]
Új hozzászólás Aktív témák
- Luck Dragon: Asszociációs játék. :)
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- Samsung Galaxy Z Fold3 5G - foldi evolúció
- WLAN, WiFi, vezeték nélküli hálózat
- Ismét mozgásban a Kingmakers
- Apple notebookok
- EAFC 24
- Samsung Galaxy Z Fold5 - toldozás-foldozás
- gban: Ingyen kellene, de tegnapra
- Bemutatkoztak a Microsoft aktuális Surface gépei
- További aktív témák...
- EVGA RTX 3070 Ti 8GB XC3 ULTRA - bontatlan - eladó!
- ÉRKEZETT Legújabb Bontatlan Új M2 IPAD PRO 2022 11 128GB - 256GB Wi-Fi Azonnal Deák Térnél Átvehető.
- Bontatlan ÚJ IPHONE 13 mini 128-512Gb gyári független Minden Szín Deák Térnél Azonnal Átvehető.
- BONTATLAN Új Iphone 14 és 14 Plus 128-512GB 1év APPLE garancia gyári független Deák AZONNAL Átvehető
- AKCIÓ! Új Bontatlan 2022 MacBook Pro 13" Apple M2 chip/8GB//256GB Magyar Billentyű Azonnal DEÁK TÉR
Állásajánlatok
Cég: Promenade Publishing House Kft.
Város: Budapest
Cég: Alpha Laptopszerviz Kft.
Város: Pécs