I am looking to make a device that plays a short WAV file on an ESP32 with no extra hardware to make an analog audio signal. I am using this link for guidance on this project: ESP32 based audio player
Here is the error message in the Arduino IDE output:
C:\Users\vince\AppData\Local\Temp\.arduinoIDE-unsaved2026216-504-10vkk4v.ugmp\sketch_mar16a\sketch_mar16a.ino:4:26: error: no matching function for call to 'XT_Wav_Class::XT_Wav_Class(const unsigned int [157846])'
4 | XT_Wav_Class Sound(sample);
| ^
In file included from C:\Users\vince\AppData\Local\Temp\.arduinoIDE-unsaved2026216-504-10vkk4v.ugmp\sketch_mar16a\sketch_mar16a.ino:2:
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:146:9: note: candidate: 'XT_Wav_Class::XT_Wav_Class(const unsigned char*)'
146 | XT_Wav_Class(const unsigned char *WavData);
| ^~~~~~~~~~~~
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:146:43: note: no known conversion for argument 1 from 'const unsigned int [157846]' to 'const unsigned char*'
146 | XT_Wav_Class(const unsigned char *WavData);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:121:7: note: candidate: 'constexpr XT_Wav_Class::XT_Wav_Class(const XT_Wav_Class&)'
121 | class XT_Wav_Class : public XT_PlayListItem_Class
| ^~~~~~~~~~~~
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:121:7: note: no known conversion for argument 1 from 'const unsigned int [157846]' to 'const XT_Wav_Class&'
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:121:7: note: candidate: 'constexpr XT_Wav_Class::XT_Wav_Class(XT_Wav_Class&&)'
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:121:7: note: no known conversion for argument 1 from 'const unsigned int [157846]' to 'XT_Wav_Class&&'
exit status 1
Compilation error: no matching function for call to 'XT_Wav_Class::XT_Wav_Class(const unsigned int [157846])'
SoundData.h is a custom header file containing the audio file I want to play, and XT_DAC_Audio is a proper library allowing for easier control of the ESP's DAC.
Any help would be appreciated!
Welcome to the forum
Please post your full sketch
Exactly which ESP32 variant are you using ?
The error messages show you everything you need to know.
The function expects a const unsigned char *.
The code you haven't shown is passing a const unsigned int [157846].
Did you install the library? I didn't find it so gave up.
Here is the actual sketch:
#include "SoundData.h"
#include "XT_DAC_Audio.h"
XT_Wav_Class Sound(sample);
XT_DAC_Audio_Class DacAudio(25,0);
uint32_t DemoCounter=0;
void setup() {
Serial.begin(115200);
}
void loop() {
DacAudio.FillBuffer();
if(Sound.Playing==false)
DacAudio.Play(&Sound);
Serial.println(DemoCounter++);
}
Hi @vinnysworkshop ,
Welcome to the forum..
I'd have to say..
this ..
const unsigned int sample[] = {
// Paste your hex code here
};
is wrong in gitHub..
if you download the zip from the project page..
you'll see..
unsigned char sample[98216] = {
so change your int to char in your SoundData.h..
good luck.. ~q
Post that file's contents.
Where did you find XT_DAC_Audio library? I can't find it. I do find a mirror, but it is not a library as far as I can tell.
Follow the link in Post #1.
My security software blocks the site. I am done with this.
SoundData.h is a massive file which is mostly a WAV file in hexadecimal. The formatting of it is like this at the moment:
unsigned char sample[98216] = {
//Massive amounts of hexadecimal numbers
};
I have already modified SoundData.h since I first created it. It used to be
const unsigned int sample[] = {
//Hex
};
but I changed it upon request of a replier. It still doesn't work, and still shows the same error message.
Post a link to the exact version of the XT_DAC_Audio library you're using.
The same error exactly??
The 98216 is the size of the audio file that was in the zip downloaded from the project site..
Did you also add that because you should have only change int to char nothing else..
like..
const unsigned char sample[] ={...}
if you omit the size it will be calculated..
strange.. ~q
Then post it as an attachment.
I got the link from this website:
XTronical
I'm a new user, I cannot upload this as an attachment.
To post images etc. you need trust level 1, you can get there by:
- Entering at least 5 topics
- Reading at least 30 posts
- Spend a total of 10 minutes reading posts
Users at trust level 1 can...
- Use all core Discourse functions; all new user restrictions are removed
- Send PMs
- Upload images and attachments
Here is the error:
C:\Users\vince\OneDrive\Documents\Arduino\Bloody-what-the-Hell-of-a-program\Bloody-what-the-Hell-of-a-program.ino:4:26: error: no matching function for call to 'XT_Wav_Class::XT_Wav_Class(const unsigned int [157846])'
4 | XT_Wav_Class Sound(sample);
| ^
In file included from C:\Users\vince\OneDrive\Documents\Arduino\Bloody-what-the-Hell-of-a-program\Bloody-what-the-Hell-of-a-program.ino:2:
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:146:9: note: candidate: 'XT_Wav_Class::XT_Wav_Class(const unsigned char*)'
146 | XT_Wav_Class(const unsigned char *WavData);
| ^~~~~~~~~~~~
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:146:43: note: no known conversion for argument 1 from 'const unsigned int [157846]' to 'const unsigned char*'
146 | XT_Wav_Class(const unsigned char *WavData);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:121:7: note: candidate: 'constexpr XT_Wav_Class::XT_Wav_Class(const XT_Wav_Class&)'
121 | class XT_Wav_Class : public XT_PlayListItem_Class
| ^~~~~~~~~~~~
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:121:7: note: no known conversion for argument 1 from 'const unsigned int [157846]' to 'const XT_Wav_Class&'
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:121:7: note: candidate: 'constexpr XT_Wav_Class::XT_Wav_Class(XT_Wav_Class&&)'
c:\Users\vince\OneDrive\Documents\Arduino\libraries\XT_DAC_Audio/XT_DAC_Audio.h:121:7: note: no known conversion for argument 1 from 'const unsigned int [157846]' to 'XT_Wav_Class&&'
exit status 1
Compilation error: no matching function for call to 'XT_Wav_Class::XT_Wav_Class(const unsigned int [157846])'
And yes, I also added the 98216. I will try your new idea and see if it compiles or spits out any other errors.
looks like you are editing the wrong file as it is still compiling as an int not char so the changes are not being used..
is SoundData.h located in the same folder as the *.ino??
~q
There are multiple versions on that site. Like I said, tell us exactly which one you installed.