Quite some time ago I have identified Maximilian as interesting tool which can be used to implement synthezisers. Maximilian is a cross-platform and multi-target audio synthesis and signal processing library. So I was wondering if it is possible to use it on Arduino based Microcontrollers.

In the meantime the adapted library is compiling after some slight changes. After that I started to extend my Arduino Audio Tools to provide an nice integration and a first sine test sound generator is working as well.

Arduino Sketch

Here is the example that I have used for my first tests. It is using the AudioKitStream as output. Naturally you can change this to any other supported output stream (e.g. I2SStream).

#include "AudioTools.h"
#include "AudioLibs/MaximilianDSP.h"
#include "AudioLibs/AudioKit.h"

// Define output
AudioKitStream out;
Maximilian maximilian(out);

//This shows how the fundamental building block of digital audio - the sine wave.
maxiOsc mySine;//One oscillator - can be called anything. Can be any of the available waveforms.

void setup() {//some inits
  // setup logging
  Serial.begin(115200);
  AudioLogger::instance().begin(Serial, AudioLogger::Info);
  // setup Aduio output
  auto cfg = out.defaultConfig(TX_MODE);
  out.begin(cfg);
  maximilian.begin(cfg);
}

void play(double *output) {
    output[0]=mySine.sinewave(440);
    output[1]=output[0];
}

// Arduino loop
void loop() {
    maximilian.copy();
}

A complete set of converted examples can be found on Github. However, please note that not all examples have been tested yet…


2 Comments

P_VERBAKEL · 6. March 2022 at 15:43

In between others I get the following error on compilation:

Compiling sketch

“C:\Users\Pierre\AppData\Local\Arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0/bin/xtensa-esp32-elf-g++” -DESP_PLATFORM “-DMBEDTLS_CONFIG_FILE=\”mbedtls/esp_config.h\”” -DHAVE_CONFIG_H -DGCC_NOT_5_2_0=0 -DWITH_POSIX “-IC:\Users\Pierre\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/config” “-

In file included from C:\Users\Pierre\Documents\Arduino\libraries\arduino-audio-tools-main\src/AudioI2S/I2SStream.h:7:0,

<code> from C:\Users\Pierre\Documents\Arduino\libraries\arduino-audio-tools-main\src/AudioTools.h:17,

<pre><code> from C:\Users\Pierre\Documents\Arduino\ESP32_Audio\ESP32_Maximilian_DSP_Schatzmann_1\ESP32_Maximilian_DSP_Schatzmann_1.ino:3:
</code></pre>

</code>

C:\Users\Pierre\Documents\Arduino\libraries\arduino-audio-tools-main\src/AudioTools/AudioStreams.h:68:15: error: ‘virtual int audio_tools::AudioStreamX::availableForWrite()’ marked ‘override’, but does not override

    pschatzmann · 6. March 2022 at 16:00

    Try to make sure that you use at least Arduino ESP 1.0.6. But note that the latest release is 2.0.1 now

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *