{"id":6502,"date":"2024-11-17T10:54:22","date_gmt":"2024-11-17T09:54:22","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=6502"},"modified":"2024-11-23T12:52:01","modified_gmt":"2024-11-23T11:52:01","slug":"audiotools-audio-number-type-format-conversion-on-stereoids","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/","title":{"rendered":"Arduino AudioTools: Audio Number Type Conversion on Stereoids"},"content":{"rendered":"<p>I am providing the untyped <a href=\"https:\/\/pschatzmann.github.io\/arduino-audio-tools\/classaudio__tools_1_1_number_format_converter_stream.html\">NumberFormatConverterStream<\/a> class to convert between different signed bit sizes. This class is using the typed templated <a href=\"https:\/\/pschatzmann.github.io\/arduino-audio-tools\/classaudio__tools_1_1_number_format_converter_stream_t.html\">NumberFormatConverterStreamT<\/a> do do the actual work.<\/p>\n<p>Currently there are also some <a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\/wiki\/Encoding-and-Decoding-of-Audio\">Codecs<\/a> that can also be used to convert the nubmer format: e.g. L8, L16 and Float.<\/p>\n<p>I decided to <strong>extend the functionality of NumberFormatConverterStreamT<\/strong> to potentially support any number type, so that we can also use <strong>unsigned data types<\/strong> for the conversion as well. Here is an example Arduino Sketch<\/p>\n<pre><code>#include \"AudioTools.h\"\n\nSineWaveGenerator&lt;int16_t&gt; sineWave;                \nGeneratedSoundStream&lt;int16_t&gt; sound(sineWave);      \nCsvOutput&lt;uint8_t&gt; out(Serial, sound.audioInfo().channels);\nNumberFormatConverterStreamT&lt;int16_t, uint8_t&gt; nfc(out);\nStreamCopy copier(nfc, sound);                     \n\nvoid setup(void) {  \n  \/\/ Open Serial \n  Serial.begin(115200);\n  AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);\n\n  nfc.begin();\n  out.begin();\n  sineWave.begin();\n\n  \/\/ Setup sine wave\n  sineWave.setFrequency(N_B4);\n  Serial.println(\"started...\");\n}\n\nvoid loop() {\n  copier.copy();\n}\n<\/code><\/pre>\n<p>This sketch generates a sine wave in int16_t and <strong>converts it to the uint8_t<\/strong> data range (from 0 through 255 decimal).<\/p>\n<p>I have tested the functionality with <strong>uint8_t, int8_t, int16_t, uint16_t, int24_t (int24_3bytes_t and int24_4bytes_t), uint32_t, int32_t, FloatAudio<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am providing the untyped NumberFormatConverterStream class to convert between different signed bit sizes. This class is using the typed templated NumberFormatConverterStreamT do do the actual work. Currently there are also some Codecs that can also be used to convert the nubmer format: e.g. L8, L16 and Float. I decided [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"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":[],"class_list":["post-6502","post","type-post","status-publish","format-standard","hentry","category-arduino","category-machine-sound"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Arduino AudioTools: Audio Number Type Conversion on Stereoids - 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\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Arduino AudioTools: Audio Number Type Conversion on Stereoids - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"I am providing the untyped NumberFormatConverterStream class to convert between different signed bit sizes. This class is using the typed templated NumberFormatConverterStreamT do do the actual work. Currently there are also some Codecs that can also be used to convert the nubmer format: e.g. L8, L16 and Float. I decided [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-17T09:54:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-23T11:52:01+00:00\" \/>\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\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Arduino AudioTools: Audio Number Type Conversion on Stereoids\",\"datePublished\":\"2024-11-17T09:54:22+00:00\",\"dateModified\":\"2024-11-23T11:52:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/\"},\"wordCount\":140,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"articleSection\":[\"Arduino\",\"Machine Sound\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/\",\"name\":\"Arduino AudioTools: Audio Number Type Conversion on Stereoids - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"datePublished\":\"2024-11-17T09:54:22+00:00\",\"dateModified\":\"2024-11-23T11:52:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2024\\\/11\\\/17\\\/audiotools-audio-number-type-format-conversion-on-stereoids\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Arduino AudioTools: Audio Number Type Conversion on Stereoids\"}]},{\"@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":"Arduino AudioTools: Audio Number Type Conversion on Stereoids - 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\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/","og_locale":"en_US","og_type":"article","og_title":"Arduino AudioTools: Audio Number Type Conversion on Stereoids - Phil Schatzmann","og_description":"I am providing the untyped NumberFormatConverterStream class to convert between different signed bit sizes. This class is using the typed templated NumberFormatConverterStreamT do do the actual work. Currently there are also some Codecs that can also be used to convert the nubmer format: e.g. L8, L16 and Float. I decided [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/","og_site_name":"Phil Schatzmann","article_published_time":"2024-11-17T09:54:22+00:00","article_modified_time":"2024-11-23T11:52:01+00:00","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\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Arduino AudioTools: Audio Number Type Conversion on Stereoids","datePublished":"2024-11-17T09:54:22+00:00","dateModified":"2024-11-23T11:52:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/"},"wordCount":140,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"articleSection":["Arduino","Machine Sound"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/","url":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/","name":"Arduino AudioTools: Audio Number Type Conversion on Stereoids - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"datePublished":"2024-11-17T09:54:22+00:00","dateModified":"2024-11-23T11:52:01+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2024\/11\/17\/audiotools-audio-number-type-format-conversion-on-stereoids\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Arduino AudioTools: Audio Number Type Conversion on Stereoids"}]},{"@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\/6502","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=6502"}],"version-history":[{"count":13,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6502\/revisions"}],"predecessor-version":[{"id":6528,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6502\/revisions\/6528"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=6502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=6502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=6502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}