0 It's not working
Phil Schatzmann edited this page 2024-08-18 13:39:00 +02:00

The examples have been tested, but there can still be many reasons why you might fail.

Make sure that you use an actual version of the Arduino core for your processor. In Arduino you can check the version in the Tools -> Board Manager. For the ESP32 the current version is 2.0.13 and if you are still using 1.0.6 you are several years behind!

Also make sure that you use the latest version of all libraries!

Quite often, total beginners start with the most complicated sketch and they wonder what to do if something is not working!

I only can discourage you to do this: You need to get to know the board and the individual components first. The best way is to start with the easiest sketch possible and test the input and the output separately: Only then you can be sure that things will work, if you put them together!

So if something is not working, take one step back and figure out how you can find the root cause of your problem. The most frequent errors are:

  • wiring of the components does not correspond with the pins defined in the software
  • If your sketch does not fit into the available program memory of an ESP32 you just forgot to set a proper partition scheme in the Arduino Tools menu!
  • the SD is not working because of the above or an improper formatting or you did not install the right library or you just use a file that does not exist.
  • Wifi does not connect e.g. because of a wrong ssid, password or insufficient available RAM
  • Your own sketch is inconsistent and you update variables that are not used
  • You forgot to change the log level to Warning or Error
  • You introduced some delays which causes the audio to underflow. This is also the case if you forgot to set the log level to Warning! And you are pulling your own leg if you add print statements in the loop...
  • You forgot to set up the audio component correctly

You can change the log level to Info or even Debug, to see in detail what the application is doing. Sometimes it can also be a bug in the library, that might have been corrected already, so try to use the latest version. Try to proof first that the basic functionality is working w/o my library!

Audio Sink

To test the output I suggest that you start with a sine generator that sends the output to the audio sink. Here you can experiment by

  • changing the audio sink
  • change the audio parameters: sample_rate, channels, bits_per_sample
  • change the i2s format
  • etc

Please note that if you change the bits_per_sample to 32, you also need to change the relevant template parameters from <int16_t> to <int32_t> or bad things will happen!

Audio Source

To test the input I suggest that you start with a sketch that visualizes the audio waves: check if you get valid audio or just noise and get to know the parameters! I recommend to record a sine wave e.g. from here and to display it on the Serial Monitor: you should see a sine wave there as well!

If you are unsure how sound wave should look like, you can find a picture in the introduction. You can also try out the built in WAV server, so you can listen to the sound on your PC.

Some microphones produce noise on one channel using 16 bits, that can be filtered out. But here again you need to look at the data to figure out on which channel you have the problem, and after applying the filter if it has been resolved! Above all check the available WIKI documentation and look at the already answered issues/discussions.

Core Functionality

There are plenty of resources on the internet that teach you how to

And often there are also example sketches in Arduino that let you test the functionality.

If you are stuck: Google is your friend!