This commit is contained in:
2026-02-12 21:00:02 -08:00
parent 77f8236347
commit 8bdbf227ca
1141 changed files with 1010880 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
# Streaming Radio Player
We just play a streamed radio station which provides the audio as mp3 and output the result via I2S via the built in DAC
An ESP32 was used to test this sketch.
### Output Device: Piezo Electric Element
To test the output I am using a piezo electric element
![DAC](https://pschatzmann.github.io/Resources/img/piezo.jpeg)
It should also be possible to connect a headphone to the output pins...
On the ESP32 the output is on the Pins GPIO26 and GPIO27
| PIEZO | ESP32
| --------| ---------------
| + | GPIO25 / GPIO26
| - | GND

View File

@@ -0,0 +1,42 @@
/**
* @file streams-url_mp3-out.ino
* @author Phil Schatzmann
* @brief decode MP3 stream from url and output it on I2S
* @version 0.1
* @date 2021-96-25
*
* @copyright Copyright (c) 2021
*/
// install https://github.com/pschatzmann/arduino-libhelix.git
#include "AudioTools.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
#include "AudioTools/Communication/AudioHttp.h"
URLStream url("ssid","password");
AnalogAudioStream out; // final output of decoded stream
EncodedAudioStream dec(&out, new MP3DecoderHelix()); // Decoding stream
StreamCopy copier(dec, url); // copy url to decoder
void setup(){
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
// setup out
auto config = out.defaultConfig(TX_MODE);
out.begin(config);
// setup I2S based on sampling rate provided by decoder
dec.begin();
// mp3 radio
url.begin("http://stream.srg-ssr.ch/m/rsj/mp3_128","audio/mp3");
}
void loop(){
copier.copy();
}