{"id":52,"date":"2017-02-18T09:28:08","date_gmt":"2017-02-18T09:28:08","guid":{"rendered":"http:\/\/aboutmedia.notyet.me\/?p=52"},"modified":"2018-05-18T08:35:35","modified_gmt":"2018-05-18T08:35:35","slug":"wandering-sound-part-ii-theory-of-programming","status":"publish","type":"post","link":"http:\/\/aboutmedia.notyet.me\/?p=52","title":{"rendered":"Wandering sound &#8211; Part II: Theory of programming"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>For description of the project and approach see <a href=\"http:\/\/aboutmedia.notyet.me\/?p=34\">first Part<\/a>. This\u00a0Part is about the theory and maths\u00a0behind the programming of the <em>wandering\u00a0sound<\/em> installation.<\/p>\n<p><strong>Focusing on one channel<\/strong><\/p>\n<p>We have two channels to switch and pass on to the appropriate speakers. In the following we consider them\u00a0two independent systems. So we are going to change the image of the speakers we saw in Part I a little bit:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-54 size-full\" src=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/speakers_fortl_channels.png\" alt=\"speakers_fortl_channels\" width=\"800\" height=\"253\" srcset=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/speakers_fortl_channels.png 800w, http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/speakers_fortl_channels-300x95.png 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>We have red speakers 1-16 for right channel and blue speakers 1-16 for left channel. In the following we\u00a0focus on one channel, so that we can easily describe what&#8217;s happening:<\/p>\n<ul>\n<li>whenever you\u00a0have reached\u00a0volume 0 switch to the next (or previous) speaker<\/li>\n<li>fade in and then fade out again<\/li>\n<\/ul>\n<p>Later (as you can also see in the image) we shift the channels: When left channel is high, right channel is low. So the sound is wandering from a left speaker to a right speaker, then to the next left speaker an so on. We are up and running.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Finding the path<\/strong><\/p>\n<p>Finding the path is one of the the crucial tasks in this programming. As you remember we are using many relays to connect the appropriate speaker to the amp. What <em>finding the path<\/em>\u00a0now means is, that we have to tell the relays with status to take. Let&#8217;s consider one relays switching two speakers:<\/p>\n<p><a href=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/relays_2_speakers1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-61\" src=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/relays_2_speakers1.png\" alt=\"relays_2_speakers\" width=\"205\" height=\"196\" \/><\/a><\/p>\n<p>One channel consist of a cable with two wires. First wire we connect to\u00a0both speakers. Second wire we will switch using a relay. \u00a0If we command the\u00a0relay to switch to &#8220;left&#8221; one speaker will play, if we command it to switch to &#8220;right&#8221;, the other one will play.<\/p>\n<p>With multiple relays\u00a0we need multiple commands.\u00a0We now just replace &#8220;left&#8221; with 0 and &#8220;right&#8221; with 1 and connect two\u00a0relays to the first one:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/3_relays_path.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-58\" src=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/3_relays_path.png\" alt=\"3_relays_path\" width=\"168\" height=\"151\" \/><\/a><\/p>\n<p>Here we could\u00a0already switch 4 speakers and the &#8220;<em>path<\/em>&#8221; would be left-left (00) or left-right (01) or right-left (10) or right-right (11). You already get it. It is a binary system. A good example of just how easy (and close to all-day-problems like ours) binary systems can be. (We could also talk about a watering system for plants, where you\u00a0guide a water flow multiple times\u00a0left or\u00a0right with multiple gates.\u00a0It&#8217;s the same problem, but we&#8217;ll stick to speakers, I think it is nearly as easy to understand.)<\/p>\n<p>Let&#8217;s now draw\u00a0the whole setting, complete with <em>path<\/em> examples and how to calculate speaker numbers from paths and the other way round:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-53 size-full\" src=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/relays_paths.png\" alt=\"relays_paths\" width=\"800\" height=\"516\" srcset=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/relays_paths.png 800w, http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2016\/10\/relays_paths-300x194.png 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>It&#8217;s very easy: The speaker number is the decimal (our &#8220;normal&#8221; numbers, based on the factor 10) representation of the\u00a0binary number describing the <em>path<\/em>. Only starting with 0, so that we have to add 1 in case we want intuitively understandable numbers. See the examples in the image above.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>What&#8217;s missing?<\/strong><\/p>\n<p>One thing is still missing, though: We now know the path but do not yet know which of the relays are to be switched. So for\u00a0example <em>path<\/em> \u00a01011 will lead us to speaker 12. We have to:<\/p>\n<ul>\n<li>switch <strong>relay 1<\/strong> to right<\/li>\n<li>switch <strong>relay 3<\/strong> to left<\/li>\n<li>switch <strong>relay 6<\/strong>\u00a0to right<\/li>\n<li>switch <strong>relay 13<\/strong> to right<\/li>\n<\/ul>\n<p>while<em> path<\/em>\u00a0 0011 will lead us to speaker 4 but\u00a0we have to:<\/p>\n<ul>\n<li>switch\u00a0<strong>relay 1<\/strong>\u00a0to left<\/li>\n<li>switch\u00a0<strong>relay 2<\/strong>\u00a0to left<\/li>\n<li>switch\u00a0<strong>relay 4<\/strong>\u00a0to right<\/li>\n<li>switch\u00a0<strong>relay 9<\/strong>\u00a0to right<\/li>\n<\/ul>\n<p>Of course thins information is hidden\u00a0in our setting:\u00a0if we set the first relay to right, second number of the <em>path<\/em> will of course be referring to relay 3, whereas if we set the first relay to right to left, the second number of the <em>path<\/em> will be referring to relay 2. Just check the image and you see that it is obvious. We just have to find out how to do the math to get this information.<\/p>\n<p>Let&#8217;s have a\u00a0look at the <em>path<\/em> parts going left only:<\/p>\n<p><a href=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/which_relay.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-105\" src=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/which_relay-300x298.png\" alt=\"which_relay\" width=\"300\" height=\"298\" srcset=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/which_relay-300x298.png 300w, http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/which_relay-150x150.png 150w, http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/which_relay.png 600w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>2-4-8, 5-10, 3-6-12, 7-14\u2026 you see the pattern: Next relay number is double the actual relay number &#8211;\u00a0in case the according <em>path<\/em> digit is\u00a00 (left). In case the\u00a0according\u00a0<em>path<\/em>\u00a0digit is 1\u00a0(right) same rule applies\u00a0but the result is is incremented\u00a0by 1 afterwards:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/get_relay_number.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-107 size-full\" src=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/get_relay_number.png\" alt=\"get_relay_number\" width=\"450\" height=\"111\" srcset=\"http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/get_relay_number.png 450w, http:\/\/aboutmedia.notyet.me\/wp-content\/uploads\/2017\/02\/get_relay_number-300x74.png 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p>(Great\u00a0thing here is, that we don&#8217;t have to worry about binary or decimal. This is a very special case, as we are only using 0 and 1. 0 is 0 and 1 is 1 both in binary and decimal system. Only from 2 (binary: 11) onwards we have to distinguish between the systems.)<\/p>\n<p>&nbsp;<\/p>\n<p><strong>We are ready!<\/strong><\/p>\n<p>So as soon\u00a0we\u00a0know\u00a0which speaker we want to address, we can first calculate the <em>path<\/em> and then calculate which digit in the path is connected to which relay. So we know everything to switch the relays correctly.<\/p>\n<p>In the next part, I will discuss the technology used,\u00a0the\u00a0communication between\u00a0the used parts, and\u00a0(shortly)\u00a0the actual programming. <em>Sorry,\u00a0not yet online!<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; For description of the project and approach see first Part. This\u00a0Part is about the theory and maths\u00a0behind the programming of the wandering\u00a0sound installation. Focusing on one channel We have two channels to switch and pass on to the appropriate speakers. In the following we consider them\u00a0two independent systems. So we are going to change &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/aboutmedia.notyet.me\/?p=52\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Wandering sound &#8211; Part II: Theory of programming&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4],"tags":[],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-project","category-theory","entry"],"_links":{"self":[{"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=\/wp\/v2\/posts\/52","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=52"}],"version-history":[{"count":14,"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions"}],"predecessor-version":[{"id":112,"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions\/112"}],"wp:attachment":[{"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/aboutmedia.notyet.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}