Jump to content

Request for beta testers: .NGR script execution from RAM


TK.
 Share

Recommended Posts

Hi,

in the last months multiple users requested faster execution of .NGR run scripts to cover their use cases. The only way to achieve this is the execution from RAM, and in order to ensure that even the execution of long and complex scripts is possible, the NGR commands have to be compressed (resp. I call it "tokenized")

In the last two days I developed a solution for this request - it was a nice programming challenge (although I hate the immense amount of required spaghetti code to cover all options - next time I will use a code generator... ;-)

Typically scripts are now executed in much less than 1 mS, which means that it's finally possible to use them for timing critical operations!

Only drawback: this feature is only supported for MBHP_CORE_STM32F4, because the other cores don't have enough RAM available - they are executing the script directly from SD Card like before.

Here the current version:
http://www.ucapps.de/mios32/midibox_ng_v1_033_pre14.zip

It would be helpful if users could help me with the testing by running their existing .NGR files, and maybe also enhancing the files for realtime processing.
Any feedback is welcome! :)

Best Regards, Thorsten.

Link to comment
Share on other sites

Potential use cases which didn't work properly in the past, but should be possible now:

Also this issue should be solved now: http://midibox.org/forums/topic/19477-problem-with-keys-and-runsection-command/

Best Regards, Thorsten.

Link to comment
Share on other sites

Hi

I will try .ngr again for some cascade note command to active and flip automation mode with MCU protocole, I think it will save me lot of sender/receiver event and fwd command in my actual .ngc

question: is it possible with ram .ngr to write something to scale data in efficient way?

like "if Ain=x send midi pitchbend=y" in one direction and "if pitchbend=y send Aout=x" in other direction

should be 1024 (9bit) x2 (in and out) x 8 (pitchbend fader) =16384 line of code for my usecase...

doable ?

Best

Zam

 

Link to comment
Share on other sites

question: is it possible with ram .ngr to write something to scale data in efficient way?

like "if Ain=x send midi pitchbend=y" in one direction and "if pitchbend=y send Aout=x" in other direction

should be 1024 (9bit) x2 (in and out) x 8 (pitchbend fader) =16384 line of code for my usecase...

doable 

no, IF/ELSE is the wrong approach for this purpose, and the RAM is limited to 16k ;-)

But in future I could provide a special command which allows to scale during runtime based on an interpolated curve with n number of nodes. This would consume some additional execution time, but it should be fast enough on a STM32F4 - the memory consumption is then dramatically reduced.

In general it's an advantage of the .NGR approach that special commands and mechanisms could be provided in future.
Sooner or later I will clean-up the source code to simplify the integration of new commands (I've to improve it anyhow, because currently we've too much quick&dirty spaghetti code)

Best Regards, Thorsten.

Link to comment
Share on other sites

Hi TK

Ok I forget my scale table with NRG

So you think real time scaling is better than hard table like the last MF_NG update. memory space VS cpu speed :)

 

To come back with this new version, there is something strange about MAP.

let say MAP 1 2 3

I have a button pattern command that involve to set button B to the last status (3) if button A is pressed, to ensure next time I press button B it send status 1 whatever status 1 2 or 3 he have before pressing button A

Button A and B have the same "system" to ensure each other reset the other to 1

It worked well with sender/receiver at NGC. Yesterday with the update I try to "simplify" this with run section and conditional NGR, I try "change" command to do the same function, the button B status change to the respective value forced by button A (debug view) BUT if i press the button B it go cycle to it's own previous value (MAP 1 2 3) without considering what button A just set to him.

I reload my previous NGC, it don't work any more ?!?

Any idea?

Best

Zam

 

 

Link to comment
Share on other sites

In pre7 I added a bugfix for MAPs with duplicated values to cover Bartosz' use case; see also http://midibox.org/forums/topic/19535-encoder-and-maps-problem-bug and http://svnmios.midibox.org/comp.php?repname=svn.mios32&compare[]=%2Ftrunk%2Fapps%2Fcontrollers%2Fmidibox_ng_v1%2F%402174&compare[]=%2Ftrunk%2Fapps%2Fcontrollers%2Fmidibox_ng_v1%2F%402153

Could you please give me a downstripped .NGC file (and/or .NGR in addition) which demonstrates your intention? It could be that due to the changes a new way has to be found.

Best Regards, Thorsten.

Link to comment
Share on other sites

Hi TK

Here is the .NGC section, it's "beta", and it work with my actual DAW (not bidirectional for led unfortunately),

It's under MCU protocol, it allow to switch between read and rec automation with 3 rec mod.

One button select read or write, second is write mode (touch, latch, overwrite). Two led (green/red) follow the pattern to light in specific order.

