<h1>Getting started</h1>
<p>L1V3 B0X is very simple to use. Let me show you how.</p>
<h2>Get to the web</h2>
<p>Use a compatible browser and go to <a href="https://l1v3.net/b0x">https://l1v3.net/b0x</a></p>
<blockquote>
<p>Yeah i know, if you're reading this, chances that you already knew this. But hey, you don't fight against SEO rules right?</p>
</blockquote>
<h2>Plug and play</h2>
<p>You'll have to first USB plug at least one MIDI controller or MIDI keyboard to your computer.<br />
Then plug a synth to control. All of them will appear in the MIDI Setup window as Input ot Output devices (some of them offering both)</p>
<p><img src="/img/docs/mididevices.jpg" alt="" /></p>
<h2>Monitoring your config</h2>
<p>The MIDI Web editor includes a MIDI log viewer helping better understand what's going on regarding MIDI through your setup.</p>
<p>A cool thing to virtually plug though is a software named <a href="https://hexler.net/protokol">Protokol</a> i encourage you to install. This software is just perfect as an output to check if you've done well with your configuration and programming.</p>
<p>The log viewer of the editor is largely inspired from Protokol as i find it to be a very good design for reading a large list of events.</p>
<p><img src="/img/docs/protokol.jpg" alt="" /></p>
<p><a href="https://hexler.net/protokol#get">Download Protokol</a></p>
<h2>Linking your devices</h2>
<p><img src="/img/docs/ports.jpg" alt="<" /></p>
<p> <br />
Then, you can <strong>double click</strong> on the port you want to link.<br />
<br />
<br />
</p>
<p>Select one of the newly plugged and available MIDI devices from the select list.</p>
<p><img src="/img/docs/selectlink.jpg" alt="" /></p>
<p><img src="/img/docs/portlinked.jpg" alt=">" /></p>
<p> <br />
Once your ports are linked, they'll light up with a bright blue icon.<br />
This blue icon indicates that your port is linked.<br />
</p>
<blockquote>
<p>A lighten port indicates that the device is properly plugged in and recognized by your computer.</p>
</blockquote>
<h2>Use the example presets</h2>
<p>Once done, you can start playing around by drag'n dropping one of the rule presets i made for you.<br />
Let's try the <strong>Reverse CC</strong> preset first.<br />
A rule preset must me dropped in the main area for a dedicated input port. B0X Editor will automatically select the first input port if you forgot to select one.</p>
<p><img src="/img/docs/drag_preset.jpg" alt="" /></p>
<p>The preset is now a rule assigned to the port. You can then observe that there is a warning icon on the right of the rule.</p>
<p><img src="/img/docs/rule_warning.jpg" alt="" /></p>
<p>This warning indicates that this rule won't be triggered, as no condition were given to operate it.<br />
Double click on the rule, it will open the rule panel where we will declare the required condition.</p>
<p><img src="/img/docs/rule_condition.jpg" alt="" /></p>
<p>You can optionaly give this rule a new name.<br />
To be triggered, the condition of this rule needs to be true at some point.<br />
It will essentially being based on MIDI messages incoming to the port the preset was dropped in.<br />
This condition needs to be written in LUA, but if you don't know anything about this language yet, the simpler thing to do is to using the Learn button.</p>
<p>This button has exactly the same behaviour as the MIDI learn button you can expect in some DAW. Click on it to activate it, and move for example a fader of the controller you already plugged.</p>
<p><img src="/img/docs/rule_learned.jpg" alt="" /></p>
<p>The condition is now written for you. This one in the picture means : if i receive a MIDI message that is the Control Change #11.</p>
<p>This is that easy!<br />
You can now see that 2 bars appeared in the main section below. These bars were declared in the LUA code of the preset you dropped. They are ment by the developer who created the preset to display 2 values.<br />
In that case, the first one is the value of the received MIDI control change #11.<br />
The second one is a modified value as a result.<br />
You can check the code if you're curious, by clicking on the switch button named "code".</p>
<p><img src="/img/docs/rule_code.jpg" alt="" /></p>
<p>Let's read this code, that can be splitted in 2 parts</p>
<pre><code class="language-lua">local value = msg.d2 --bar:{"label":"My value","from":0,"to":127,"editable":false,"default":0}
local new = 0 --bar:{"label":"My new value","from":0,"to":127,"editable":false,"default":0}</code></pre>
<p>this section declares 2 variables :</p>
<ul>
<li>One called <strong>value</strong> initialized with the value of the incoming MIDI message.</li>
<li>The second one is called <strong>new</strong> and is initialized at 0 at first.</li>
</ul>
<blockquote>
<p>Note the comments starting with -- after each variable. This is the way to create those bars you just seen before.</p>
</blockquote>
<p>The next section is the logic of the preset</p>
<pre><code class="language-lua">new = MIDI.map(value,0,127,127,0)</code></pre>
<p>This line is very simple to understand. It uses a <strong>map</strong> function i already made for you. This function accepts a variable to operate and 4 values.<br />
The idea of this function is to <strong>map</strong> any given value from 0 to 127 to any value between 127 and 0. In other word, it will reverse the value you put in respecting the boundaries i just described.</p>
<p>Once done, we process the result :</p>
<pre><code class="language-lua">print("received value was ".. value .. " but new value now is ".. new)
MIDI.send(2,"cc",msg.d1,new,msg.channel)</code></pre>
<p>the first line print a sentence to the screen including the received value and the new processed one.<br />
The second line request to send a MIDI message to :</p>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Value</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td>Output</td>
<td>2</td>
<td>The 2nd MIDI output</td>
</tr>
<tr>
<td>Type</td>
<td>"cc"</td>
<td>A control change</td>
</tr>
<tr>
<td>Data1</td>
<td>msg.d1</td>
<td>The same data1 value as the incoming message</td>
</tr>
<tr>
<td>Data2</td>
<td>new</td>
<td>The new computed value by the MIDI.map function</td>
</tr>
<tr>
<td>Channel</td>
<td>msg.channel</td>
<td>The same MIDI channel as the incoming message</td>
</tr>
</tbody>
</table>
<p>If you uncheck the upper right code switch button again, and move the one fader you used in the "learn" phase, you will see the bar moves.</p>
<p><img src="/img/docs/rule_triggered.jpg" alt="" /></p>
<p>Congrats, you just configured your first MIDI rule.</p>
<p> <br />
<br />
<br />
<br />
<br />
</p>