{"id":13418166,"url":"https://github.com/pschatzmann/arduino-audiokit","last_synced_at":"2025-03-15T03:30:38.210Z","repository":{"id":39828839,"uuid":"436719107","full_name":"pschatzmann/arduino-audiokit","owner":"pschatzmann","description":"Arduino ADF/Audiokit HAL (support for ESP32-A1S, AI-Thinker, LyraT for ES7148, ES7210, ES7243, ES8311, ES8347, ES8388, TAS5805M, AC101 audio chips)","archived":true,"fork":false,"pushed_at":"2024-02-09T15:23:37.000Z","size":1091,"stargazers_count":153,"open_issues_count":7,"forks_count":41,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-07-31T22:41:41.084Z","etag":null,"topics":["ac101","adf","arduino-library","audiokit","es7148","es7210","es8311","es8347","es8388","lyrat","tas5805m"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pschatzmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-09T18:21:55.000Z","updated_at":"2024-07-06T11:52:41.000Z","dependencies_parsed_at":"2023-09-21T21:30:54.741Z","dependency_job_id":"4077b668-460a-4d77-b841-d1ce9da18255","html_url":"https://github.com/pschatzmann/arduino-audiokit","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschatzmann%2Farduino-audiokit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschatzmann%2Farduino-audiokit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschatzmann%2Farduino-audiokit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschatzmann%2Farduino-audiokit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pschatzmann","download_url":"https://codeload.github.com/pschatzmann/arduino-audiokit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243681006,"owners_count":20330152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ac101","adf","arduino-library","audiokit","es7148","es7210","es8311","es8347","es8388","lyrat","tas5805m"],"created_at":"2024-07-30T22:00:59.188Z","updated_at":"2025-03-15T03:30:38.193Z","avatar_url":"https://github.com/pschatzmann.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"\n# Arduino ADF/AudioKit HAL\n\n---\n___Please note that I do not support this library any more!___ \n\n___I recommend that you start to use my new, more flexible [audio-driver library](https://github.com/pschatzmann/arduino-audio-driver) instead___\n\n---\n\nThere are different ESP32 Audio boards available that can be programmed with the Espressif ADF Framework.\n\n\u003cimg src=\"https://pschatzmann.github.io/Resources/img/audio-toolkit.png\" alt=\"Audio Kit\" /\u003e\n\nThe ADF Framework contains an abstraction layer to support different codec audio chips (ES8388, ES8311, AC101...) which need to be configured usually via I2C. \n\nUnfortunately ADF can not be used in Arduino, but it would be quite useful to have this functionality also available.\n\nBecause I wanted to have a proper support of the AudioKit for my [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools) library and since my Audio Tools are  header only, I decided to provide this functionality in a separate project.\n\nI 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. \n\nThe following functionality is supported\n\n- management of different audio codec (starting, stopping, setting volume etc)\n- optional I2S output (ESP32 only)\n- optional SD support via SPI\n- information about board specific pins\n\nSo with this project it should now get quite easy to use these boards also in Arduino. \n\n## Configuration\n\nYou 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. \n\n```\n * @brief AUDIOKIT_BOARD selects a specic board:\n * 1) lyrat_v4_3\n * 2) lyrat_v4_2 - DRAFT Not Tested\n * 3) lyrat_mini_v1_1 - DRAFT Not Tested\n * 4) esp32_s2_kaluga_1_v1_2 - DRAFT Not Tested\n * 5) ai_thinker (ES8388) 2957 3478 A149 2762\n * 6) ai_thinker (AC101) 2762 2957\n * 7) ai_thinker (ES8388) 2957\n * 8) esp32_s3_box DRAFT Not Tested\n * 9) esp32_s3_box_lite.h DRAFT Not Tested\n * 10) generic_es8388\n * 11) generic_es8311\n */\n\n#define AUDIOKIT_BOARD 1\n\n```\nHere the lyrat v4.3 has been selected. Further information can be found in the [Wiki](https://github.com/pschatzmann/arduino-audiokit/wiki)\n\nUnfortunately 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!\n\n\n## Example Sketch\n\nHere 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. \n\nYou can adjust these parameters by setting your requested values in the cfg below:\n\n```C++\n#include \"AudioKitHAL.h\"\n#include \"SineWaveGenerator.h\"\n\nAudioKit kit;\nSineWaveGenerator wave;\nconst int BUFFER_SIZE = 1024;\nuint8_t buffer[BUFFER_SIZE];\n\nvoid setup() {\n  Serial.begin(115200);\n  // open in write mode\n  auto cfg = kit.defaultConfig(KitOutput);\n  cfg.sample_rate = AUDIO_HAL_22K_SAMPLES;\n  kit.begin(cfg);\n\n  // 1000 hz\n  wave.setFrequency(1000);\n  wave.setSampleRate(cfg.sampleRate());\n}\n\nvoid loop() {\n  size_t l = wave.read(buffer, BUFFER_SIZE);\n  kit.write(buffer, l);\n}\n\n```\n\nHowever __I recommend__ to use my [Arduino Audio Tools Library](https://github.com/pschatzmann/arduino-audio-tools) which implements an easy to use Stream API with additional functionality   on top of this and it has plenty of [examples](https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-audiokit).\n\nYou 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; \n \n## Logging\n\nThe functionality has a built in logger. The default log level has been set to Warning. You can change it like this:\n\n```C++\n  LOGLEVEL_AUDIOKIT = AudioKitDebug; // or AudiKitInfo, AudioKitWarning, AudioKitError\n\n```\n\n## Documentation\n\nHere is the documentaion of the [AudioKit class](https://pschatzmann.github.io/arduino-audiokit/html/classaudiokit_1_1_audio_kit.html).\n\nFurther information can be found in the [Wiki](https://github.com/pschatzmann/arduino-audiokit/wiki) and my [Blogs](https://www.pschatzmann.ch/home/tag/esp32audiokit/).\n\n## Support\n\nI spent a lot of time to provide a comprehensive and complete documentation.\nSo please read the documentation first and check the issues and discussions before posting any new ones on Github.\n\nOpen issues only for bugs and if it is not a bug, use a discussion: Provide enough information about \n- the selected scenario/sketch \n- what exactly you are trying to do\n- your hardware\n- your software versions\n- what exactly your problem is\n\nto enable others to understand and reproduce your issue.\n\nFinally, __don't__ send me any e-mails or post questions on my personal website! \n\n## Installation in Arduino\n\nYou can download the library as zip and call include Library -\u003e zip library. Or you can git clone this project into the Arduino libraries folder e.g. with\n\n```\ncd  ~/Documents/Arduino/libraries\ngit clone https://github.com/pschatzmann/arduino-audiokit.git\n\n```\n\nIf you want to use the library in PlatformIO, you can find a [detailed description in the Wiki](https://github.com/pschatzmann/arduino-audiokit-hal/wiki/PlatformIO).\n\n\n## Supported Devices / Processors\n\nThe 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.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpschatzmann%2Farduino-audiokit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpschatzmann%2Farduino-audiokit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpschatzmann%2Farduino-audiokit/lists"}