Hello All,
I convert This program from This website to platform IO.
when I compile it I get the error that it complains about Audio.h.
When I download the audio.h from this website I got the below errors. I didnât put all the errors due to the limitation of my account.
Any help would be appreciated
In file included from .pio/libdeps/featheresp32/Audio/src/Audio.h:16:0,
from src\sketch_oct26a.cpp:3:
.pio/libdeps/featheresp32/Audio/src/DAC.h:21:16: error: expected â)â before â*â token
DACClass(Dacc *_dac, uint32_t _dacId, IRQn_Type _isrId) :
n file included from .pio/libdeps/featheresp32/Audio/src/Audio.h:16:0,
from src\sketch_oct26a.cpp:3:
.pio/libdeps/featheresp32/Audio/src/DAC.h:21:16: error: expected ')' before '*' token
DACClass(Dacc *_dac, uint32_t _dacId, IRQn_Type _isrId) :
^
.pio/libdeps/featheresp32/Audio/src/DAC.h:35:2: error: 'Dacc' does not name a type
Dacc *dac;
^
.pio/libdeps/featheresp32/Audio/src/DAC.h:37:2: error: 'IRQn_Type' does not name a type
IRQn_Type isrId;
^
.pio/libdeps/featheresp32/Audio/src/DAC.h: In member function 'void DACClass::enableInterrupts()':
.pio/libdeps/featheresp32/Audio/src/DAC.h:31:44: error: 'isrId' was not declared in this scope
void enableInterrupts() { NVIC_EnableIRQ(isrId); };
^
.pio/libdeps/featheresp32/Audio/src/DAC.h:31:49: error: 'NVIC_EnableIRQ' was not declared in this scope
void enableInterrupts() { NVIC_EnableIRQ(isrId); };
^
.pio/libdeps/featheresp32/Audio/src/DAC.h: In member function 'void DACClass::disableInterrupts()':
.pio/libdeps/featheresp32/Audio/src/DAC.h:32:45: error: 'isrId' was not declared in this scope
void disableInterrupts() { NVIC_DisableIRQ(isrId); };
^
.pio/libdeps/featheresp32/Audio/src/DAC.h:32:50: error: 'NVIC_DisableIRQ' was not declared in this scope
void disableInterrupts() { NVIC_DisableIRQ(isrId); };
^
In file included from src\sketch_oct26a.cpp:3:0:
.pio/libdeps/featheresp32/Audio/src/Audio.h: In member function 'virtual size_t AudioClass::write(uint8_t)':
.pio/libdeps/featheresp32/Audio/src/Audio.h:25:82: warning: no return statement in function returning non-void [-Wreturn-type]
virtual size_t write(uint8_t c) { /* not implemented */ };
^
In file included from .pio\libdeps\featheresp32\Audio\src\Audio.h:16:0,
from .pio\libdeps\featheresp32\Audio\src\Audio.cpp:11:
.pio\libdeps\featheresp32\Audio\src\DAC.h:21:16: error: expected ')' before '*' token
DACClass(Dacc *_dac, uint32_t _dacId, IRQn_Type _isrId) :
^
.pio\libdeps\featheresp32\Audio\src\DAC.h:35:2: error: 'Dacc' does not name a type
Dacc *dac;
^
.pio\libdeps\featheresp32\Audio\src\DAC.h:37:2: error: 'IRQn_Type' does not name a type
IRQn_Type isrId;
^
.pio\libdeps\featheresp32\Audio\src\DAC.h: In member function 'void DACClass::enableInterrupts()':
.pio\libdeps\featheresp32\Audio\src\DAC.h:31:44: error: 'isrId' was not declared in this scope
void enableInterrupts() { NVIC_EnableIRQ(isrId); };
^
.pio\libdeps\featheresp32\Audio\src\DAC.h:31:49: error: 'NVIC_EnableIRQ' was not declared in this scope
void enableInterrupts() { NVIC_EnableIRQ(isrId); };
^
.pio\libdeps\featheresp32\Audio\src\DAC.h: In member function 'void DACClass::disableInterrupts()':
.pio\libdeps\featheresp32\Audio\src\DAC.h:32:45: error: 'isrId' was not declared in this scope
void disableInterrupts() { NVIC_DisableIRQ(isrId); };
^
.pio\libdeps\featheresp32\Audio\src\DAC.h:32:50: error: 'NVIC_DisableIRQ' was not declared in this scope
void disableInterrupts() { NVIC_DisableIRQ(isrId); };
^
In file included from .pio\libdeps\featheresp32\Audio\src\Audio.cpp:11:0:
.pio\libdeps\featheresp32\Audio\src\Audio.h: In member function 'virtual size_t AudioClass::write(uint8_t)':
.pio\libdeps\featheresp32\Audio\src\Audio.h:25:82: warning: no return statement in function returning non-void [-Wreturn-type]
virtual size_t write(uint8_t c) { /* not implemented */ };
^
.pio\libdeps\featheresp32\Audio\src\Audio.cpp: In member function 'void AudioClass::begin(uint32_t, uint32_t)':
.pio\libdeps\featheresp32\Audio\src\Audio.cpp:27:13: error: 'VARIANT_MCK' was not declared in this scope
dac->begin(VARIANT_MCK / sampleRate);
^
src\sketch_oct26a.cpp: At global scope:
src\sketch_oct26a.cpp:16:1: error: 'Audio' does not name a type
Audio audio;
^
src\sketch_oct26a.cpp: In function 'void setup()':
src\sketch_oct26a.cpp:24:5: error: 'audio' was not declared in this scope
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
^
src\sketch_oct26a.cpp: In function 'void loop()':
src\sketch_oct26a.cpp:31:5: error: 'audio' was not declared in this scope
audio.loop();
^
In file included from .pio\libdeps\featheresp32\Audio\src\DAC.cpp:11:0:
.pio\libdeps\featheresp32\Audio\src/DAC.h:21:16: error: expected ')' before '*' token
DACClass(Dacc *_dac, uint32_t _dacId, IRQn_Type _isrId) :
^
.pio\libdeps\featheresp32\Audio\src/DAC.h:35:2: error: 'Dacc' does not name a type
Dacc *dac;
^
.pio\libdeps\featheresp32\Audio\src/DAC.h:37:2: error: 'IRQn_Type' does not name a type
IRQn_Type isrId;
^
.pio\libdeps\featheresp32\Audio\src/DAC.h: In member function 'void DACClass::enableInterrupts()':
.pio\libdeps\featheresp32\Audio\src/DAC.h:31:44: error: 'isrId' was not declared in this scope
void enableInterrupts() { NVIC_EnableIRQ(isrId); };
^
.pio\libdeps\featheresp32\Audio\src/DAC.h:31:49: error: 'NVIC_EnableIRQ' was not declared in this scope
void enableInterrupts() { NVIC_EnableIRQ(isrId); };
^
.pio\libdeps\featheresp32\Audio\src/DAC.h: In member function 'void DACClass::disableInterrupts()':
.pio\libdeps\featheresp32\Audio\src/DAC.h:32:45: error: 'isrId' was not declared in this scope
void disableInterrupts() { NVIC_DisableIRQ(isrId); };
^
.pio\libdeps\featheresp32\Audio\src/DAC.h:32:50: error: 'NVIC_DisableIRQ' was not declared in this scope
void disableInterrupts() { NVIC_DisableIRQ(isrId); };
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp: In member function 'void DACClass::begin(uint32_t)':
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:15:29: error: 'pmc_enable_periph_clk' was not declared in this scope
pmc_enable_periph_clk(dacId);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:17:13: error: 'dac' was not declared in this scope
dacc_reset(dac);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:17:16: error: 'dacc_reset' was not declared in this scope
dacc_reset(dac);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:20:31: error: 'dacc_set_transfer_mode' was not declared in this scope
dacc_set_transfer_mode(dac, 1);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:25:31: error: 'dacc_set_power_save' was not declared in this scope
dacc_set_power_save(dac, 0, 0);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:31:32: error: 'DACC_MR_STARTUP_1024' was not declared in this scope
dacc_set_timing(dac, 0x08, 0, DACC_MR_STARTUP_1024);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:31:52: error: 'dacc_set_timing' was not declared in this scope
dacc_set_timing(dac, 0x08, 0, DACC_MR_STARTUP_1024);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:34:36: error: 'dacc_enable_flexible_selection' was not declared in this scope
dacc_enable_flexible_selection(dac);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:38:26: error: 'DACC_ACR_IBCTLCH0' was not declared in this scope
DACC_ACR_IBCTLCH0(0x02) |
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:39:26: error: 'DACC_ACR_IBCTLCH1' was not declared in this scope
DACC_ACR_IBCTLCH1(0x02) |
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:40:30: error: 'DACC_ACR_IBCTLDACCORE' was not declared in this scope
Compiling .pio\build\featheresp32\libe51\SD\SD.cpp.o
DACC_ACR_IBCTLDACCORE(0x01));
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:40:31: error: 'dacc_set_analog_control' was not declared in this scope
DACC_ACR_IBCTLDACCORE(0x01));
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:43:28: error: 'dacc_enable_channel' was not declared in this scope
dacc_enable_channel(dac, 0);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:48:24: error: 'ID_TC1' was not declared in this scope
pmc_enable_periph_clk(ID_TC1);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:49:15: error: 'TC0' was not declared in this scope
TC_Configure(TC0, 1,
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:50:3: error: 'TC_CMR_TCCLKS_TIMER_CLOCK2' was not declared in this scope
TC_CMR_TCCLKS_TIMER_CLOCK2 | // Clock at MCR/8
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:51:3: error: 'TC_CMR_WAVE' was not declared in this scope
TC_CMR_WAVE | // Waveform mode
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:52:3: error: 'TC_CMR_WAVSEL_UP_RC' was not declared in this scope
TC_CMR_WAVSEL_UP_RC | // Counter running up and reset when equals to RC
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:53:3: error: 'TC_CMR_ACPA_SET' was not declared in this scope
TC_CMR_ACPA_SET | TC_CMR_ACPC_CLEAR);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:53:21: error: 'TC_CMR_ACPC_CLEAR' was not declared in this scope
TC_CMR_ACPA_SET | TC_CMR_ACPC_CLEAR);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:53:38: error: 'TC_Configure' was not declared in this scope
TC_CMR_ACPA_SET | TC_CMR_ACPC_CLEAR);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:55:25: error: 'TC_SetRA' was not declared in this scope
TC_SetRA(TC0, 1, TC / 2);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:56:21: error: 'TC_SetRC' was not declared in this scope
TC_SetRC(TC0, 1, TC);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:57:17: error: 'TC_Start' was not declared in this scope
TC_Start(TC0, 1);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:60:25: error: 'dacc_set_trigger' was not declared in this scope
dacc_set_trigger(dac, 2);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:63:16: error: 'g_APinDescription' was not declared in this scope
PIO_Configure(g_APinDescription[DAC0].pPort,
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:63:34: error: 'DAC0' was not declared in this scope
PIO_Configure(g_APinDescription[DAC0].pPort,
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:66:46: error: 'PIO_Configure' was not declared in this scope
g_APinDescription[DAC0].ulPinConfiguration);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:73:40: error: 'dacc_disable_interrupt' was not declared in this scope
dacc_disable_interrupt(dac, 0xFFFFFFFF);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:74:18: error: 'isrId' was not declared in this scope
NVIC_DisableIRQ(isrId);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:74:23: error: 'NVIC_DisableIRQ' was not declared in this scope
NVIC_DisableIRQ(isrId);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:75:28: error: 'NVIC_ClearPendingIRQ' was not declared in this scope
NVIC_ClearPendingIRQ(isrId);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:76:27: error: 'NVIC_SetPriority' was not declared in this scope
NVIC_SetPriority(isrId, 0);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:77:22: error: 'NVIC_EnableIRQ' was not declared in this scope
NVIC_EnableIRQ(isrId);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp: In member function 'void DACClass::end()':
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:81:10: error: 'TC0' was not declared in this scope
TC_Stop(TC0, 1);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:81:16: error: 'TC_Stop' was not declared in this scope
TC_Stop(TC0, 1);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:82:18: error: 'isrId' was not declared in this scope
NVIC_DisableIRQ(isrId);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:82:23: error: 'NVIC_DisableIRQ' was not declared in this scope
NVIC_DisableIRQ(isrId);
^
*** [.pio\build\featheresp32\lib36c\Audio\Audio.cpp.o] Error 1
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:83:23: error: 'dac' was not declared in this scope
dacc_disable_channel(dac, 0);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:83:29: error: 'dacc_disable_channel' was not declared in this scope
dacc_disable_channel(dac, 0);
^
*** [.pio\build\featheresp32\src\sketch_oct26a.cpp.o] Error 1
.pio\libdeps\featheresp32\Audio\src\DAC.cpp: In member function 'bool DACClass::canQueue()':
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:88:10: error: 'dac' was not declared in this scope
return (dac->DACC_TNCR == 0);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp: In member function 'size_t DACClass::queueBuffer(const uint32_t*, size_t)':
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:93:7: error: 'dac' was not declared in this scope
if ((dac->DACC_TCR == 0) && (dac->DACC_TNCR == 0)) {
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:96:20: error: 'DACC_PTCR_TXTEN' was not declared in this scope
dac->DACC_PTCR = DACC_PTCR_TXTEN;
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:98:31: error: 'DACC_IER_ENDTX' was not declared in this scope
dacc_enable_interrupt(dac, DACC_IER_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:98:45: error: 'dacc_enable_interrupt' was not declared in this scope
dacc_enable_interrupt(dac, DACC_IER_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:103:6: error: 'dac' was not declared in this scope
if (dac->DACC_TNCR == 0) {
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:106:20: error: 'DACC_PTCR_TXTEN' was not declared in this scope
dac->DACC_PTCR = DACC_PTCR_TXTEN;
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:108:31: error: 'DACC_IER_ENDTX' was not declared in this scope
dacc_enable_interrupt(dac, DACC_IER_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:108:45: error: 'dacc_enable_interrupt' was not declared in this scope
dacc_enable_interrupt(dac, DACC_IER_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp: In member function 'void DACClass::setOnTransmitEnd_CB(OnTransmitEnd_CB, void*)':
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:120:26: error: 'dac' was not declared in this scope
dacc_disable_interrupt(dac, DACC_IDR_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:120:31: error: 'DACC_IDR_ENDTX' was not declared in this scope
dacc_disable_interrupt(dac, DACC_IDR_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:120:45: error: 'dacc_disable_interrupt' was not declared in this scope
dacc_disable_interrupt(dac, DACC_IDR_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp: In member function 'void DACClass::onService()':
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:124:16: error: 'dac' was not declared in this scope
uint32_t sr = dac->DACC_ISR;
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:125:11: error: 'DACC_ISR_ENDTX' was not declared in this scope
if (sr & DACC_ISR_ENDTX) {
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:127:31: error: 'DACC_IDR_ENDTX' was not declared in this scope
dacc_disable_interrupt(dac, DACC_IDR_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:127:45: error: 'dacc_disable_interrupt' was not declared in this scope
dacc_disable_interrupt(dac, DACC_IDR_ENDTX);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp: At global scope:
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:133:14: error: 'DACC_INTERFACE' was not declared in this scope
DACClass DAC(DACC_INTERFACE, DACC_INTERFACE_ID, DACC_ISR_ID);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:133:30: error: 'DACC_INTERFACE_ID' was not declared in this scope
DACClass DAC(DACC_INTERFACE, DACC_INTERFACE_ID, DACC_ISR_ID);
^
.pio\libdeps\featheresp32\Audio\src\DAC.cpp:133:49: error: 'DACC_ISR_ID' was not declared in this scope
DACClass DAC(DACC_INTERFACE, DACC_INTERFACE_ID, DACC_ISR_ID);
^
*** [.pio\build\featheresp32\lib36c\Audio\DAC.cpp.o] Error 1
The PlatformIO Registry library is for a SAMD51 (ARM style NVIC). The Audio.h is already in that repo. You need to give it that exact libirary.
From the limited information you have provided, I assume the following:
- You have an ESP32 board.
- You have downloaded the Audio by Arduino library
If this assumption is correct, it wonât work. The Audio by Arduino library is for Atmel SAM based boards and wonât work for ESP32 boards.
You probably want to use the other audio library instead: Audio - Adafruit Fork by Adafruit based on Paul Stoffregen, Adafruit.
And I suggest you do NOT download the library. Instead, just declare it in platfromio.ini
:
lib_deps = adafruit/Audio - Adafruit Fork @ ^1.3.1
Actually he refers to the ESP32-audioI2S and a website where the last sketch uses the Audio.h
from that library. So I think what he wants is
platformio.ini
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
ESP32-audioI2S-master=https://github.com/schreibfaul1/ESP32-audioI2S/archive/master.zip
src\main.cpp
#include "Audio.h"
#include "SD.h"
#include "FS.h"
// Digital I/O used
#define SD_CS 5
#define SPI_MOSI 23
#define SPI_MISO 19
#define SPI_SCK 18
#define I2S_DOUT 25
#define I2S_BCLK 27
#define I2S_LRC 26
Audio audio;
void setup() {
pinMode(SD_CS, OUTPUT);
digitalWrite(SD_CS, HIGH);
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
Serial.begin(115200);
SD.begin(SD_CS);
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
audio.setVolume(10); // 0...21
audio.connecttoFS(SD, "Ensoniq-ZR-76-01-Dope-77.wav");
}
void loop()
{
audio.loop();
}
// optional
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);
}
which compiles just fine on my machine.
Good point. I was aware that he is using ESP32-audioI2S but thought it depends on an audio library. But it does not and comes with its own Audio.h
. Thanks.
Thank you So much, Max.
It is worked.
I really appreciated your help.
My question now is, how did you know that I need to add this library and not the one that Platform IO recommended here: PlatformIO Registry
Thank you
Iman
The article youâve linked to contains a direct link to the library (GitHub - schreibfaul1/ESP32-audioI2S: Play mp3 files from SD via I2S). So we must make absolutely sure that code from the repo is used. The only question is whether this library is in the PIO library repository (â> we can refer to it with its library name and owner) or not (we must provide a direct downlink to the repo). In the library, there is a library.properties
that declares the libraryâs name as
And the search results for that is empty. Thus we have to go the direct-link route. Using the documentation we then find the correct syntax for adding a library throgh its download link â whereas the downlink link is taken form the Github websiteâs âCode â Download zipâ button.
You can also see that when you follow any of these libraries which you found by just searching for Audio.h
link to an entirely different repository (âRepositoryâ link) and thus are the wrong ones.
Thank you for the clarification.
@imanpakii did you get this working? Iâm getting this error.
Iâm running the latest PlatformIO
platformio.ini
[env:m5stack-core-esp32]
platform = espressif32
board = m5stack-core-esp32
framework = arduino
upload_speed = 115200
monitor_speed = 115200
lib_deps =
ESP32-audioI2S-master=https://github.com/schreibfaul1/ESP32-audioI2S/archive/master.zip
.pio/libdeps/m5stack-core-esp32/ESP32-audioI2S-master/src/Audio.cpp: In constructor âAudio::Audio(uint8_t, uint8_t, uint8_t)â:
.pio/libdeps/m5stack-core-esp32/ESP32-audioI2S-master/src/Audio.cpp:134:17: error: âclass WiFiClientSecureâ has no member named âsetInsecureâ
clientsecure.setInsecure(); // if that canât be resolved update to ESP32 Arduino version 1.0.5-rc05 or higher
^
Compiling .pio/build/m5stack-core-esp32/FrameworkArduino/MD5Builder.cpp.o
*** [.pio/build/m5stack-core-esp32/lib7bf/ESP32-audioI2S-master/Audio.cpp.o] Error 1
The latest released stable version of Arduino-ESP32, that PlatformIO uses, is 1.0.4.
The problem is that
youâre taking the master-version of the library which might be written against not yet released release-candidates. However sadly this library also has no tags / versioning, so you would have to go back in the commit history to get a version that works against 1.0.4, which might be cumbersome.
The other option is to just upgrade the Arduino-ESP32 core to bleeding-edge master. That can be done as seen in Arduino Espressif ESP32 - #2 by maxgerhardt.
Iâm not sure what changed recently, for some reason Iâm starting to get build errors. This was working before.
Iâm running PlatformIO v2.2.1
platformio.ini
[env:audio]
platform = espressif32
board = featheresp32
framework = arduino
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#master
upload_port = /dev/cu.usbserial-0001
upload_speed = 115200
monitor_speed = 115200
lib_deps =
ESP32-audioI2S-master=https://github.com/schreibfaul1/ESP32-audioI2S/archive/master.zip
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/featheresp32.html
PLATFORM: Espressif 32 (3.1.0) > Adafruit ESP32 Feather
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 0.0.0+sha.6f23cd5
- tool-esptoolpy 1.30000.201119 (3.0.0)
- toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP32-audioI2S-master> 2.0.0+sha.783f67c
| |-- <FFat> 1.0
| | |-- <FS> 1.0
| |-- <FS> 1.0
| |-- <SD(esp32)> 1.0.5
| | |-- <FS> 1.0
| | |-- <SPI> 1.0
| |-- <SD_MMC> 1.0
| | |-- <FS> 1.0
| |-- <SPI> 1.0
| |-- <SPIFFS> 1.0
| | |-- <FS> 1.0
| |-- <WiFiClientSecure> 1.0
| | |-- <WiFi> 1.0
|-- <FS> 1.0
|-- <SD(esp32)> 1.0.5
| |-- <FS> 1.0
| |-- <SPI> 1.0
|-- <WiFi> 1.0
Building in release mode
Compiling .pio/build/audio/src/main.cpp.o
Archiving .pio/build/audio/lib13f/libWiFi.a
src/main.cpp:16:1: error: 'Audio' does not name a type
Audio audio;
^
src/main.cpp: In function 'void setup()':
src/main.cpp:24:5: error: 'audio' was not declared in this scope
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
^
src/main.cpp: In function 'void loop()':
src/main.cpp:31:5: error: 'audio' was not declared in this scope
audio.loop();
^
Indexing .pio/build/audio/lib13f/libWiFi.a
Archiving .pio/build/audio/lib301/libWiFiClientSecure.a
Indexing .pio/build/audio/lib301/libWiFiClientSecure.a
Compiling .pio/build/audio/lib401/ESP32-audioI2S-master/Audio.cpp.o
Compiling .pio/build/audio/lib401/ESP32-audioI2S-master/aac_decoder/aac_decoder.cpp.o
Compiling .pio/build/audio/lib401/ESP32-audioI2S-master/flac_decoder/flac_decoder.cpp.o
Compiling .pio/build/audio/lib401/ESP32-audioI2S-master/mp3_decoder/mp3_decoder.cpp.o
Archiving .pio/build/audio/libFrameworkArduinoVariant.a
Indexing .pio/build/audio/libFrameworkArduinoVariant.a
Compiling .pio/build/audio/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/audio/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/audio/FrameworkArduino/HardwareSerial.cpp.o
*** [.pio/build/audio/src/main.cpp.o] Error 1
Compiling .pio/build/audio/FrameworkArduino/IPAddress.cpp.o
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp: In member function 'int Audio::read_M4A_Header(uint8_t*, size_t)':
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1439:18: warning: variable 'atomName' set but not used [-Wunused-but-set-variable]
char atomName[5];
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1522:80: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t {aka unsigned int}' [-Wformat=]
sprintf(chbuf, "Sampling Frequency: %lu",samplingFrequencies[sRate]);
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1522:80: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t {aka unsigned int}' [-Wformat=]
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1485:21: warning: unused variable 'len_of_OD' [-Wunused-variable]
uint8_t len_of_OD = *(pos + 12); // length of this OD (which includes the next 2 tags)
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1486:21: warning: unused variable 'len_of_ESD' [-Wunused-variable]
uint8_t len_of_ESD = *(pos + 20); // length of this Elementary Stream Descriptor
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1532:21: warning: unused variable 'dependsOnCoreCoder' [-Wunused-variable]
uint8_t dependsOnCoreCoder = (ASC & 0x02);
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1533:21: warning: unused variable 'extensionFlag' [-Wunused-variable]
uint8_t extensionFlag = (ASC & 0x01);
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp: In member function 'int Audio::read_OGG_Header(uint8_t*, size_t)':
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1622:19: warning: variable 'headerSize' set but not used [-Wunused-but-set-variable]
static size_t headerSize;
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:1624:19: warning: variable 'f_lastMetaBlock' set but not used [-Wunused-but-set-variable]
static bool f_lastMetaBlock;
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp: In member function 'bool Audio::playSample(int16_t*)':
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:3301:13: warning: unused variable 'sample1' [-Wunused-variable]
int16_t sample1[2]; int16_t* s1;
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:3301:34: warning: unused variable 's1' [-Wunused-variable]
int16_t sample1[2]; int16_t* s1;
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:3302:34: warning: unused variable 's2' [-Wunused-variable]
int16_t sample2[2]; int16_t* s2 = sample2;
^
.pio/libdeps/audio/ESP32-audioI2S-master/src/Audio.cpp:3303:34: warning: unused variable 's3' [-Wunused-variable]
int16_t sample3[2]; int16_t* s3 = sample3;
^
Weird, it canât find the Audio
type defined in Audio.h
.
You donât have any other header files in the project which define the AUDIO_H_
macro yes?
No, I donât. Itâs very weird, it just started giving that error yesterday, I see there was an update in master branch yesterday.
I have no problems compiling the current master branch and the I2SAudio.ino example verbatim as main.cpp
with the platformio.ini
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
https://github.com/schreibfaul1/ESP32-audioI2S.git
Dependency Graph
|-- <ESP32-audioI2S-master> 2.0.0+sha.783f67c
| |-- <FFat> 1.0
| | |-- <FS> 1.0
| |-- <FS> 1.0
| |-- <SD(esp32)> 1.0.5
| | |-- <FS> 1.0
| | |-- <SPI> 1.0
| |-- <SD_MMC> 1.0
| | |-- <FS> 1.0
| |-- <SPI> 1.0
| |-- <SPIFFS> 1.0
| | |-- <FS> 1.0
| |-- <WiFiClientSecure> 1.0
| | |-- <WiFi> 1.0
|-- <FS> 1.0
|-- <SD(esp32)> 1.0.5
| |-- <FS> 1.0
| |-- <SPI> 1.0
|-- <SPI> 1.0
|-- <WiFi> 1.0
Building in release mode
[..]
Linking .pio\build\esp32\firmware.elf
Building .pio\build\esp32\firmware.bin
Retrieving maximum program size .pio\build\esp32\firmware.elf
Checking size .pio\build\esp32\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [== ] 15.5% (used 50876 bytes from 327680 bytes)
Flash: [======== ] 84.3% (used 1104917 bytes from 1310720 bytes)
esptool.py v3.0
============================ [SUCCESS] Took 18.76 seconds ============================
Maybe try and remove the .pio
folder of the project to get a clean version of the library again.
Weird, deleted .pio, still same errors, this was working before
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/featheresp32.html
PLATFORM: Espressif 32 (3.1.0) > Adafruit ESP32 Feather
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 3.10005.210308 (1.0.5)
- tool-esptoolpy 1.30000.201119 (3.0.0)
- toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Library Manager: Installing git+https://github.com/schreibfaul1/ESP32-audioI2S
git version 2.23.0
Cloning into '/Users/jeff/.platformio/.cache/tmp/pkg-installing-hg0212bv'...
Library Manager: ESP32-audioI2S-master @ 2.0.0+sha.783f67c has been installed!
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP32-audioI2S-master> 2.0.0+sha.783f67c
| |-- <FFat> 1.0
| | |-- <FS> 1.0
| |-- <FS> 1.0
| |-- <SD(esp32)> 1.0.5
| | |-- <FS> 1.0
| | |-- <SPI> 1.0
| |-- <SD_MMC> 1.0
| | |-- <FS> 1.0
| |-- <SPI> 1.0
| |-- <SPIFFS> 1.0
| | |-- <FS> 1.0
| |-- <WiFiClientSecure> 1.0
| | |-- <WiFi> 1.0
|-- <FS> 1.0
|-- <SD(esp32)> 1.0.5
| |-- <FS> 1.0
| |-- <SPI> 1.0
|-- <WiFi> 1.0
Building in release mode
Compiling .pio/build/audio/src/main.cpp.o
Generating partitions .pio/build/audio/partitions.bin
Compiling .pio/build/audio/lib991/FS/FS.cpp.o
Compiling .pio/build/audio/lib991/FS/vfs_api.cpp.o
Compiling .pio/build/audio/lib9da/FFat/FFat.cpp.o
Compiling .pio/build/audio/libf85/SPI/SPI.cpp.o
Compiling .pio/build/audio/libfea/SD/SD.cpp.o
Compiling .pio/build/audio/libfea/SD/sd_diskio.cpp.o
Compiling .pio/build/audio/libfea/SD/sd_diskio_crc.c.o
Compiling .pio/build/audio/lib4d4/SD_MMC/SD_MMC.cpp.o
src/main.cpp:16:1: error: 'Audio' does not name a type
Audio audio;
^
src/main.cpp: In function 'void setup()':
src/main.cpp:24:5: error: 'audio' was not declared in this scope
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
^
src/main.cpp: In function 'void loop()':
src/main.cpp:31:5: error: 'audio' was not declared in this scope
audio.loop();
^
Compiling .pio/build/audio/lib058/SPIFFS/SPIFFS.cpp.o
Compiling .pio/build/audio/lib889/WiFi/ETH.cpp.o
*** [.pio/build/audio/src/main.cpp.o] Error 1
Full main.cpp
code?
Also, you can point back at specific commits of the library if thatâs what caused the problem, in #<commit>
form at the end of the .git
link in the platformio.ini
.
This is the one that used to work⌠in VSCode, itâs showing Audio as âAudioâ does not name a type. Not sure why it is not able to see Audio.
#include <Arduino.h>
#include "WiFi.h"
#include "Audio.h"
#include "SD.h"
#include "FS.h"
// Digital I/O used
#define SD_CS 5
#define SPI_MOSI 23
#define SPI_MISO 19
#define SPI_SCK 18
#define I2S_DOUT 25
#define I2S_BCLK 27
#define I2S_LRC 26
Audio audio;
void setup() {
pinMode(SD_CS, OUTPUT);
digitalWrite(SD_CS, HIGH);
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
Serial.begin(115200);
SD.begin(SD_CS);
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
audio.setVolume(10); // 0...21
audio.connecttoFS(SD, "Ensoniq-ZR-76-01-Dope-77.wav");
}
void loop()
{
audio.loop();
}
// optional
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);
}
Then something else must be supplying Audio.h
. Can you show the VSCode file explorer where all folders are expanded, and the full platformio.ini
?