The specific "reset" function is red highlighted below. It force last MAP value to ensure first MAP value at next press. Work well with pre6 not with pre14 (I don't try other version).

I also have a NGC+NGR allowing bidirectional operation, but it don't work well for the moment at LED side (button patter work fine with less code...). The only DAW return data for read touch or latch (for my led pattern) is a sysex for the mackie LCD update... I don't think it's relevant for the MAP problem we talk now.

Best

Zam

 

################################################################################
# automation mode (work with DP4.6)
################################################################################

########################
#fader 1 button patern
########################

EVENT_LED       id=6     hw_id=6      value=0               
EVENT_LED       id=3     hw_id=3      value=0

MAP10   1 2 3

EVENT_BUTTON id=2 hw_id=2  fwd_id=sender:20 range=map10 button_mode=Toggle
#touch
EVENT_SENDER id=200  hw_id=20  fwd_id=sender:21:127 if_equal=1
EVENT_SENDER id=201  hw_id=21  type=NoteOn chn=1 key=0x4b  
EVENT_SENDER id=202  hw_id=21  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=203  hw_id=20  fwd_id=sender:22:0   if_equal=1
EVENT_SENDER id=204  hw_id=22  type=NoteOn chn=1 key=0x4b  
EVENT_SENDER id=205  hw_id=22  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=206  hw_id=21  fwd_id=led:6:127
EVENT_SENDER id=207  hw_id=21  fwd_id=led:3:127
#latch
EVENT_SENDER id=210  hw_id=20  fwd_id=sender:23:127 if_equal=2
EVENT_SENDER id=211  hw_id=23  type=NoteOn chn=1 key=0x4e
EVENT_SENDER id=212  hw_id=23  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=213  hw_id=20  fwd_id=sender:24:0   if_equal=2
EVENT_SENDER id=214  hw_id=24  type=NoteOn chn=1 key=0x4e
EVENT_SENDER id=215  hw_id=24  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=216  hw_id=23  fwd_id=led:6:0
EVENT_SENDER id=217  hw_id=23  fwd_id=led:3:127
#write
EVENT_SENDER id=220  hw_id=20  fwd_id=sender:25:127 if_equal=3
EVENT_SENDER id=221  hw_id=25  type=NoteOn chn=1 key=0x4d
EVENT_SENDER id=222  hw_id=25  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=223  hw_id=20  fwd_id=sender:26:0   if_equal=3
EVENT_SENDER id=224  hw_id=26  type=NoteOn chn=1 key=0x4d
EVENT_SENDER id=225  hw_id=26  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=226  hw_id=25  fwd_id=led:6:0
EVENT_SENDER id=227  hw_id=25  fwd_id=led:3:127
#reset automation to "read" if button "mode" is activated
EVENT_SENDER id=230  hw_id=20  fwd_id=button:7:1

MAP11   1 2

EVENT_BUTTON id=7 hw_id=7  fwd_id=sender:70 range=map11 button_mode=toggle
#Off
EVENT_SENDER id=700  hw_id=70  fwd_id=sender:71:127 if_equal=1
EVENT_SENDER id=701  hw_id=71  type=NoteOn chn=1 key=0x4a  
EVENT_SENDER id=702  hw_id=71  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=703  hw_id=70  fwd_id=sender:72:0  if_equal=1
EVENT_SENDER id=704  hw_id=72  type=NoteOn chn=1 key=0x4a  
EVENT_SENDER id=705  hw_id=72  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=706  hw_id=71  fwd_id=led:6:0
EVENT_SENDER id=707  hw_id=71  fwd_id=led:3:0
#read
EVENT_SENDER id=710  hw_id=70  fwd_id=sender:73:127 if_equal=2
EVENT_SENDER id=711  hw_id=73  type=NoteOn chn=1 key=0x4a  
EVENT_SENDER id=712  hw_id=73  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=713  hw_id=70  fwd_id=sender:74:0   if_equal=2
EVENT_SENDER id=714  hw_id=74  type=NoteOn chn=1 key=0x4a  
EVENT_SENDER id=715  hw_id=74  type=NoteOn chn=1 key=0x18
EVENT_SENDER id=716  hw_id=73  fwd_id=led:6:127
EVENT_SENDER id=717  hw_id=73  fwd_id=led:3:0
#reset automation mode to "touch" if activated
EVENT_SENDER id=720  hw_id=70  fwd_id=button:2:3

Edited by Zam
Link to comment
Share on other sites

Ok, I tried following minimized configuration:

MAP1 1 2 3
EVENT_BUTTON id=1 fwd_id=SENDER:1 range=map1 button_mode=Toggle
EVENT_SENDER id=1 type=NoteOn chn=1 key=0x4b  

EVENT_BUTTON id=2 fwd_id=SENDER:2 button_mode=OnOnly
EVENT_SENDER id=2 fwd_id=BUTTON:1:1

and found a way to handle your use case.

Please try this version: http://www.ucapps.de/mios32/midibox_ng_v1_033_pre15.zip

Best Regards, Thorsten.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...