{"id":6685,"date":"2025-04-19T14:56:39","date_gmt":"2025-04-19T12:56:39","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=6685"},"modified":"2025-04-19T15:12:14","modified_gmt":"2025-04-19T13:12:14","slug":"remote-control-for-the-arduino-audiotools-audioplayer","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/","title":{"rendered":"Remote Control for the Arduino AudioTools AudioPlayer"},"content":{"rendered":"<p>I thought it might be cool to provide a <strong>remote control<\/strong> for the <a href=\"https:\/\/pschatzmann.github.io\/arduino-audio-tools\/classaudio__tools_1_1_audio_player.html\">AudioPlayer<\/a> which is part of the <a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\">Arduino Audio Tools<\/a>.<\/p>\n<p>I did not want to invent a new protocol, so I implemented the HTML interface that has been documented by the <a href=\"https:\/\/github.com\/karawin\/Ka-Radio32\/blob\/master\/Interface.md\">KA-Radio project<\/a>.<\/p>\n<p>I am providing a <strong>Stream<\/strong> and a <strong>Http<\/strong> implementation via the following classes:<\/p>\n<ul>\n<li><a href=\"https:\/\/pschatzmann.github.io\/arduino-audio-tools\/classaudio__tools_1_1_k_a_radio_protocol.html\">KARadioProtocol<\/a><\/li>\n<li><a href=\"https:\/\/pschatzmann.github.io\/arduino-audio-tools\/classaudio__tools_1_1_k_a_radio_protocol_server.html\">KARadioProtocolServer<\/a><\/li>\n<\/ul>\n<p>The following commands are supported: play, instant, volume, volume+, volume-, pause, resume, stop, start, next, prev, mute, infos, version.<\/p>\n<h2>The Arduino Sketch<\/h2>\n<p>To keep things simple, I am using an AudioKit for this test, which has a built in SD drive and a Es8388 Codec Chip.<\/p>\n<p>Here is a simple Arduino Sketch that implements the Serial Protocol. Enter the following command via the Serial Monitor for example &#8220;volume=50&amp;play=128&amp;infos&#8221; to start the playback of the file #128 at volume 50 and display all infos.<\/p>\n<pre><code>#include \"AudioTools.h\"\n#include \"AudioTools\/AudioLibs\/AudioBoardStream.h\" \/\/ arduino-audio-driver\n#include \"AudioTools\/Disk\/AudioSourceSDMMC.h\" \/\/ or AudioSourceIdxSDMMC.h\n#include \"AudioTools\/AudioCodecs\/CodecMP3Helix.h\" \/\/ libhelix\n#include \"AudioTools\/AudioLibs\/KARadioProtocol.h\"\n\nconst char *startFilePath=\"\/\";\nconst char* ext=\"mp3\";\nAudioSourceSDMMC source(startFilePath, ext);\nAudioBoardStream kit(AudioKitEs8388V1);\nMP3DecoderHelix decoder;  \/\/ or change to MP3DecoderMAD\nAudioPlayer player(source, kit, decoder);\nKARadioProtocol protocol(player); \/\/ Serial remote control protocol \n\nvoid setup() {\n  Serial.begin(115200);\n  AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);\n\n  \/\/ setup output\n  auto cfg = kit.defaultConfig(TX_MODE);\n  cfg.sd_active = false;\n  kit.begin(cfg);\n\n  \/\/ setup player\n  player.setVolume(0.7);\n  player.begin();\n  player.setActive(false);\n}\n\nvoid loop() {\n  \/\/ process command\n  protocol.processCommand(Serial, Serial);\n  \/\/ process Audio\n  player.copy();\n}\n<\/code><\/pre>\n<p>The command <code>protocol.processCommand(Serial, Serial);<\/code> is reading the command from Serial and outputs the result to Serial.<\/p>\n<h3>Dependencies<\/h3>\n<ul>\n<li><a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\">arduino-audio-tools<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/pschatzmann\/arduino-libhelix\">Libhelix<\/a> mp3 decoder<\/li>\n<li>Optional: <a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-driver\">arduino-audio-driver<\/a> to support the AudioKit<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I thought it might be cool to provide a remote control for the AudioPlayer which is part of the Arduino Audio Tools. I did not want to invent a new protocol, so I implemented the HTML interface that has been documented by the KA-Radio project. I am providing a Stream [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","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-6685","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.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Remote Control for the Arduino AudioTools AudioPlayer - 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\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Remote Control for the Arduino AudioTools AudioPlayer - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"I thought it might be cool to provide a remote control for the AudioPlayer which is part of the Arduino Audio Tools. I did not want to invent a new protocol, so I implemented the HTML interface that has been documented by the KA-Radio project. I am providing a Stream [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-19T12:56:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-19T13:12:14+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=\"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\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Remote Control for the Arduino AudioTools AudioPlayer\",\"datePublished\":\"2025-04-19T12:56:39+00:00\",\"dateModified\":\"2025-04-19T13:12:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/\"},\"wordCount\":177,\"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\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/\",\"name\":\"Remote Control for the Arduino AudioTools AudioPlayer - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"datePublished\":\"2025-04-19T12:56:39+00:00\",\"dateModified\":\"2025-04-19T13:12:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2025\\\/04\\\/19\\\/remote-control-for-the-arduino-audiotools-audioplayer\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Remote Control for the Arduino AudioTools AudioPlayer\"}]},{\"@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":"Remote Control for the Arduino AudioTools AudioPlayer - 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\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/","og_locale":"en_US","og_type":"article","og_title":"Remote Control for the Arduino AudioTools AudioPlayer - Phil Schatzmann","og_description":"I thought it might be cool to provide a remote control for the AudioPlayer which is part of the Arduino Audio Tools. I did not want to invent a new protocol, so I implemented the HTML interface that has been documented by the KA-Radio project. I am providing a Stream [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/","og_site_name":"Phil Schatzmann","article_published_time":"2025-04-19T12:56:39+00:00","article_modified_time":"2025-04-19T13:12:14+00:00","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\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Remote Control for the Arduino AudioTools AudioPlayer","datePublished":"2025-04-19T12:56:39+00:00","dateModified":"2025-04-19T13:12:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/"},"wordCount":177,"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\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/","url":"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/","name":"Remote Control for the Arduino AudioTools AudioPlayer - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"datePublished":"2025-04-19T12:56:39+00:00","dateModified":"2025-04-19T13:12:14+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2025\/04\/19\/remote-control-for-the-arduino-audiotools-audioplayer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Remote Control for the Arduino AudioTools AudioPlayer"}]},{"@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\/6685","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=6685"}],"version-history":[{"count":5,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6685\/revisions"}],"predecessor-version":[{"id":6693,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/6685\/revisions\/6693"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=6685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=6685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=6685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}