Skip to content

Design Principles

Phil Schatzmann edited this page Mar 19, 2025 · 16 revisions

This project is guided by the following goals:

  • Use a Header only implementation (so that there is no need for any compiled static or dynamic library).
  • Use base concept of Arduino Streams to read and write Audio Data, so that we can easily use the existing Arduino classes as input or output
  • Provide a comprehensive and complete set of audio related functionality
  • Separate between Core Audio Functionality and Extended Functionality
    • Provide all core classes by importing "AudioTools.h":
    • Extended functionality which relies on external libraries needs to be imported separately:
  • Just adding an #include "AudioTools.h" should not impact the program storage and global variables! To speed up the compile time, you can use #include "AudioToolsConfig.h" instead which does not automatically include any functionality.
  • Separate between basic API (e.g I2SStream) and platform specific driver classes: Platform specific differences are handled in AudioConfig.h where you can configure, activate or deactivate specific functionality.
  • Try to be as platform independent as possible:
    • If compiled outside of Arduino use our own Stream and Print implementation
    • Avoid any other Arduino or C++ data structures that might not be available in all platforms (e.g. Arduino String, c++ string)
    • Use the AudioConfig.h to define global parameters and platform specific differences
  • Support cmake so that software can be built on the desktop and other platforms
  • This library uses RAII: the objects should usually clean up themselves w/o the need to call end() when they leave the scope. This has not been rigorously tested with all the classes, so let me now if you find a bug. Be careful with objects from outside of this framework: e.g. File does not implement RAII so you need to call close to prevent a memory leak!
Clone this wiki locally