{"id":6236,"date":"2024-04-07T15:02:38","date_gmt":"2024-04-07T13:02:38","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=6236"},"modified":"2024-04-07T15:04:22","modified_gmt":"2024-04-07T13:04:22","slug":"esp32-a2dp-redesigning-the-i2s-output","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/","title":{"rendered":"ESP32-A2DP: Redesigning the I2S output"},"content":{"rendered":"<p>I am providing a <a href=\"https:\/\/github.com\/pschatzmann\/ESP32-A2DP\">Bluetooth A2DP audio library<\/a> for the ESP32, which can receive audio from a Bluetooth Source (e.g. a mobile phone) and play it via the <a href=\"https:\/\/docs.espressif.com\/projects\/esp-idf\/en\/v4.2.3\/esp32\/api-reference\/peripherals\/i2s.html\">I2S API<\/a> provided by the IDF framework.<\/p>\n<p>Unfortunately Espressif has decided to go for a <a href=\"https:\/\/docs.espressif.com\/projects\/esp-idf\/en\/stable\/esp32\/api-reference\/peripherals\/i2s.html\">completely new I2S API<\/a> which means that my integration needs to be rewritten.<\/p>\n<p>For quite some time now, I am supporting this new API via my <a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\">AudioTools library<\/a>, and I was considering to remove the I2S output functiontlity completely from my A2DP library and just use it a data provider for the AudioTools.<\/p>\n<p>My latest design however looks as follows:<\/p>\n<ul>\n<li>I am providing a separate <strong>output API<\/strong> in the A2DP library with the following class implementations:\n<ul>\n<li>Output to any <strong>AudioTools audio sink<\/strong> and subclass of Arduino <strong>Print<\/strong> using <a href=\"https:\/\/pschatzmann.github.io\/ESP32-A2DP\/html\/class_bluetooth_a2_d_p_output_audio_tools.html\">BluetoothA2DPOutputAudioTools<\/a><\/li>\n<li>Output with the <strong>legacy I2S<\/strong> API using <a href=\"https:\/\/pschatzmann.github.io\/ESP32-A2DP\/html\/class_bluetooth_a2_d_p_output_legacy.html\">BluetoothA2DPOutputLegacy<\/a><\/li>\n<li><strong>Combination<\/strong> of the above using <a href=\"https:\/\/pschatzmann.github.io\/ESP32-A2DP\/html\/class_bluetooth_a2_d_p_output_default.html\">BluetoothA2DPOutputDefault<\/a>. This is the <strong>default<\/strong> selection.<\/li>\n<\/ul>\n<\/li>\n<li>If you use a Arduino ESP32 core version &lt; 3.0.0 the legacy functionality continues to work<\/li>\n<li>Starting from now, you can use the new API independently on the ESP32 core version.<\/li>\n<\/ul>\n<p>I have updated the <strong>documentation and examples<\/strong> to use the new API.<\/p>\n<p>I recommend to use the new API because this way you can be sure that your sketch will work in <strong>future ESP32 cores versions<\/strong>.<\/p>\n<h2>Example Sketch with the new API<\/h2>\n<pre><code>#include \"AudioTools.h\n#include \"BluetoothA2DPSink.h\"\n\nI2SStream i2s;\nBluetoothA2DPSink a2dp_sink(i2s);\n\nvoid setup() {\n    auto cfg = i2s.defaultConfig();\n    cfg.pin_bck = 14;\n    cfg.pin_ws = 15;\n    cfg.pin_data = 22;\n    i2s.begin(cfg);\n\n    a2dp_sink.start(\"MyMusic\");\n}\n\nvoid loop() {\n}\n<\/code><\/pre>\n<p>This comes at the cost, that you also <strong>need to install the AudioTools library<\/strong> now!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am providing a Bluetooth A2DP audio library for the ESP32, which can receive audio from a Bluetooth Source (e.g. a mobile phone) and play it via the I2S API provided by the IDF framework. Unfortunately Espressif has decided to go for a completely new I2S API which means that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4151,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_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":[],"class_list":["post-6236","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-machine-sound"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ESP32-A2DP: Redesigning the I2S output - 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\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ESP32-A2DP: Redesigning the I2S output - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"I am providing a Bluetooth A2DP audio library for the ESP32, which can receive audio from a Bluetooth Source (e.g. a mobile phone) and play it via the I2S API provided by the IDF framework. Unfortunately Espressif has decided to go for a completely new I2S API which means that [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-07T13:02:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-07T13:04:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/A2DP.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"ESP32-A2DP: Redesigning the I2S output\",\"datePublished\":\"2024-04-07T13:02:38+00:00\",\"dateModified\":\"2024-04-07T13:04:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/\"},\"wordCount\":257,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/A2DP.jpg\",\"articleSection\":[\"Arduino\",\"Machine Sound\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/\",\"name\":\"ESP32-A2DP: Redesigning the I2S output - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/A2DP.jpg\",\"datePublished\":\"2024-04-07T13:02:38+00:00\",\"dateModified\":\"2024-04-07T13:04:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/A2DP.jpg\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/A2DP.jpg\",\"width\":600,\"height\":450},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/04\\\/07\\\/esp32-a2dp-redesigning-the-i2s-output\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ESP32-A2DP: Redesigning the I2S output\"}]},{\"@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":"ESP32-A2DP: Redesigning the I2S output - 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\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/","og_locale":"en_US","og_type":"article","og_title":"ESP32-A2DP: Redesigning the I2S output - Phil Schatzmann","og_description":"I am providing a Bluetooth A2DP audio library for the ESP32, which can receive audio from a Bluetooth Source (e.g. a mobile phone) and play it via the I2S API provided by the IDF framework. Unfortunately Espressif has decided to go for a completely new I2S API which means that [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/","og_site_name":"Phil Schatzmann","article_published_time":"2024-04-07T13:02:38+00:00","article_modified_time":"2024-04-07T13:04:22+00:00","og_image":[{"width":600,"height":450,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/A2DP.jpg","type":"image\/jpeg"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"ESP32-A2DP: Redesigning the I2S output","datePublished":"2024-04-07T13:02:38+00:00","dateModified":"2024-04-07T13:04:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/"},"wordCount":257,"commentCount":4,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/A2DP.jpg","articleSection":["Arduino","Machine Sound"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/","url":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/","name":"ESP32-A2DP: Redesigning the I2S output - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/A2DP.jpg","datePublished":"2024-04-07T13:02:38+00:00","dateModified":"2024-04-07T13:04:22+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/A2DP.jpg","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/A2DP.jpg","width":600,"height":450},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/04\/07\/esp32-a2dp-redesigning-the-i2s-output\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"ESP32-A2DP: Redesigning the I2S output"}]},{"@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\/6236","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=6236"}],"version-history":[{"count":14,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6236\/revisions"}],"predecessor-version":[{"id":6250,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6236\/revisions\/6250"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/4151"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=6236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=6236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=6236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}