{"id":6484,"date":"2024-11-16T08:15:37","date_gmt":"2024-11-16T07:15:37","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=6484"},"modified":"2024-11-16T01:11:31","modified_gmt":"2024-11-16T00:11:31","slug":"the-esp32-i2s-24-bit-mystery","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/","title":{"rendered":"The ESP32 I2S 24 bit Mystery"},"content":{"rendered":"<p>I had the issue that the 24 bit output via A2DP was not working, but <a href=\"https:\/\/github.com\/pschatzmann\/ESP32-A2DP\/blob\/main\/examples\/bt_music_receiver_32bits\/bt_music_receiver_32bits.ino\">the corresponding 32 bit example<\/a> was just working fine.<\/p>\n<p>So I decided to double check the I2S output with the help of a <strong>logical analyzer<\/strong>.<\/p>\n<h3>Checking 16 bits<\/h3>\n<p>First I was double checking how the working 16 bit is showing up. So I used the following Arduino Sketch which was just outputting some unique numbers per byte:<\/p>\n<pre><code>#include \"AudioTools.h\"\n\nAudioInfo info{44100, 2, 16};\nI2SStream i2s;\nuint8_t data[] = {0x01,0x02,0x03,0x04};\n\nvoid setup() {\n  auto cfg = i2s.defaultConfig(TX_MODE);\n  cfg.copyFrom(info);\n  i2s.begin(cfg);\n\n}\n\nvoid loop() {\n  i2s.write(data, sizeof(data));\n}\n\n<\/code><\/pre>\n<p>This is showing up <strong>in PulseView<\/strong> as follows, with the byte sequence reversed:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2024\/11\/16bits.png\" alt=\"\"  \/><\/p>\n<h3>Checking 24 bits<\/h3>\n<p>So it is time now to check the output of 24 bits:<\/p>\n<pre><code>#include \"AudioTools.h\"\n\nAudioInfo info{44100, 2, 24};\nI2SStream i2s;\nuint8_t data[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08};\n\nvoid setup() {\n  auto cfg = i2s.defaultConfig(TX_MODE);\n  cfg.copyFrom(info);\n  i2s.begin(cfg);\n\n}\n\nvoid loop() {\n  i2s.write(data, sizeof(data));\n}\n<\/code><\/pre>\n<p>So as indicated in the documentation, the least significant (and in this case the first) byte gets ignored:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2024\/11\/24bit.png\" alt=\"\"  \/><\/p>\n<p>So this is working as expected.<\/p>\n<h3>Further Tests<\/h3>\n<p>Then I executed the test with a <strong>24 bit sine<\/strong> tone and one with a <strong>16 bit sine, that gets converted to 24 bits<\/strong>. All w\/o any issues: so there is <strong>no problem in my 24 bit functionality in the AudioTools<\/strong> and it is working properly.<\/p>\n<p>But it still remains <strong>a mistery<\/strong> to me why the very same thing generated from A2DP is not working and generates noise. This does not make any sense!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had the issue that the 24 bit output via A2DP was not working, but the corresponding 32 bit example was just working fine. So I decided to double check the I2S output with the help of a logical analyzer. Checking 16 bits First I was double checking how the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6488,"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,25,22],"tags":[],"class_list":["post-6484","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-logicanalyzer","category-machine-sound"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The ESP32 I2S 24 bit Mystery - 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\/11\/16\/the-esp32-i2s-24-bit-mystery\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The ESP32 I2S 24 bit Mystery - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"I had the issue that the 24 bit output via A2DP was not working, but the corresponding 32 bit example was just working fine. So I decided to double check the I2S output with the help of a logical analyzer. Checking 16 bits First I was double checking how the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-16T07:15:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2024\/11\/24bit.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"752\" \/>\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\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"The ESP32 I2S 24 bit Mystery\",\"datePublished\":\"2024-11-16T07:15:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/\"},\"wordCount\":200,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/24bit.png\",\"articleSection\":[\"Arduino\",\"LogicAnalyzer\",\"Machine Sound\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/\",\"name\":\"The ESP32 I2S 24 bit Mystery - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/24bit.png\",\"datePublished\":\"2024-11-16T07:15:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/24bit.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/24bit.png\",\"width\":1000,\"height\":752},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/16\\\/the-esp32-i2s-24-bit-mystery\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The ESP32 I2S 24 bit Mystery\"}]},{\"@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":"The ESP32 I2S 24 bit Mystery - 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\/11\/16\/the-esp32-i2s-24-bit-mystery\/","og_locale":"en_US","og_type":"article","og_title":"The ESP32 I2S 24 bit Mystery - Phil Schatzmann","og_description":"I had the issue that the 24 bit output via A2DP was not working, but the corresponding 32 bit example was just working fine. So I decided to double check the I2S output with the help of a logical analyzer. Checking 16 bits First I was double checking how the [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/","og_site_name":"Phil Schatzmann","article_published_time":"2024-11-16T07:15:37+00:00","og_image":[{"width":1000,"height":752,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2024\/11\/24bit.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\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"The ESP32 I2S 24 bit Mystery","datePublished":"2024-11-16T07:15:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/"},"wordCount":200,"commentCount":7,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2024\/11\/24bit.png","articleSection":["Arduino","LogicAnalyzer","Machine Sound"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/","url":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/","name":"The ESP32 I2S 24 bit Mystery - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2024\/11\/24bit.png","datePublished":"2024-11-16T07:15:37+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2024\/11\/24bit.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2024\/11\/24bit.png","width":1000,"height":752},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/16\/the-esp32-i2s-24-bit-mystery\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"The ESP32 I2S 24 bit Mystery"}]},{"@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\/6484","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=6484"}],"version-history":[{"count":15,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6484\/revisions"}],"predecessor-version":[{"id":6501,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6484\/revisions\/6501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/6488"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=6484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=6484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=6484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}