# MIDIbox KB

**URL:** <https://forum.midibox.org/t/midibox-kb/16560>\
**Category:** MIDIfication\
**Created:** [May 29, 2012, 9:57pm UTC](https://forum.midibox.org/t/midibox-kb/16560 "2012-05-29T21:57:47Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [August 26, 2012, 6:37pm UTC](https://forum.midibox.org/t/midibox-kb/16560/21 "2012-08-26T18:37:28Z")

</div>

An inbuilt MIDI Arpeggiator is on the Agenda - it will feature the same functions like known from MBCV V2: [http://www.ucapps.de/midibox\_cv/v2\_mockup/mbcv\_mockup1\_1.png](http://www.ucapps.de/midibox_cv/v2_mockup/mbcv_mockup1_1.png)

Some extra buttons will be required to control the Arpeggiator, but I’m unsure how many are really necessary, and how many functions should only be controllable from the LCD based menu.

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![rvlt](https://forum.midibox.org/user_avatar/forum.midibox.org/rvlt/32/129_2.png) [@rvlt](https://forum.midibox.org/u/rvlt)\
**Post date:** [August 27, 2012, 10:50am UTC](https://forum.midibox.org/t/midibox-kb/16560/22 "2012-08-27T10:50:31Z")

</div>

Hard to tell, depends so much on personal preferences. But in my case I’d like to see the following external buttons/potis:

- Arp on/off

- Hold on/off

- Tempo

- Gatelength (maybe not important for everyone)

If I had to build my controller from the scratch, then I would add the following:

- Range switch

- Mode switch/rotary

So basically the same stuff that’s in my Juno6 which I use quite often. So simple, effective and you can play around with it in realtime.

Cheers.

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [December 30, 2012, 12:06am UTC](https://forum.midibox.org/t/midibox-kb/16560/23 "2012-12-30T00:06:24Z")

</div>

V1.007 is available:

&nbsp;

```
MIDIbox KB V1.007
~~~~~~~~~~~~~~~~~

   o srio_num now stored on EEPROM

   o changed default delay settings (required after performance fix in v1.006)

   o added ain_sustain and ctrl_sustain parameters

   o the min/max values of the potentiometers can now be calibrated with the
       set kb <kb> calibrate <off|pitchwheel|modwheel|sustain>
     command.

```

The documentation has been updated as well:&nbsp;[http://www.ucapps.de/midibox\_kb.html](http://www.ucapps.de/midibox_kb.html)

&nbsp;

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![nlate](https://forum.midibox.org/letter_avatar_proxy/v4/letter/n/d26b3c/32.png) [@nlate](https://forum.midibox.org/u/nlate)\
**Post date:** [December 30, 2012, 1:46pm UTC](https://forum.midibox.org/t/midibox-kb/16560/24 "2012-12-30T13:46:33Z")

</div>

Hello Thorsten,

Could you please also check the df88 interconnection Diagram in the documentation acc. to my former post #8 in:

[http://discourse.midibox.org/t/topic/16988](http://discourse.midibox.org/t/topic/16988)

Thanks

Jo

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [December 30, 2012, 10:00pm UTC](https://forum.midibox.org/t/midibox-kb/16560/25 "2012-12-30T22:00:21Z")

</div>

Thank you for the reminder!

After some trouble with xcircuit on my new computer, the schematic is finally fixed. 🙂

&nbsp;

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![rvlt](https://forum.midibox.org/user_avatar/forum.midibox.org/rvlt/32/129_2.png) [@rvlt](https://forum.midibox.org/u/rvlt)\
**Post date:** [January 3, 2013, 6:14pm UTC](https://forum.midibox.org/t/midibox-kb/16560/26 "2013-01-03T18:14:10Z")

</div>

The calibration feature for the wheels sounds great! Will an AINSer be supported for this as well? I don’t trust the onboard a-d conversion of the LPC17 so much..

&nbsp;

Actually the wheel calibration is one of the main reasons I want to upgrade my existing controller keyboard to a MB KB version. I had to change the pots of my pitch- and modwheels because they were worn out. I put in pots with the same values, but since every pot has a (slightly) different curve, they don’t send the full range of CCs anymore and the mod wheels is jittering now quite heavy. There is no way of calibrating this, so…

&nbsp;

MB KB to the rescue! &nbsp; 😄

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [January 3, 2013, 9:56pm UTC](https://forum.midibox.org/t/midibox-kb/16560/27 "2013-01-03T21:56:27Z")

</div>

Yes, I could support the AINSER as well. But the remaining analog inputs won’t be fully configurable, because such a function would conflict with the MBNG features where I did it better (than before ;).

&nbsp;

I also would like to evaluate, if the MBKB could be merged with MBNG - this would be the most simple way to maintain the project, and it would give us the highest flexibility.

&nbsp;

We would have the drawback that the minimum latency increases from ca. 130 uS to ca. 2 mS for a Fatar 61 Keyboard in worst case (to 1 mS if the optimized scan is used).

The latency would be higher, since MBNG requires more headroom for all the other functions which are running in parallel.

&nbsp;

Would such a high latency be acceptable?

&nbsp;

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![Duggle](https://forum.midibox.org/user_avatar/forum.midibox.org/duggle/32/9_2.png) [@Duggle](https://forum.midibox.org/u/Duggle)\
**Post date:** [January 3, 2013, 10:16pm UTC](https://forum.midibox.org/t/midibox-kb/16560/28 "2013-01-03T22:16:16Z")

</div>

Its always hard to accept higher latencies mentally, though in practice it &nbsp;often makes less difference that you think (esp. when its \<5ms total). I am and &nbsp;will be using the KB through the SEQ which I assume adds 2ms to live notes forwarded through to synths (then latency of the actual synth added to this..)&nbsp;

Am I correct in understanding that using optimized scan on a NG based KB may add only 800 or 900us to the total latency?

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [January 3, 2013, 10:27pm UTC](https://forum.midibox.org/t/midibox-kb/16560/29 "2013-01-03T22:27:21Z")

</div>

> Am I correct in understanding that using optimized scan on a NG based KB may add only 800 or 900us to the total latency?

&nbsp;

yes

&nbsp;

The increased latency will mainly affect the accuracy of the velocity values.

Currently the measured delay ranges from 50…1000, with a 10 times slower scan we would only measure delays between 5..100 anymore.

It depends on the outcome with your “velocity curve” implementation if a difference can really be notified.

&nbsp;

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![rvlt](https://forum.midibox.org/user_avatar/forum.midibox.org/rvlt/32/129_2.png) [@rvlt](https://forum.midibox.org/u/rvlt)\
**Post date:** [January 3, 2013, 11:02pm UTC](https://forum.midibox.org/t/midibox-kb/16560/30 "2013-01-03T23:02:14Z")

</div>

Hard to tell in theory. Do we have any numbers of other (commercial) midi keyboards to compare with? For me an added latency of max. 1ms still sounds fast, at least for normal (non-percussive) keyboard operation.

I’m thinking of a real world example: Say you want to build a midi keyboard with a few pots, encoders etc., so you add a LPC17 with MBKB software for super low latency. Then you add another LPC17 (with MBNG) for the rest of the controllers. If you want to use only a single USB port (for convenience) to connect your computer, you would have to merge (e.g. via Midi I/O #4) the MBKB midi data with the MBNG controller data in the MBNG, right? Would this process also add latency, maybe even more than 1ms?

So from this point of view a merge between MBKB and MBNG would be much more convenient, and performance-wise on the same level.

But this is all (my) theory, maybe it’s best to try it out: If we’d have a beta version of an KB-enhanced MBNG, we could compare these two and see if it “feels” different.

(BTW I’m just waiting for my DIO\_Matrix module to arrive from Smash\_TV, than I’ll try MBKB asap..)

Cheers  
Lars

---

<div class="post-metadata">

**Author:** ![Duggle](https://forum.midibox.org/user_avatar/forum.midibox.org/duggle/32/9_2.png) [@Duggle](https://forum.midibox.org/u/Duggle)\
**Post date:** [January 3, 2013, 11:07pm UTC](https://forum.midibox.org/t/midibox-kb/16560/31 "2013-01-03T23:07:43Z")

</div>

The velocity values would be a lot more “granular” i.e would encompass the range 1 to 127 but certain values would never appear on the output because it would map 5..100 onto 127..1. With nonlinear scaling it would invariably reduce the total number of values that appear on the output.&nbsp;

Would it ever be noticed? (imho) no, does it bother me (mentally) that the velocity output would be granular, yes :hmm:&nbsp;.

&nbsp;

Personally (subject to change, of course!) I might entertain the idea of developing on a small STM32 “minicore” (minimal MB Core32) &nbsp;that does nothing more than scan the keyboard(s) apply velocity scaling, then forward midi events to a uart (maybe at higher baud, for direct connect with an NG?). &nbsp;

---

<div class="post-metadata">

**Author:** ![rvlt](https://forum.midibox.org/user_avatar/forum.midibox.org/rvlt/32/129_2.png) [@rvlt](https://forum.midibox.org/u/rvlt)\
**Post date:** [January 13, 2013, 4:13pm UTC](https://forum.midibox.org/t/midibox-kb/16560/32 "2013-01-13T16:13:14Z")

</div>

Hey,

&nbsp;

I’ve managed to install MB\_KB today. I spent half a day to measure the matrix layout / connections of my old miditech keyboard, just find out that …

&nbsp;

… the two cables with DIL16 headers coming from the miditech match exactly the two DIL16 sockets on the DIO Matrix. So it is a 1:1 connection, I didn’t have to resolder a single cable!!! That was really PLUG’N’PLAY!!

&nbsp;

Could have saved my about 5 hours if I just tried to connect them and see what happens, but anyway…&nbsp; :rolleyes:

&nbsp;

So far everything’s working great. Ready to try MB\_NG+KB … 😄

&nbsp;

Cheers

Lars

---

<div class="post-metadata">

**Author:** ![Duggle](https://forum.midibox.org/user_avatar/forum.midibox.org/duggle/32/9_2.png) [@Duggle](https://forum.midibox.org/u/Duggle)\
**Post date:** [January 13, 2013, 6:32pm UTC](https://forum.midibox.org/t/midibox-kb/16560/33 "2013-01-13T18:32:31Z")

</div>

I suppose the keyboard has a Fatar 61 note keybed?

---

<div class="post-metadata">

**Author:** ![rvlt](https://forum.midibox.org/user_avatar/forum.midibox.org/rvlt/32/129_2.png) [@rvlt](https://forum.midibox.org/u/rvlt)\
**Post date:** [January 14, 2013, 2:05am UTC](https://forum.midibox.org/t/midibox-kb/16560/34 "2013-01-14T02:05:29Z")

</div>

“Meifa CO., Ltd. © Copyright Keyboard-R” is printed on the backpanel.

Maybe it’s a Fatar clone or something..

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [January 14, 2013, 9:01pm UTC](https://forum.midibox.org/t/midibox-kb/16560/35 "2013-01-14T21:01:39Z")

</div>

> Could have saved my about 5 hours if I just tried to connect them and see what happens, but anyway…&nbsp; :rolleyes:

&nbsp;

👍

&nbsp;

&nbsp;

> So far everything’s working great. Ready to try MB\_NG+KB …&nbsp; 😄

&nbsp;

We can give it a trial run this weekend. 🙂

&nbsp;

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![NorthernLightX](https://forum.midibox.org/user_avatar/forum.midibox.org/northernlightx/32/13_2.png) [@NorthernLightX](https://forum.midibox.org/u/NorthernLightX)\
**Post date:** [January 15, 2013, 10:35am UTC](https://forum.midibox.org/t/midibox-kb/16560/36 "2013-01-15T10:35:52Z")

</div>

> I spent half a day to measure the matrix layout / connections of my old miditech keyboard, just find out that …
> 
> &nbsp;
> 
> … the two cables with DIL16 headers coming from the miditech match exactly the two DIL16 sockets on the DIO Matrix. So it is a 1:1 connection, I didn’t have to resolder a single cable!!!

&nbsp;

Would that be the same Miditech / Midiplus&nbsp;keybed that I aquired some time ago? That would be sweet, would save me from measuring that shiz as well :w00t:

---

<div class="post-metadata">

**Author:** ![rvlt](https://forum.midibox.org/user_avatar/forum.midibox.org/rvlt/32/129_2.png) [@rvlt](https://forum.midibox.org/u/rvlt)\
**Post date:** [January 15, 2013, 2:43pm UTC](https://forum.midibox.org/t/midibox-kb/16560/37 "2013-01-15T14:43:04Z")

</div>

If there are two cables with DIL16 headers coming from your keybed, I’d say yes. Just order a DIO\_Matrix module and give it a go.. 😉

---

<div class="post-metadata">

**Author:** ![nlate](https://forum.midibox.org/letter_avatar_proxy/v4/letter/n/d26b3c/32.png) [@nlate](https://forum.midibox.org/u/nlate)\
**Post date:** [January 19, 2013, 11:11pm UTC](https://forum.midibox.org/t/midibox-kb/16560/38 "2013-01-19T23:11:23Z")

</div>

Dear Thorsten

I successfully installed the precompiled MIDIBOX\_kb\_V1\_007 .hex file on my LPC17xx system.  
Everything worked as expected:

- Terminal commands etc.
- Keyboard setup for Fatar DF88 Keyb. Minor issue: set kb 1 note\_offset 24 (C-0) should be 21 (a-1)
- optimize option works perfect:  
180 (6\*30) us for a all 88 keys in steady state !!!  
360 (12\*30) us if all Dins (lower & upper half) change at once (very rarely)!

some ideas and findings:

- delay\_fastest should be made separate for white and black keys, because the lever of the black keys is shorter than the lever of the white keys.  
With the Fatar TP9-88 I could generate shortest delay of 40 ticks on black keys, with the white ones I never came under 57 ticks.
- delay\_slowest can be made fixed, since it determines the latency of the sent MIDI cmd,  
eg. delay\_slowest = delay\_fastest + 127 \* 8 =\> 31,7 ms latency.
- kc-\>break\_inverted seems not to be initialized in KEYBOARD\_Init().
- In fct: void KEYBOARD\_SRIO\_ServicePrepare(void) which is called every 30 us:

_// optional scan optimization for break/make: if break not active, we don’t need to scan make  
if( kc-\>scan\_velocity && !kc-\>break\_inverted && kc-\>scan\_optimized ) {…_  
// can ber replaced by :  
_i**f( kc-\>scan\_optimized )** { …_

If the remaining conditions are checked in KEYBOARD\_Init() and the related Set\_..() functions

Before I intended to modify the code, I build the project from the Reposity with Rev 1633 and loaded it into the platform.  
Everything went as expected until I pressed one of the two rightmost keys (B-6 & C-7):

The System crashed with _" **!! HARD FAULT !! at PC = 0x000064d8**"_

Since I havenÂ´t any debugger I decided to go the hard way and did some version comparisons…

I went back to Rev 1632 which was the the revision of your Build V1.007 and everything works without crashes.  
I checked the differencies to Rev 1633 and found out that _app\_lcd_ for universal lcd was changed, but this should not have any influence on the code.  
But then I realized that the \_ **terminal.c** \_ code was updated for all apps except for the **Keyboard**.

So after modifying terminal.c the crashes were gone.  
IÂ´m not 100% sure if I made the changes at the right places in terminal.c, so it would be fine if you can review the attached terminal.c and update the repository

Thanks very much and best regards  
Jo  
&nbsp;

[terminal.zip](\< _ **base\_url** _ \>/applications/core/interface/file/attachment.php?id=10328)

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [January 20, 2013, 12:17pm UTC](https://forum.midibox.org/t/midibox-kb/16560/39 "2013-01-20T12:17:01Z")

</div>

Hi Jo,

thanks for the feedback!

I will check your findings & proposals this evening.

To the changes in terminal.c: they can’t be the reason for such a crash, the root cause must be somewhere else - e.g. a stack overflow or something similar. I will try to reproduce this.

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![nlate](https://forum.midibox.org/letter_avatar_proxy/v4/letter/n/d26b3c/32.png) [@nlate](https://forum.midibox.org/u/nlate)\
**Post date:** [January 20, 2013, 3:42pm UTC](https://forum.midibox.org/t/midibox-kb/16560/40 "2013-01-20T15:42:50Z")

</div>

Dear Thorsten

Thanks in advance for your investigations.

In the meantime I made some measurements with my USB logic analyzer.  
They may be helpful for the MBKB project documentation.  
I attached them as screenshots, the titles are hopefully self-explainining.

- _MBKB\_1RowScan.jpg_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Detail, how the Dout registers are controlled for one row.
- _MBKB\_ScanNonOptimizedOnly.jpg_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Timing for non optimized row scan without key press
- _MBKB\_ScanOptimizedOnly.jpg_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Same as above but with optimized row scan
- _MBKB\_ScanNonOptimizedC-0pressed.jpg_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Timing for 1 Key press C-0 non optimized scan
- _MBKB\_ScanOptimizedC-0pressed.jpg_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Same as above but with optimized scan
- _MBKB\_ScanOptimizedC-0\_D-3pressed.jpg_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 keys pressed on Left and Right half of the 88 key Fatar keyboard with optimized row scan.
- _MBKB\_ScanOptimizedLhRhChordPressed.jpg_ 6-key Cord press with optimized row scan

I also added the timing files in the zip archive the can be viewed in with the  
Analyzer SW available at [http://www.pctestinstruments.com/downloads.htm](http://www.pctestinstruments.com/downloads.htm) running in Demo mode  
&nbsp;

Best regards

Jo

 ![post-6136-0-20946500-1358695948.jpg](https://forum.midibox.org/uploads/default/original/2X/8/8567fed204f8ba507cf3b6fb117294e06040ea07.jpeg)

 ![post-6136-0-32845000-1358696044.jpg](https://forum.midibox.org/uploads/default/original/2X/7/7a2d1fea2060a063d45f08d7a6b96d3671597633.jpeg)

 ![post-6136-0-37766700-1358696115.jpg](https://forum.midibox.org/uploads/default/original/2X/6/60a4b71ea6dc3550ce61d6266ca5944769a9bdc3.jpeg)

 ![post-6136-0-65689500-1358696185.jpg](https://forum.midibox.org/uploads/default/original/2X/d/db02e4540c28753124fc1d69c5b92cd6e489ba92.jpeg)

 ![post-6136-0-04840200-1358696233.jpg](https://forum.midibox.org/uploads/default/original/2X/c/c6b026906c884bc1d386bd4a8bdc10850f77796a.jpeg)

 ![post-6136-0-99711700-1358696277.jpg](https://forum.midibox.org/uploads/default/original/2X/8/8dd325b99742b76c6445b149ae4d46a7b345297f.jpeg)

 ![post-6136-0-39859800-1358696324.jpg](https://forum.midibox.org/uploads/default/original/2X/8/8bfe2e60ea54d0c0ee90b1860cd6302e123dcfe6.jpeg)

[MBKBtimings.zip](\< _ **base\_url** _ \>/applications/core/interface/file/attachment.php?id=10337)

[Previous page](https://forum.midibox.org/t/midibox-kb/16560.md?page=1)

[Next page](https://forum.midibox.org/t/midibox-kb/16560.md?page=3)
