mozart
This commit is contained in:
parent
6cbe0da444
commit
2bb1f8cae8
79
src/main.cpp
79
src/main.cpp
|
@ -1,13 +1,3 @@
|
||||||
/*
|
|
||||||
ESP32 I2S Microphone Sample
|
|
||||||
esp32-i2s-mic-sample.ino
|
|
||||||
Sample sound from I2S microphone, display on Serial Plotter
|
|
||||||
Requires INMP441 I2S microphone
|
|
||||||
|
|
||||||
DroneBot Workshop 2022
|
|
||||||
https://dronebotworkshop.com
|
|
||||||
*/
|
|
||||||
#include <Arduino.h>
|
|
||||||
/*
|
/*
|
||||||
Simple Internet Radio Demo
|
Simple Internet Radio Demo
|
||||||
esp32-i2s-simple-radio.ino
|
esp32-i2s-simple-radio.ino
|
||||||
|
@ -20,22 +10,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Include required libraries
|
// Include required libraries
|
||||||
|
#include "Arduino.h"
|
||||||
#include "WiFi.h"
|
#include "WiFi.h"
|
||||||
#include "Audio.h"
|
#include "Audio.h"
|
||||||
|
|
||||||
// Define I2S connections
|
// Define I2S connections
|
||||||
#define I2S_DOUT 22
|
#define I2S_DOUT 22
|
||||||
#define I2S_BCLK 26
|
#define I2S_BCLK 26
|
||||||
#define I2S_LRC 25
|
#define I2S_LRC 25
|
||||||
|
|
||||||
// Create audio object
|
// Create audio object
|
||||||
Audio audio;
|
Audio audio;
|
||||||
|
|
||||||
// Wifi Credentials
|
// Wifi Credentials
|
||||||
String ssid = "cohabit";
|
String ssid = "cohabit";
|
||||||
String password = "lewifidecohabit";
|
String password = "lewifidecohabit";
|
||||||
|
|
||||||
void setup() {
|
void setup()
|
||||||
|
{
|
||||||
|
|
||||||
// Start Serial Monitor
|
// Start Serial Monitor
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
@ -45,7 +37,8 @@ void setup() {
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(ssid.c_str(), password.c_str());
|
WiFi.begin(ssid.c_str(), password.c_str());
|
||||||
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED)
|
||||||
|
{
|
||||||
delay(500);
|
delay(500);
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
}
|
}
|
||||||
|
@ -56,64 +49,22 @@ void setup() {
|
||||||
Serial.println("IP address: ");
|
Serial.println("IP address: ");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
Serial.print("coucou");
|
||||||
|
|
||||||
// Connect MAX98357 I2S Amplifier Module
|
// Connect MAX98357 I2S Amplifier Module
|
||||||
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
|
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
|
||||||
|
Serial.print("coucou");
|
||||||
|
|
||||||
// Set thevolume (0-100)
|
// Set thevolume (0-100)
|
||||||
audio.setVolume(100);
|
audio.setVolume(50);
|
||||||
|
Serial.print("coucou");
|
||||||
// Connect to an Internet radio station (select one as desired)
|
audio.connecttohost("https://s4-webradio.antenne.de/antenne");
|
||||||
//audio.connecttohost("http://vis.media-ice.musicradio.com/CapitalMP3");
|
|
||||||
//audio.connecttohost("mediaserv30.live-nect MAX98357 I2S Amplifier Module
|
|
||||||
//audio.connecttohost("www.surfmusic.de/m3u/100-5-das-hitradio,4529.m3u");
|
|
||||||
//audio.connecttohost("stream.1a-webradio.de/deutsch/mp3-128/vtuner-1a");
|
|
||||||
audio.connecttohost("www.antenne.de/webradio/antenne.m3u");
|
|
||||||
//audio.connecttohost("https://git.cohabit.fr/andre.malo/Amplificator/raw/branch/master/Mozart%20-%20Lacrimosa.mp3");
|
|
||||||
//audio.connecttoFS(m_f_localfile,"/Mozart - Lacrimosa.mp3");
|
|
||||||
//audio.playI2Sremains(m_f_localfile,"/Mozart - Lacrimosa.mp3");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
|
||||||
{
|
{
|
||||||
// Run audio player
|
// Run audio player
|
||||||
|
Serial.print("coucou");
|
||||||
audio.loop();
|
audio.loop();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Audio status functions
|
|
||||||
|
|
||||||
void audio_info(const char *info) {
|
|
||||||
Serial.print("info "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_id3data(const char *info) { //id3 metadata
|
|
||||||
Serial.print("id3data "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_eof_mp3(const char *info) { //end of file
|
|
||||||
Serial.print("eof_mp3 "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_showstation(const char *info) {
|
|
||||||
Serial.print("station "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_showstreaminfo(const char *info) {
|
|
||||||
Serial.print("streaminfo "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_showstreamtitle(const char *info) {
|
|
||||||
Serial.print("streamtitle "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_bitrate(const char *info) {
|
|
||||||
Serial.print("bitrate "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_commercial(const char *info) { //duration in sec
|
|
||||||
Serial.print("commercial "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_icyurl(const char *info) { //homepage
|
|
||||||
Serial.print("icyurl "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_lasthost(const char *info) { //stream URL played
|
|
||||||
Serial.print("lasthost "); Serial.println(info);
|
|
||||||
}
|
|
||||||
void audio_eof_speech(const char *info) {
|
|
||||||
Serial.print("eof_speech "); Serial.println(info);
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue