- droidic: A fapados NAS tuningolása
- sziku69: Fűzzük össze a szavakat :)
- Luck Dragon: Asszociációs játék. :)
- gban: Ingyen kellene, de tegnapra
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- sziku69: Szólánc.
- eBay-es kütyük kis pénzért
- Brogyi: CTEK akkumulátor töltő és másolatai
- Elektromos rásegítésű kerékpárok
- bitpork: Phautós tali a Balcsinál 2025 Augusztus 2 napján (szombat)
Hirdetés
Talpon vagyunk, köszönjük a sok biztatást! Ha segíteni szeretnél, boldogan ajánljuk Előfizetéseinket!
Új hozzászólás Aktív témák
-
bagarol
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();
}
Új hozzászólás Aktív témák
- Lenovo LOQ 15APH8 gamer laptop 15,6" 144Hz, AMD Ryzen 7
- 0 perces COOLER MASTER MASTERBOX MB600L V2 TEMPERED GLASS eladó! SZÁMLA (a Te nevedre)! ÁRON ALUL!!!
- Acer Predator Triton 17X Intel Core i9 13900HX/RTX 4090/64GB RAM/4TB SSD remek áron IGAZI RITKASÁG!
- LOGITECH G PRO X 2 LIGHTSPEED VEZETÉK NÉLKÜLI FEKETE HEADSET
- 0 perces RYZEN laptop eredeti Win10-zel! GARANCIA + SZÁMLA (a Te nevedre)! LEGOLCSÓBB SZÁMLÁS ÁR!
- BESZÁMÍTÁS! Apple Macbook Pro 13" 2020 M1 16GB 1TB SSD macbook garanciával hibátlan működéssel
- MacBook felvásárlás!! Macbook, Macbook Air, Macbook Pro
- Lenovo IdeaPad 3 17ITL6 - 17.3" HD+ Intel 6305 - 8GB - 256GB SSD - Win11 - MAGYAR
- Bomba ár! Lenovo ThinkPad L390 - i7-8GEN I 16GB I 512SSD I 13,3" FHD I HDMI I Cam I W11 I Gari!
- GYÖNYÖRŰ iPhone 13 Pro Max 128GB Graphite -1 ÉV GARANCIA - Kártyafüggetlen, MS3063
Állásajánlatok
Cég: FOTC
Város: Budapest