some of you already know that I’m very interested in getting the keyboard-handling as smooth as possible. Some of you also know too that the higher scanrate of the KB-app allows a much higher velocity-resolution than in NG. NG is very limited in this case and only allows a few (like 10-20) velocity-values. What I’m trying to achieve is, to modify NG in that way that the scanrate of the digital I/Os respective the I/Os where the keyboard is connected to is higher to get a better velocity resolution. The reason for that is, that NG allows a much easier way to modify the keyboard parameters and also due to the SD-card it’s very easy to make a backup of your configuration. I had it now a few times, that (for whatever reason) MB_KB was reset.
So I took a closer look at the source code of what is going on under the hood in NG. As far as I can see the Period-Scanning is in both apps NG and KB 1ms.
I’d like to know what blocks NG to give the digital I/O scanning a higher scanrate. Are there any other routines running in background that I can simply disable if I don’t need them? I’ll do some test the next days but if anyone can give some hints on this, I’d be happy to read them!
In src/mios32_config.h you could change the number of DOUT pages from 32 to 1:
#define MIOS32\_SRIO\_NUM\_DOUT\_PAGES 1
This will increase the scan rate by factor 32
Compile will fail with:
src/mbng\_matrix.c:53:3: error: #error "not prepared for != 32 pages - many variable types have to be adapted!" src/mbng\_matrix.c: In function 'MBNG\_MATRIX\_DOUT\_NotifyReceivedValue':
the appr. “#error” line has to be removed
It says, that all LED_MATRIX related functions won’t work anymore, such as LED rings
//edit: Alright, I set scan_optimized=1 and I get a lot more velocities! Great! Are there any other ways to speed up the scanrate or is that going to deep? ;)
Yes, you could remove unusued functions from APP_SRIO_ServiceFinish() in src/app.c
E.g.
remove SCS functions if the SCS isn’t connected to DIN pins.
remove MBNG_MATRIX_GetRow() if no BUTTON_MATRIX is used
remove MIOS32_ENC_UpdateStates if no encoders are connected
That’s all what can be improved, the additional overhead is caused by the application itself, at the end you would come to a downstripped version like MIDIbox KB
However, if it turns out that the removals from APP_SRIO_ServiceFinish help, then I could add runtime options to disable certain functions in future so that no recompile is required.
If it can helps, I’m using midibox ng and i’m getting 24 different values on fatar tp 40m, but i’m using the map feature.
I also used MidboxKb for a long time and i was sometimes getting some stuck notes. Then i switched to midibox ng when the MAP feature was added, everything is now working great, i really can’t explain the problem i had with with midiboxkb.
reduce number of SRs for faster scan
with 2 SRs the scan takes ca. 500 uS instead of 2.5 mS
Okay, but why do you use a map with just 24 values? You loose a lot of the dynamic range of a keybed. Also I think it’s better if you use the integrated interpolation-technique to adjust the velocity. It’s way more easy and way less work ;-)