ESP32-A2DP: Redesigning the I2S output

I am providing a Bluetooth A2DP audio library for the ESP32, which can receive audio from a Bluetooth Source (e.g. a mobile phone) and play it via the I2S API provided by the IDF framework. Unfortunately Espressif has decided to go for a completely new I2S API which means that my integration needs to be rewritten. For quite some time now, I am supporting this new API via my AudioTools library, and I was considering Read more…

Arduino Audio Tools: Using Tasks

So far I have always used the Arduino loop to do the audio processing with the hint, that there must not be any longer delay added to the processing. If you have some blocking functions in the loop, the solution is to run the audio in a separate task. I have added some nice concurrency C++ classes to my framework which help that we can keep the sketch quite short. Arduino Example Sketch I am Read more…

Libhelix – Behind the Scene

I am providing an Arduino MP3 and AAC decoder library for Arduino which is based on libhelix. In this library I added a simple Arduino inspired C++ API. This was one of my first libraries and I found my implementation quite confusing. So it was time to do some refactoring to clean things up. After all, the C API should be quite easy to use and there must be some reason why I ended up Read more…

Changing the Sample Size to 32 bits (e.g. for an ES9018 DAC)

There are some DACs out there that only support 32 bits: E.g the ES9018K2M module which is sold as high end HIFI DAC. Therefore sometimes it is necessary to change the sample size e.g. from 16 to 32 bits when your codec produces 16 bits. This can be easily done with the help of the NumberFormatConverterStream class of the Arduino Audio Tools library: I2SStream i2s; // final output of decoded stream NumberFormatConverterStream fc(i2s); // write Read more…

Using Mozzi with a Bluetooth Speaker

Mozzi brings your Arduino to life by allowing it to produce much more complex and interesting growls, sweeps and chorusing atmospherics. These sounds can be quickly and easily constructed from familiar synthesis units like oscillators, delays, filters and envelopes. One of the strong points of my AudioTools library is, that we also support extensive communication scenarios. In this example we show how we can output the sound generated by Mozzi to a Bluetooth Speaker using Read more…

I2S Output of 4 Channels with an ESP32

Recently there was a discussion on how to output more then 2 channels via I2S. I2S is limited to 2 channels, but the ESP32 has 2 I2S ports, so we can output a maximum of 4 channels! Arduino Sketch I have added a small example that shows how this can be done using my AudioTools library: #include <SPI.h> #include <SD.h> #include “AudioTools.h” #include “AudioCodecs/CodecMP3Helix.h” const int chipSelect=10; AudioInfo info(44100, 2, 16); I2SStream i2s_1; // final Read more…

Mozzi Revisited

Mozzi brings your Arduino to life by allowing it to produce much more complex and interesting growls, sweeps and chorusing atmospherics. These sounds can be quickly and easily constructed from familiar synthesis units like oscillators, delays, filters and envelopes. Mozzi supports quite a lot of different Micro controllers, but it does not have any output method that would let you capture the audio to a stream of data, so I have added some simple integration Read more…

AudioTools, ESP32 and PSRAM revisited

Arrays The best way to allocate an Array of data in the AudioTools is by using a Vector. E.g. Vector<int16_t> vector{100000}; is allocating a vector of 100’000 2 byte signed integers. RAM and PSRAM The ESP32 has a few hundred kilobytes of internal RAM, residing on the same die as the rest of the chip components. It can be insufficient for audio, so it has the ability to use up to 4 MB of external Read more…

Pure Data (PD) and AudioTools

Pure Data (or just “Pd”) is an open source visual programming language for multimedia. Pure Data is developed by Miller Puckette since 1996 and you can find it on his official website along with the official documentation and other related resources. I wanted to have the possibility to run PD patches on microcontrollers. In order to achieve this I am using the hvcc hcompiler that can translate a pd file to c and c++ code. Read more…

Arduino Audio Tools – Receiving Audio using VBAN

Quite some time ago, I demonstrated how you can send Audio to your mobile phone using the VBAN protocol. Recently I have added support for receiving data to your microcontroller as well. With this you can use this protocol to build some cool two way communictations applications (e.g. walkie-talkie). Arduino Sketch Here is a sketch that receives the data and just outputs the audio with I2S. Just replace the output class with whatever you want! Read more…