<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[16bit over midi LSB&#x2F;MSB]]></title><description><![CDATA[<p>Hello</p><p><br />I am working with a MIDI to SERVO controller and need some help understanding the concept of MSB/LSB and 16bit math</p><p>This controller can take a coarse and a fine value broadcast over 2 MIDI channels. The only information I can find is pertaining to DMX. </p><p>I am unsure how this scales to MIDI. I need 0-127 and I am wondering if I should just swap 256 for 127 in the code below, or does that mess up the math?</p><p>Thanks for any advice!</p><p>Fubbi</p><p>_________________________________</p><p>Here is what I know so far:</p><p>In order to make a "high res" input in Isadora I have come to the following conclusions by studying the coarse/fine behavior of DMX fixture control:<br /></p><p><em>• Coarse</em> is the MSB (Most Significant Bit) and <em>Fine </em>is the LSB (Least Significant Bit)</p><p>• 16 bit is equal to 65535</p><p>• For DMX the LSB is input % 256 (modulo)</p><p>• For DMX the MSB is floor(input/256)</p><p>I concocted the following javascript to scale and split a 16bit value to LSB/MSB</p><p><strong>// iz_output 1 "LSB"</strong></p>
<p><strong>// iz_output 2 "MSB"</strong></p>
<p><strong>function<span class="s1"> main()</span></strong></p>
<p><strong>{</strong></p>
<p><strong><span class="s1"><span class="Apple-tab-span">	</span></span><span class="s2">var</span><span class="s1"> input = arguments[</span><span class="s3">0</span><span class="s1">]; <span class="Apple-converted-space">  </span></span>// input 1 [0-65535]</strong></p>
<p><strong><span class="Apple-converted-space">    </span><span class="s2">var</span> n = Math.trunc(input); // float to integer, maybe redundant</strong></p>
<p><strong><span class="Apple-tab-span">	</span><span class="s2">var</span> LSB = n % <span class="s3">256</span>; // for dmx this is how LSB is calculated</strong></p>
<p><strong><span class="Apple-tab-span">	</span><span class="s2">var</span> MSB = Math.floor(n/<span class="s3">256</span>);<span class="Apple-converted-space">  // for dmx this is how MSB is calculated</span></strong></p>
<p><strong><span class="Apple-tab-span">	</span><span class="s2">return</span> [LSB, MSB]</strong></p>
<p><strong>}</strong></p>]]></description><link>https://community.troikatronix.com/topic/7785/16bit-over-midi-lsb-msb</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Mar 2026 04:43:53 GMT</lastBuildDate><atom:link href="https://community.troikatronix.com/topic/7785.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Jan 2022 12:36:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 16bit over midi LSB&#x2F;MSB on Thu, 27 Jan 2022 22:54:11 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/2066">@juriaan</a> said:</p>
<blockquote>DMX is 512 channels, 256 is exactly .5 of 512. So I would personally think that if it expects 14 Bit MIDI that we should divide by 0.5 * 16384 = 8192</blockquote>
<p> Hi Jurian, thanks for jumping in. But divide where? I am not sure what you mean. The size of the incoming number could be relatively arbitrary as the servos will just stop moving outside their scope. I changed my script from 256 to 127 and I get pretty consistent movement from 0 to 16384.</p><p>Now if it really makes the movement so much more high res is another question. I have come to believe that it really only matters if you need to make very precisely positioned stops.</p><p>Cheers</p>]]></description><link>https://community.troikatronix.com/post/48229</link><guid isPermaLink="true">https://community.troikatronix.com/post/48229</guid><dc:creator><![CDATA[fubbi]]></dc:creator><pubDate>Thu, 27 Jan 2022 22:54:11 GMT</pubDate></item><item><title><![CDATA[Reply to 16bit over midi LSB&#x2F;MSB on Thu, 27 Jan 2022 16:27:21 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://community.troikatronix.com/uid/9">@fubbi</a></p><p>If the code of DMX is the following (and you know this is correct)</p><p><strong>// iz_output 1 "LSB"</strong></p>
<p><strong>// iz_output 2 "MSB"</strong></p>
<p><strong>function<span class="s1"> main()</span></strong></p>
<p><strong>{</strong></p>
<p><strong><span class="s1"><span class="Apple-tab-span">	</span></span><span class="s2">var</span><span class="s1"> input = arguments[</span><span class="s3">0</span><span class="s1">]; <span class="Apple-converted-space">  </span></span>// input 1 [0-65535]</strong></p>
<p><strong><span class="Apple-converted-space">    </span><span class="s2">var</span> n = Math.trunc(input); // float to integer, maybe redundant</strong></p>
<p><strong><span class="Apple-tab-span">	</span><span class="s2">var</span> LSB = n % <span class="s3">256</span>; // for dmx this is how LSB is calculated</strong></p>
<p><strong><span class="Apple-tab-span">	</span><span class="s2">var</span> MSB = Math.floor(n/<span class="s3">256</span>);<span class="Apple-converted-space">  // for dmx this is how MSB is calculated</span></strong></p>
<p><strong><span class="Apple-tab-span">	</span><span class="s2">return</span> [LSB, MSB]</strong></p><p><strong>}<br /></strong></p><p><strong><br /></strong></p><p>DMX is 512 channels, 256 is exactly .5 of 512. So I would personally think that if it expects 14 Bit MIDI that we should divide by 0.5 * 16384 = 8192</p><p></p>]]></description><link>https://community.troikatronix.com/post/48228</link><guid isPermaLink="true">https://community.troikatronix.com/post/48228</guid><dc:creator><![CDATA[Juriaan]]></dc:creator><pubDate>Thu, 27 Jan 2022 16:27:21 GMT</pubDate></item><item><title><![CDATA[Reply to 16bit over midi LSB&#x2F;MSB on Thu, 27 Jan 2022 12:48:59 GMT]]></title><description><![CDATA[<p>Update:</p>
<p>Actually, it's supposed to be 14 bit (16384?) for midi, so now I am really curious if I am on the right track</p>
<p><em>Since each controller message has only a 7-bit value field, many MIDI devices utilize some controllers in pairs to achieve a full 14-bit
resolution. These can be thought of as the “coarse” adjustment for the most significant
7-bits (MSB), and the “fine” adjustment for the least significant 7-bits (LSB). </em></p>]]></description><link>https://community.troikatronix.com/post/48226</link><guid isPermaLink="true">https://community.troikatronix.com/post/48226</guid><dc:creator><![CDATA[fubbi]]></dc:creator><pubDate>Thu, 27 Jan 2022 12:48:59 GMT</pubDate></item></channel></rss>