Back to rankings

pschatzmann/arduino-audio-tools

C

Audio Tools (a powerful Audio library for Arduino, PlatformIO, IDF)

streamingcmakeaudiomusicdsparduino-librarycommucationdecodingencodingarduinofftdigital-signal-processing
Star Growth
Stars
2.3k
Forks
364
Weekly Growth
Issues
4
1k2k
Apr 2021Jan 2023Oct 2024Jul 2026
README

Audio Tools

Arduino Library Zephyr Library IDF Component License: GPL v3

Some basic header-only C++ classes that can be used for Audio Processing provided as Arduino and cmake C++ Library:

This functionality provides the glue which makes different audio processing components and libraries work together.

We also provide plenty of examples that demonstrate how to implement the different scenarios. The design philosophy is based on the Arduino conventions: we use the begin() and end() methods to start and stop the processing and we propagate the use of Streams.

We all know the Arduino Print and Stream classes: We usually use them to write out print messages and sometimes we use them to read the output from Serial, Files, Ethernet, etc. The same thing applies to “Audio Streams”: You can read audio data from “Audio Sources” and you write them to “Audio Sinks”.

Example

Here is a simple example which streams a file from the Flash Memory and writes it to I2S:

#include "AudioTools.h"
#include "StarWars30.h"

uint8_t channels = 2;
uint16_t sample_rate = 22050;
uint8_t bits_per_sample = 16;

MemoryStream music(StarWars30_raw, StarWars30_raw_len);
I2SStream i2s;  // Output to I2S
StreamCopy copier(i2s, music); // copies sound into i2s

void setup(){
    Serial.begin(115200);

    auto config = i2s.defaultConfig(TX_MODE);
    config.sample_rate = sample_rate;
    config.channels = channels;
    config.bits_per_sample = bits_per_sample;
    i2s.begin(config);

    music.begin();
}

void loop(){
    copier.copy();
}

Each stream has it's own configuration object that should be passed to the begin method. The defaultConfig() method is providing a default proposal which will usually "just work". Please consult the class documentation for the available configuration parameters. You can also easily adapt any provided examples: If you e.g. replace the I2SStream with the AnalogAudioStream class, you will get analog instead of digital output.

I suggest you continue to read the more detailed introduction.

Further examples can be found in the Wiki.

Dependent on the example you might need to install some additional libaries

AudioPlayer

The library also provides a versatile AudioPlayer. Further information can be found in the Wiki

Logging

The application uses a built in logger: By default we use the log level warning and the logging output is going to Serial. You can change this in your sketch by calling e.g:

AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Debug);

You can log to any object that is a subclass of Print and valid log level values are: Debug, Info, Warning, Error.

You can also deactivate the logging by changing USE_AUDIO_LOGGING to false in the AudioConfig.h to decrease the memory usage:

#define USE_AUDIO_LOGGING false

Show and Tell

Get some inspiration from projects that were using this library or share your projects with the community.

Documentation

Please use this before you raise any issue or start a discussion!

Support

I spent a lot of time to provide a comprehensive and complete documentation. So please read the documentation first and check the issues and discussions before posting any new ones on Github.

Open issues only for bugs and if it is not a bug, use a discussion: Provide enough information about

  • the selected scenario/sketch
  • what exactly you are trying to do
  • your hardware
  • your software version (from the Boards Manager) and library versions
  • what exactly your problem is

to enable others to understand and reproduce your issue.

Finally, don't send me any e-mails or post questions on my personal website!

Please note that discussions and issues which have already been answered before or where the answer can be found in the documentation may get deleted w/o reply.

Installation in Arduino

You can download the library as zip and call include Library -> zip library. Or you can git clone this project into the Arduino libraries folder e.g. with

cd  ~/Documents/Arduino/libraries
git clone https://github.com/pschatzmann/arduino-audio-tools.git

I recommend to use git because you can easily update to the latest version just by executing the git pull command in the project folder. If you want to use the library on other patforms, you can find further information in the Wiki.

This software is totally free, but you can make me happy by rewarding me with a treat

Related repositories
pathwaycom/pathway

Python ETL framework for stream processing, real-time analytics, LLM pipelines, and RAG.

PythonPyPIOtherbatch-processingkafka
pathway.com
62.6k1.7k
FFmpeg/FFmpeg

Mirror of https://git.ffmpeg.org/ffmpeg.git

COtherffmpegvideo
ffmpeg.org
62.3k14k
apache/kafka

Apache Kafka - A distributed event streaming platform

JavaMavenApache License 2.0scalakafka
kafka.apache.org
33.3k15.4k
webtorrent/webtorrent

⚡️ Streaming torrent client for the web

JavaScriptnpmMIT Licensewebtorrentbittorrent
webtorrent.io
31.3k2.9k
iperov/DeepFaceLive

Real-time face swap for PC streaming or video calls

PythonPyPIGNU General Public License v3.0deepfakereal-time
31k1.3k
ossrs/srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181, with codec support for H.264, H.265, AV1, VP9, AAC, Opus, and G.711.

C++MIT Licensertmplive-streaming
ossrs.io
29.1k5.7k
apache/rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.

JavaMavenApache License 2.0rocketmqcloud-native
rocketmq.apache.org
22.5k12k
bluenviron/mediamtx

Ready-to-use Media-over-QUIC / SRT / WebRTC / RTSP / RTMP / LL-HLS / MPEG-TS / RTP live media server and media proxy that allows to read, publish, proxy, record and playback real-time video and audio streams.

GoGo ModulesMIT Licensertsprtp
mediamtx.org
19.6k2.3k
nukeop/nuclear

Streaming music player that finds free music for you

TypeScriptnpmGNU Affero General Public License v3.0music-playermusic
nuclearplayer.com
18.1k1.3k
asciinema/asciinema

Terminal session recorder, streamer and player 📹

Rustcrates.ioGNU General Public License v3.0asciicastterminal
asciinema.org
17.6k1k
koel/koel

Music streaming solution that works.

PHPPackagistMIT Licenselaravelvue
koel.dev
17.2k2.1k
video-dev/hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.

TypeScriptnpmOtherhlshtml5
hlsjs.video-dev.org/demo
16.8k2.7k