{"id":4800,"date":"2022-05-18T16:01:57","date_gmt":"2022-05-18T14:01:57","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=4800"},"modified":"2023-04-28T16:45:04","modified_gmt":"2023-04-28T14:45:04","slug":"decoding-ogg","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/","title":{"rendered":"Streaming and Decoding OGG&#8230;"},"content":{"rendered":"<p>Per definition ogg files should use the <strong>Vorbis file format<\/strong> using Ogg framing. Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose <strong>compressed audio format<\/strong> for mid to high quality: So it is basically the <strong>open source alternative to mp3<\/strong>!<\/p>\n<p><a href=\"https:\/\/xiph.org\/\">xiph.org<\/a> provides an <a href=\"https:\/\/gitlab.xiph.org\/xiph\/tremor\">integer only decoder implementation<\/a> which is based on pure &#8220;C&#8221;.<br \/>\nI am providing this version as <a href=\"https:\/\/github.com\/pschatzmann\/arduino-libvorbis-idec\">Arduino Library<\/a>.<\/p>\n<p>Like <a href=\"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/14\/a-flac-codec-for-the-arduino-audio-tools\/\">Flac from my last post<\/a>, the API is using a <strong>callback pull mechanism<\/strong> to receive the encoded audio data, so I decided to provide a proper <a href=\"https:\/\/pschatzmann.github.io\/arduino-audio-tools\/html\/classaudio__tools_1_1_streaming_decoder.html\">StreamingDecoder<\/a> subclass for this mechanism and officially support it as it is intended to be used. The use is exactly like Flac:<\/p>\n<pre><code>#include \"AudioTools.h\"\n#include \"AudioCodecs\/CodecVorbis.h\"\n\nconst char* ssid = \"ssid\";\nconst char* pwd = \"password\";\nURLStream url(ssid, pwd);\nVorbisDecoder dec;\nI2SStream i2s;\n\nvoid setup() {\n  Serial.begin(115200);\n  AudioLogger::instance().begin(Serial, AudioLogger::Info);  \n\n  i2s.begin(i2s.defaultConfig(TX_MODE));\n\n  url.begin(\"http:\/\/marmalade.scenesat.com:8086\/bitjam.ogg\",\"application\/ogg\");\n  dec.setInputStream(url);\n  dec.setOutputStream(i2s);\n  dec.begin();\n}\n\nvoid loop() {\n  dec.copy();\n}\n\n<\/code><\/pre>\n<h2>Github<\/h2>\n<p>The potentially <a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\/blob\/main\/examples\/examples-stream\/streams-url_vorbis_i2s\/streams-url_vorbis_i2s.ino\">updated version can be found on Github<\/a>.<\/p>\n<h2>Dependencies<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\">arduino-audio-toos<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/pschatzmann\/arduino-libvorbis-idec\">arduino-libvorbis-idec<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/pschatzmann\/arduino-arduino-libopus\">arduino-libopus<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Per definition ogg files should use the Vorbis file format using Ogg framing. Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format for mid to high quality: So it is basically the open source alternative to mp3! xiph.org provides an integer only decoder implementation which is based [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4801,"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":[38],"class_list":["post-4800","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-machine-sound","tag-codecs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Streaming and Decoding OGG... - 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\/2022\/05\/18\/decoding-ogg\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Streaming and Decoding OGG... - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"Per definition ogg files should use the Vorbis file format using Ogg framing. Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format for mid to high quality: So it is basically the open source alternative to mp3! xiph.org provides an integer only decoder implementation which is based [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-18T14:01:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-28T14:45:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/05\/vorbis.png\" \/>\n\t<meta property=\"og:image:width\" content=\"246\" \/>\n\t<meta property=\"og:image:height\" content=\"205\" \/>\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=\"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\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Streaming and Decoding OGG&#8230;\",\"datePublished\":\"2022-05-18T14:01:57+00:00\",\"dateModified\":\"2023-04-28T14:45:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/\"},\"wordCount\":129,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/vorbis.png\",\"keywords\":[\"Codecs\"],\"articleSection\":[\"Arduino\",\"Machine Sound\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/\",\"name\":\"Streaming and Decoding OGG... - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/vorbis.png\",\"datePublished\":\"2022-05-18T14:01:57+00:00\",\"dateModified\":\"2023-04-28T14:45:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/vorbis.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/vorbis.png\",\"width\":246,\"height\":205},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/18\\\/decoding-ogg\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Streaming and Decoding OGG&#8230;\"}]},{\"@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":"Streaming and Decoding OGG... - 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\/2022\/05\/18\/decoding-ogg\/","og_locale":"en_US","og_type":"article","og_title":"Streaming and Decoding OGG... - Phil Schatzmann","og_description":"Per definition ogg files should use the Vorbis file format using Ogg framing. Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format for mid to high quality: So it is basically the open source alternative to mp3! xiph.org provides an integer only decoder implementation which is based [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/","og_site_name":"Phil Schatzmann","article_published_time":"2022-05-18T14:01:57+00:00","article_modified_time":"2023-04-28T14:45:04+00:00","og_image":[{"width":246,"height":205,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/05\/vorbis.png","type":"image\/png"}],"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\/2022\/05\/18\/decoding-ogg\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Streaming and Decoding OGG&#8230;","datePublished":"2022-05-18T14:01:57+00:00","dateModified":"2023-04-28T14:45:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/"},"wordCount":129,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/05\/vorbis.png","keywords":["Codecs"],"articleSection":["Arduino","Machine Sound"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/","url":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/","name":"Streaming and Decoding OGG... - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/05\/vorbis.png","datePublished":"2022-05-18T14:01:57+00:00","dateModified":"2023-04-28T14:45:04+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/05\/vorbis.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/05\/vorbis.png","width":246,"height":205},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/18\/decoding-ogg\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Streaming and Decoding OGG&#8230;"}]},{"@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\/4800","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=4800"}],"version-history":[{"count":10,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/4800\/revisions"}],"predecessor-version":[{"id":4812,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/4800\/revisions\/4812"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/4801"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=4800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=4800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=4800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}