百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

arduino-audiokit

> 编程语言
开源

Arduino ADF/Audiokit HAL (支持 ESP32-A1S、AI-Thinker、LyraT for ES7148、ES7210、ES7243、ES8311、ES8347、ES8388、TAS5805M、AC101 音频芯片)

191 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Arduino ADF/Audiokit HAL (支持 ESP32-A1S、AI-Thinker、LyraT for ES7148、ES7210、ES7243、ES8311、ES8347、ES8388、TAS5805M、AC101 音频芯片)

Arduino ADF/AudioKit HAL


Please note that I do not support this library any more!

I recommend that you start to use my new, more flexible audio-driver library instead


There are different ESP32 Audio boards available that can be programmed with the Espressif ADF Framework.

The ADF Framework contains an abstraction layer to support different codec audio chips (ES8388, ES8311, AC101...) which need to be configured usually via I2C.

Unfortunately ADF can not be used in Arduino, but it would be quite useful to have this functionality also available.

Because I wanted to have a proper support of the AudioKit for my Arduino Audio Tools library and since my Audio Tools are header only, I decided to provide this functionality in a separate project.

I converted the audio_boards and their related drivers into an Arduino Library and provide an easy to use C++ class which configures both the CODEC and I2S. I also tried to abstract away all ESP32 specific funcationality.

The following functionality is supported

  • management of different audio codec (starting, stopping, setting volume etc)
  • optional I2S output (ESP32 only)
  • optional SD support via SPI
  • information about board specific pins

So with this project it should now get quite easy to use these boards also in Arduino.

Configuration

You must define your board and the default settings in the libraries/arduino-audiokit/src/AudioKitSettings.h file. Please note that the functionlity will not work properly if this is done in the Sketch.

 * @brief AUDIOKIT_BOARD selects a specic board:
 * 1) lyrat_v4_3
 * 2) lyrat_v4_2 - DRAFT Not Tested
 * 3) lyrat_mini_v1_1 - DRAFT Not Tested
 * 4) esp32_s2_kaluga_1_v1_2 - DRAFT Not Tested
 * 5) ai_thinker (ES8388) 2957 3478 A149 2762
 * 6) ai_thinker (AC101) 2762 2957
 * 7) ai_thinker (ES8388) 2957
 * 8) esp32_s3_box DRAFT Not Tested
 * 9) esp32_s3_box_lite.h DRAFT Not Tested
 * 10) generic_es8388
 * 11) generic_es8311
 */

#define AUDIOKIT_BOARD 1

Here the lyrat v4.3 has been selected. Further information can be found in the Wiki

Unfortunately AI Thinker created a big mess with their boards using different Audio chips and pin assingments, all of them using the same version number. You might need to make an educated guess by looking at the number after the version and if you have a 2957 board, you need to check all 3 options!

Example Sketch

Here is an example sketch that writes audio data to the audio kit board via I2S. By default I2S is set up as master and the codec as slave, the sample size is 16 bits and the sample rate is 44.1k/sec - if you did not change the default settings.

You can adjust these parameters by setting your requested values in the cfg below:

cpp
#include "AudioKitHAL.h"
#include "SineWaveGenerator.h"

AudioKit kit;
SineWaveGenerator wave;
const int BUFFER_SIZE = 1024;
uint8_t buffer[BUFFER_SIZE];

void setup() {
  Serial.begin(115200);
  // open in write mode
  auto cfg = kit.defaultConfig(KitOutput);
  cfg.sample_rate = AUDIO_HAL_22K_SAMPLES;
  kit.begin(cfg);

  // 1000 hz
  wave.setFrequency(1000);
  wave.setSampleRate(cfg.sampleRate());
}

void loop() {
  size_t l = wave.read(buffer, BUFFER_SIZE);
  kit.write(buffer, l);
}

However I recommend to use my Arduino Audio Tools Library which implements an easy to use Stream API with additional functionality on top of this and it has plenty of examples.

You can also use this functionality just to set up the codec chip w/o doing any input or output. In this case you can set cfg.is_i2s_active = false;

Logging

The functionality has a built in logger. The default log level has been set to Warning. You can change it like this:

cpp
  LOGLEVEL_AUDIOKIT = AudioKitDebug; // or AudiKitInfo, AudioKitWarning, AudioKitError

Documentation

Here is the documentaion of the AudioKit class.

Further information can be found in the Wiki and my Blogs.

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 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!

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

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

If you want to use the library in PlatformIO, you can find a detailed description in the Wiki.

Supported Devices / Processors

The examples have been tested with a AI Thinker v2.2: both versions - the one with the ES8388 and the other with the AC101. I also tested with a LyraT. I do not own any other AudioKit devices, so I can't guarantee that they work properly. I also made sure that the code is compiling on other processors, but I did not perform any tests. Please note that in this case because I2S is not standardized in Arduino, you need to take care of the I2S initialization and processing yourself on non ESP32 boards.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Cac101adfarduino-libraryaudiokit

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言