You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
it could be really useful that we update all the examples in the library in the same way to allow for new users to test quickly on ESP8266 or ESP32, with or without internal DAC.
I make a proposition :
Introduction :
/****************************************************************************//* Here, example readme *//**//**//* Released under GPL v2 *//* Credits... *//*************************************************************************** ______ _____ _____ ____ ___ | ____| / ____| | __ \ |___ \ |__ \ | |__ | (___ | |__) | __) | ) | | __| \___ \ | ___/ |__ < / / | |____ ____) | | | ___) | / /_ |______| |_____/ |_| |____/ |____|+-----------------+-----------------+--------------+--------------------+| audio pins | External DAC | Internal DAC | No DAC |+-----------------+-----------------+--------------+--------------------+| DAC - LCK(LRC) | GPIO25 | NA | NA || DAC - BCK(BCLK) | GPIO26 | NA | NA || DAC - I2So(DIN) | GPIO22 | NA | NA || speaker L | NA (on the DAC) | GPIO25 | GPIO22 (L&R mixed) || speaker R | NA (on the DAC) | GPIO26 | GPIO22 (L&R mixed) |+-----------------+-----------------+--------------+--------------------+ ______ _____ _____ ___ ___ __ __ | ____| / ____| | __ \ / _ \ |__ \ / / / / | |__ | (___ | |__) | | (_) | ) | / /_ / /_ | __| \___ \ | ___/ > _ < / / | '_ \ | '_ \ | |____ ____) | | | | (_) | / /_ | (_) | | (_) | |______| |_____/ |_| \___/ |____| \___/ \___/ +-----------------+-----------------+------------------------+| audio pins | External DAC | No DAC |+-----------------+-----------------+------------------------+| DAC - LCK(LRC) | GPIO2 (D4) | NA || DAC - BCK(BCLK) | GPIO15 (D8) | NA || DAC - I2So(DIN) | GPIO3 (RX) | NA || speaker L | NA (on the DAC) | GPIO3 (RX) (L&R mixed) || speaker R | NA (on the DAC) | GPIO3 (RX) (L&R mixed) |+-----------------+-----------------+------------------------+To Upload to an ESP8266 module or board: - Set CPU Frequency to 160MHz ( Arduino IDE: Tools > CPU Frequency ) - Set IwIP to V2 Higher Bandwidth ( Arduino IDE: Tools > IwIP Variant ) - Press "Upload"*/
Library and global declaration :
// Please select one of these options
#defineUSE_NO_DAC// uncomment to use no DAC, using software-simulated delta-sigma DAC//#define USE_EXTERNAL_DAC // uncomment to use external I2S DAC //#define USE_INTERNAL_DAC // uncomment to use the internal DAC of the ESP32 (not available on ESP8266)
#ifdef ESP32
#include<WiFi.h>
#else
#include<ESP8266WiFi.h>
#endif
#ifdef USE_NO_DAC
#include"AudioOutputI2SNoDAC.h"
#else
#include"AudioOutputI2S.h"
#endif
#ifdef USE_NO_DAC
AudioOutputI2SNoDAC *out = NULL;
#else
AudioOutputI2S *out = NULL;
#endif
#ifdef USE_INTERNAL_DAC
out = new AudioOutputI2S(0, 1); //use the internal DAC : channel 1 (gpio25) , channel 2 (gpio26)
Serial.println(F("Using the internal DAC of the ESP32 : \r\n speaker L -> GPIO25 \r\n speaker R -> GPIO26"));
#elif defined USE_EXTERNAL_DAC
out = new AudioOutputI2S();
#ifdef ESP32
Serial.println(F("Using I2S output on ESP32 : please connect your DAC to pins : "));
Serial.println(F("LCK(LRC) -> GPIO25 \r\n BCK(BCLK) -> GPIO26 \r\n I2So(DIN) -> GPIO22"));
#else// we are on ESP8266
Serial.println(F("Using I2S output on ESP8266 : please connect your DAC to pins : "));
Serial.println(F("LCK(LRC) -> GPIO2 (D4) \r\n BCK(BCLK) -> GPIO15 (D8) \r\n I2So(DIN) -> GPIO3 (RX)"));
#endif// end of #ifdef ESP32
#else// we don't use DAC, using software-simulated delta-sigma DAC
out = new AudioOutputI2SNoDAC();
#ifdef ESP32
Serial.println(F("Using No DAC output on ESP32, audio output on pins \r\n speaker L & R -> GPIO22"));
#else
Serial.println(F("Using No DAC output on ESP8266, audio output on pins \r\n speaker L & R -> GPIO3 (RX)"));
#endif
Serial.println(F("Don't try and drive the speaker pins can't give enough current to drive even a headphone well and you may end up damaging your device"));
#endif// out->SetGain(volume_level); // Specify Volume between 0 and 1.0// out->SetChannels(2); // Specify the channel(1) or (2)// out->SetBitsPerSample(16); // Specify bits per sample generally 8 or 16// out->SetRate(44100); // Specify the rate here : 8000 ,22050 , 44100 , 48000playBootSound();
With this each user can adapt easily the examples to their hardware and needs.
Any comments or additional ideas ?
The text was updated successfully, but these errors were encountered:
Hi,
it could be really useful that we update all the examples in the library in the same way to allow for new users to test quickly on ESP8266 or ESP32, with or without internal DAC.
I make a proposition :
Introduction :
Library and global declaration :
A little boot sound to test sound at start
Setup() part :
With this each user can adapt easily the examples to their hardware and needs.
Any comments or additional ideas ?
The text was updated successfully, but these errors were encountered: