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.
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 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..
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…
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 ;).
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.
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.
Its always hard to accept higher latencies mentally, though in practice it often makes less difference that you think (esp. when its <5ms total). I am and 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..)
Am I correct in understanding that using optimized scan on a NG based KB may add only 800 or 900us to the total latency?
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..)
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.
Would it ever be noticed? (imho) no, does it bother me (mentally) that the velocity output would be granular, yes :hmm: .
Personally (subject to change, of course!) I might entertain the idea of developing on a small STM32 “minicore” (minimal MB Core32) 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?).
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 …
… 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!!
Could have saved my about 5 hours if I just tried to connect them and see what happens, but anyway… :rolleyes:
So far everything’s working great. Ready to try MB_NG+KB …
I spent half a day to measure the matrix layout / connections of my old miditech keyboard, just find out that …
… 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!!!
Would that be the same Miditech / Midiplus keybed that I aquired some time ago? That would be sweet, would save me from measuring that shiz as well :w00t:
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 : if( 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
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.
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 Detail, how the Dout registers are controlled for one row.
MBKB_ScanNonOptimizedOnly.jpg Timing for non optimized row scan without key press
MBKB_ScanOptimizedOnly.jpg Same as above but with optimized row scan
MBKB_ScanNonOptimizedC-0pressed.jpg Timing for 1 Key press C-0 non optimized scan
MBKB_ScanOptimizedC-0pressed.jpg Same as above but with optimized scan
MBKB_ScanOptimizedC-0_D-3pressed.jpg 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