Help: equivalence between control keys: button, USB or MIDI keyboard

EQUIVALENCE BETWEEN CONTROL KEYS WITH BUTTON, USB or MIDI KEYBOARD (or MIDI PAD) FOR 120 NOTES

I would like to make a small compilation of 3 groups of API codes available to build tools that address the following equivalence:The reference is “a button”, basically it is to control the 120 notes with 3 peripherals…The starting point is to ignore OSC Server.

A ) A BUTTON (with mouse)

A button has 2 states: pressed and released (= notifier).Can be controlled with viewbuilder. Example:

vb:button{
  id = 'BT_ID',
  pressed = function() XXX end,
  released = function() YYY end --(notifier is equivalent)
}

XXX and YYY are the functions of action and stop that we want to do.A button is controlled with the mouse.

Question 1: In this first case, is there any way to do the following?:

  • if vb.views[‘BT_ID’].pressed then AAA = BBB end
  • if vb.views[‘BT_ID’].released then CCC = DDD end

That is, is it possible to control the two button states from the USB keyboard or from the MIDI keyboard?

B ) A KEY of USB keyboard (Z,S,X,D,C…)

A key of keyboard USB (alphanumerical keyboard USB), has 2 states? Can be controlled with keyhadler. Example:

function keyhandler( dlg , key )
  rprint(key) -- print the value of key to the console
  -- return key -- uncomment to pass key on to Renoise
  local choice_via_shortcut = nil
  if key.character == 'z' then AAA = BBB end
  if key.character == 's' then CCC = DDD end
  ...
  ...
end

We have 5 commands: key.name, key.modifiers, key.character, key.note & key.repeated…

Question 2:“key.repeated == true” is equivalent to pressed button? A key physically also has two states (basically is a button): key pressed and key released.Does the API have anything equivalent? For example:

  • if key.character_pressed == ‘z’ then AAA = BBB end
  • if key character_released == z’ then CCC = DDD end
  • if key character_pressed == s’ then EEE = FFF end
  • if key character_released == s’ then GGG = HHH end

“key.character_pressed” or “key.character_released” or something similar.How is the correct code to control these two states?How is key.repeated used correctly?

C ) A KEY of MIDI keyboard (MIDI Input)

With “midi_mapping” is possible to execute a function with a button, using viewbuilder. For example:

vb:button{
  id = 'BT_ID',
  pressed = function() XXX end, --(with mouse)
  released = function() YYY end --(notifier is equivalent) --(with mouse)
  midi_mapping = function() ZZZ end -- (with MIDI keyboard)
}

“midi_mapping = function() ZZZ end” is equivalent to released or notifier button (release the button).

Question 3:Is there any way to control midi input commands for pressed and released (without using osc server)? For example:

  • midi_mapping_pressed = function() ZZZ end
  • midi_mapping_released = function() AAA end–(the same as actual midi_mapping)

What is the correct code to control the 120 notes using MIDI input?



My intention is to compile the API available for these 3 cases, without using OSC Server.

I also want to make a formal request for these three forms of control to have a clear equivalence for the 3 peripherals, USB keyboard, mouse and MIDI keyboard without the need to use OSC Server.Not only to be able to control the recording of the notes, but also to be able to record live the notes and all associated parameters (volume (velocity), panning, delay and sample effects).

Some possible equivalences would be:

  1. button.pressed - key.character_pressed -midi_mapping_pressed
  2. button.released - key.character_released -midi_mapping_released

Why is not there something similar?In the end, controlling the 3 peripherals (mouse, USB Keyboard and MIDI keyboard) is a mess or practically impossible, having to resort to “patches” such as OSC Server for build a tool.Solving this in a more coherent way would help create better tools.

Note: this topic could be in the ideas and suggestions section as well.However, my idea is to collect the data currently available, since updating the API seems like an impossible task in recent months because Taktik is working on something else.

Please, anyone who can clarify any point, even with examples, comment here…