{"id":4011,"date":"2021-12-15T12:00:44","date_gmt":"2021-12-15T11:00:44","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=4011"},"modified":"2023-02-19T16:15:46","modified_gmt":"2023-02-19T15:15:46","slug":"audiokit-audio-input","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/","title":{"rendered":"AudioKit: Processing Audio Input"},"content":{"rendered":"<p>As you might know from my <a href=\"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/06\/the-ai-thinker-audio-kit-experience-or-nothing-is-right\/\">last posts<\/a> I am currently extending my <a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\">Arduino Audio Tools<\/a> library to support the <a href=\"https:\/\/docs.ai-thinker.com\/en\/esp32-audio-kit\">AI Thinker Audio Kit<\/a> which is based on the ES8388 audio chip.<\/p>\n<p>The <strong>AI Thinker ESP32 AudioKit<\/strong> was raising my interest because it also provides <strong>audio input<\/strong> in the form of built in <strong>microphones<\/strong> and an <strong>line-in jack<\/strong>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/pschatzmann.github.io\/Resources\/img\/audio-toolkit.png\" alt=\"Audio Kit\" \/><\/p>\n<p>So far I demonstrated how to output sound to the AudioKit and it is about time to look into the input of audio.<\/p>\n<p>The simplest functionality I can think of is to input the audio signal <strong>from the jack and output it via the speaker<\/strong>.<\/p>\n<h2>Arduino Sketch<\/h2>\n<p>Here is the sketch:<\/p>\n<pre><code>#include \"AudioTools.h\"\n#include \"AudioLibs\/AudioKit.h\"\n\nusing namespace audio_tools;  \n\nAudioKitStream kit; \/\/ Access I2S as stream\nStreamCopy copier(kit, kit); \/\/ copy kit to kit\n\n\/\/ Arduino Setup\nvoid setup(void) {\n    Serial.begin(115200);\n    AudioLogger::instance().begin(Serial, AudioLogger::Warning);\n\n    auto cfg = kit.defaultConfig(RXTX_MODE);\n    cfg.input_device = AUDIO_HAL_ADC_INPUT_LINE2;\n    kit.begin(cfg);\n\n}\n\n\/\/ Arduino loop - copy data\nvoid loop() {\n    copier.copy();\n}\n\n<\/code><\/pre>\n<p>It is amazingly short &#8211; because all we need to do is to copy from the kit (input) to the kit (output). I just needed to specify the input device to be <strong>AUDIO_HAL_ADC_INPUT_LINE2<\/strong>, which is the audio jack!<\/p>\n<p>I connected the output of my IPAD to the audio jack of the AudioKit, pumped up the volume and &#8230; the music was playing!<\/p>\n<h3>Dependencies<\/h3>\n<p>You need to install the following libraries:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\">Arduino Audio Tolls<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/pschatzmann\/arduino-audiokit\">AudioKit<\/a><\/li>\n<\/ul>\n<h3>Github<\/h3>\n<p>The (up to date) <a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\/tree\/main\/examples\/examples-audiokit\/streams-audiokit-audiokit\">example source code<\/a> can be found on Github and is available in the Arduino examples when you install the libraries.<\/p>\n<h3>Addendum<\/h3>\n<p>After some playing around I confirmed the <a href=\"https:\/\/github.com\/Ai-Thinker-Open\/ESP32-A1S-AudioKit\/issues\/31\">open bug<\/a>, that both the microphone line and aux in are active at the same time!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you might know from my last posts I am currently extending my Arduino Audio Tools library to support the AI Thinker Audio Kit which is based on the ES8388 audio chip. The AI Thinker ESP32 AudioKit was raising my interest because it also provides audio input in the form [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3882,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[20,22],"tags":[28],"class_list":["post-4011","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-machine-sound","tag-esp32audiokit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>AudioKit: Processing Audio Input - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AudioKit: Processing Audio Input - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"As you might know from my last posts I am currently extending my Arduino Audio Tools library to support the AI Thinker Audio Kit which is based on the ES8388 audio chip. The AI Thinker ESP32 AudioKit was raising my interest because it also provides audio input in the form [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-15T11:00:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-19T15:15:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"AudioKit: Processing Audio Input\",\"datePublished\":\"2021-12-15T11:00:44+00:00\",\"dateModified\":\"2023-02-19T15:15:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/\"},\"wordCount\":239,\"commentCount\":16,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/audio-toolkit.png\",\"keywords\":[\"ESP32AudioKit\"],\"articleSection\":[\"Arduino\",\"Machine Sound\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/\",\"name\":\"AudioKit: Processing Audio Input - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/audio-toolkit.png\",\"datePublished\":\"2021-12-15T11:00:44+00:00\",\"dateModified\":\"2023-02-19T15:15:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/audio-toolkit.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/audio-toolkit.png\",\"width\":800,\"height\":500},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/12\\\/15\\\/audiokit-audio-input\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AudioKit: Processing Audio Input\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AudioKit: Processing Audio Input - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/","og_locale":"en_US","og_type":"article","og_title":"AudioKit: Processing Audio Input - Phil Schatzmann","og_description":"As you might know from my last posts I am currently extending my Arduino Audio Tools library to support the AI Thinker Audio Kit which is based on the ES8388 audio chip. The AI Thinker ESP32 AudioKit was raising my interest because it also provides audio input in the form [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/","og_site_name":"Phil Schatzmann","article_published_time":"2021-12-15T11:00:44+00:00","article_modified_time":"2023-02-19T15:15:46+00:00","og_image":[{"width":800,"height":500,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","type":"image\/png"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"AudioKit: Processing Audio Input","datePublished":"2021-12-15T11:00:44+00:00","dateModified":"2023-02-19T15:15:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/"},"wordCount":239,"commentCount":16,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","keywords":["ESP32AudioKit"],"articleSection":["Arduino","Machine Sound"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/","url":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/","name":"AudioKit: Processing Audio Input - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","datePublished":"2021-12-15T11:00:44+00:00","dateModified":"2023-02-19T15:15:46+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","width":800,"height":500},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/12\/15\/audiokit-audio-input\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"AudioKit: Processing Audio Input"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/4011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=4011"}],"version-history":[{"count":15,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/4011\/revisions"}],"predecessor-version":[{"id":5383,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/4011\/revisions\/5383"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/3882"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=4011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=4011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=4011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}