Difference between revisions of "Firmware-830 Command-106"

From I-CubeX Wiki
Jump to: navigation, search
(Mapping sensor inputs)
Line 255: Line 255:
 
The impulse signal processing settings are:
 
The impulse signal processing settings are:
  
*The activation status {g} which will also start sampling of the sensor input.
+
*The activation status {g} which will also start sampling of the sensor input if the input is enabled using the STREAM command.
 
*The time window setting {pppp} within which {pppp} + 1 sensor values are compared so as to find the highest value (peak search, where the threshold {lllllll} is smaller than {mmmmmmm}) or lowest value (dip search, where the threshold {lllllll} is greater than {mmmmmmm}).
 
*The time window setting {pppp} within which {pppp} + 1 sensor values are compared so as to find the highest value (peak search, where the threshold {lllllll} is smaller than {mmmmmmm}) or lowest value (dip search, where the threshold {lllllll} is greater than {mmmmmmm}).
 
*The impulse end notification setting {k} which provides a way to determine the duration of the impulse.
 
*The impulse end notification setting {k} which provides a way to determine the duration of the impulse.
Line 286: Line 286:
  
 
The 4-byte long configuration message sets the minimum and maximum of the most significant byte of the MIDI message value.
 
The 4-byte long configuration message sets the minimum and maximum of the most significant byte of the MIDI message value.
 
  
 
==Mapping sensor inputs to actuator outputs==
 
==Mapping sensor inputs to actuator outputs==

Revision as of 03:38, 1 May 2023

EDIT CONFIG (106, 6Ah)

Each of the sensor inputs of the WiDig can be edited using the EDIT CONFIG command. Upon completion of the command the WiDig is re-initialized with the new settings and the WiDig sends out the DUMP CONFIG message. The EDIT CONFIG command can be used to start sending out MIDI messages calculated from sensor values immediately while the WiDig is powered, but it is also possible to send a STREAM command to the WiDig. Activating either or both signal processing methods will enable the sending of MIDI messages. To change the sampling interval use the INTERVAL command. The RESET command does not change any of the settings as stored by the EDIT CONFIG command in non-volatile memory. For default settings see the CLEAR CONFIG command.


Editing Sensor Inputs

To edit a sensor input of the WiDig the [BODY] of the EDIT CONFIG command can consist of either 9 or 4 bytes.


9 bytes

00000001: 1; configuration number
00bbbaaa: aaa = [0..7]; sensor input number
bbb = [0..7]; virtual input number
0dddcccc: ddd = [0..6]; MIDI mapping type (0 = note-off, 1 = note-on velocity, 2 = key-pressure, 3 = control-change, 4 = program-change, 5 = after-touch, 6 = pitch-bend, 7 = note-on note)
cccc = [0..15]; MIDI channel
0eeeeeee: eeeeeee = [0..127]; note number (mapping type 0..2), controller number (mapping type 3), irrelevant for mapping type 4..6, velocity (mapping type 7)
00kjihgf: f,g,h,i,j,k determine signal processing settings, see notes for combining
k = [0,1]; impulse end notification (0 = off, 1 = on)
j = [0,1]; impulse maximum/minimum constant (0 = off, 1 = on)
i = [0,1]; continuous and/or impulse signal differentiation (0 = off, 1 = on)
h = [0,1]; continuous and/or impulse signal smoothing (0 = off, 1 = on)
g = [0,1]; impulse signal processing (0 = off, 1 = on)
f = [0,1]; continuous signal processing (0 = off, 1 = on)
0lllllll: lllllll = [0..127]; sensor input threshold
0mmmmmmm: mmmmmmm = [0..127]; sensor input ceiling
0nnnnnnn: nnnnnnn = [0..127]; noise gate
0qqqpppp: pppp = [0..15]; time window (if {i} = 1) or constant value (if {g} = 1 and {j} = 1)
qqq = [0..7]; smoothing (if {h} = 1)


4 bytes

00000001: 1; configuration number
00bbbaaa: aaa = [0..7]; sensor input number
bbb = [0..7]; virtual input number
0rrrrrrr: rrrrrrr = [0..127]; minimum value of MIDI output MSB (most significant byte)
0sssssss: sssssss = [0..127]; maximum value of MIDI output MSB (most significant byte)


MIDI mapping settings

{0dddcccc} in decimal with MIDI channel = 0:

0 = note-off
16 = note-on velocity (sensor value is mapped to the velocity of the note-on message)
32 = key-pressure
48 = control-change
64 = program-change
80 = after-touch
96 = pitch-bend
112 = note-on (sensor value is mapped to the note value of the note-on message)


Signal processing operations

{kjihgf} in decimal:

1 = continuous signal output
2 = impulse (peak or dip) detection
3 = impulse detection, then continuous output
4 = no signal processing (output disabled)
5 = continuous smoothed output
6 = impulse detection, peak-peak timing output (as milliseconds in pitch-bend message, scaled otherwise)
7 = impulse detection, smoothed, then continuous smoothed output
8 = no signal processing (output disabled)
9 = continuous differentiated output (ie. the difference between the last two samples)
10 = impulse detection, differentiated
11 = impulse detection differentiated, then continuous differentiated output
12 = no signal processing (output disabled)
13 = continuous output, smoothed and then differentiated
14 = impulse detection, smoothed and then differentiated
15 = impulse detection, smoothed and differentiated, then continuous smoothed, differentiated output
16 = no signal processing (output disabled)
17 = continuous signal output (setting for impulse maximum/minimum constant {j} is ignored)
18 = impulse detection, output as a constant value
19 = impulse detection, output as a constant value, then continuous output
20 = no signal processing (output disabled)
21 = smoothed continuous output (setting for impulse maximum/minimum constant {j} is ignored)
22 = impulse detection, peak-peak timing output as BPM (beats per minute)
23 = impulse detection, output as a constant value, then continuous smoothed output
24 = no signal processing (output disabled)
25 = continuous differentiated output (setting for impulse maximum/minimum constant {j} is ignored)
26 = impulse detection, smoothed, output as a constant value
27 = impulse detection, output as a constant value, then continuous differentiated output
28 = no signal processing (output disabled)
29 = continuous smoothed output, differentiated (setting for impulse maximum/minimum constant {j} is ignored)
30 = impulse detection, output as a constant value (settings for continuous and/or impulse signal differentiation and smoothing {hi} are ignored)
31 = impulse detection, output as a constant value, then continuous smoothed output, differentiated
32 = no signal processing (output disabled)
33 = continuous output (setting for impulse end notification {k} is ignored)
34 = impulse detection with end of impulse notification
35 = impulse detection with end of impulse notification, then continuous output
36 = impulse detection, smoothed, with end of impulse notification
37 = continuous smoothed output (setting for impulse end notification {k} is ignored)
38 = impulse detection, single peak-end timing output
39 = impulse detection, single peak-end timing output, then continuous output
40 = no signal processing (output disabled)
41 = continuous differentiated output (setting for impulse end notification {k} is ignored)
42 = impulse detection, differentiated, with end of impulse notification
43 = impulse detection, with continuous differentiated output and end of impulse notification
44 = no signal processing (output disabled)
45 = continuous smoothed, differentiated output (setting for impulse end notification {k} is ignored)
46 = impulse detection, single peak-end timing output (setting for continuous and/or impulse signal differentiation {i} is ignored)
47 = impulse detection, with continuous differentiated output, then single peak-end timing output
48 = no signal processing (output disabled)
49 = continuous output (settings for impulse end notification and maximum/minimum constant {kj} are ignored)
50 = impulse detection, output as a constant value, with end of impulse notification
51 = impulse detection, output as a constant value, with end of impulse notification, then continuous output
52 = no signal processing (output disabled)
53 = continuous smoothed output (settings for impulse end notification and maximum/minimum constant {kj} are ignored)
54 = impulse detection, single peak-end timing output, smoothed
55 = impulse detection, with continuous output, then single peak-end timing output, smoothed
56 = no signal processing (output disabled)
57 = continuous differentiated output (settings for impulse end notification and maximum/minimum constant {kj} are ignored)
58 = impulse detection, single peak-end timing output (setting for impulse maximum/minimum constant {j} is ignored)
59 = impulse detection, with continuous differentiated output, then single peak-end timing output ({f} is ignored)
60 = no signal processing (output disabled)
61 = continuous smoothed, differentiated output (settings for impulse end notification and maximum/minimum constant {kj} are ignored)
62 = impulse detection, single peak-end timing output, smoothed (setting for impulse maximum/minimum constant {j} is ignored)
63 = impulse detection, with continuous differentiated output, then single peak-end timing output, smoothed (setting for impulse maximum/minimum constant {j} is ignored)


Mapping sensor inputs

The 9-byte long configuration message sets signal processing and MIDI mapping.

Impulse signal processing is useful when the sensor signal can be characterized as an impulse, ie. as either rising from below a minimum value to a maximum value after which it eventually drops below a certain minimum value, or as dropping below a minimum value after which it eventually rises above a certain maximum value. Subsequent impulses may appear asynchronously.

Continuous signal processing is useful when the sensor signal can be characterized as a continuously varying signal without any specific start or end.

The impulse signal processing settings are:

  • The activation status {g} which will also start sampling of the sensor input if the input is enabled using the STREAM command.
  • The time window setting {pppp} within which {pppp} + 1 sensor values are compared so as to find the highest value (peak search, where the threshold {lllllll} is smaller than {mmmmmmm}) or lowest value (dip search, where the threshold {lllllll} is greater than {mmmmmmm}).
  • The impulse end notification setting {k} which provides a way to determine the duration of the impulse.
  • The maximum/minimum constant setting {j}. For this setting the time window {pppp} is not used. It provides a way to output each impulse maximum/minimum (peak/dip) as a constant of value 16 x {qqq} + 15, ie. There are only 8 constant values available.

If the sensor value rises above {mmmmmmm} ({mmmmmmm} greater than {lllllll}) or drops below {mmmmmmm} (ie. {mmmmmmm} smaller than {lllllll}) before {pppp} + 1 samples have been obtained, the peak/dip search is stopped and is immediately output as peak/dip value.

The continuous signal processing settings are:

  • The activation status {f} which will also start sampling of the sensor input
  • The smoothing setting {h} which enables calculation of the exponential moving average of the sensor value.
  • The smoothing factor setting {pppp} (the higher the value, the more smoothing is applied).
  • The differentiation setting {i} which enables calculation of the absolute difference between the current and last output value.

Continuous signal processing can be combined with impulse signal processing and will be useful for sensor signals that have an onset with a local maximum or minimum after which the sensor value continues for some time to stay above the minimum or below the maximum before it eventually drops below the minimum or rises above the maximum.

Impulse signal processing can also be applied to continuously varying signals such as AC (alternating current) signals and recurring impulses of which only the peak (or dip) value is relevant. Deactivate impulse end notification, ie. set {k} = 0, to avoid sending out MIDI value zero.

In both impulse and continuous signal processing the 10-bit sensor value is scaled between the threshold {lllllll} and ceiling {mmmmmmm}, and the resulting value has to increase beyond the noise gate {nnnnnnn} (mapping types 1-5) or beyond the noise gate {nnnnnnn} times 4 (mapping type 6) before being output. After passing the noise gate the value itself or the absolute difference between the current and last calculated value can be output by activating the differentiation setting {i}.

If either impulse or continuous signal processing is active, the calculated values are represented by (mapping types 0..2) the 2nd data field of a MIDI channel voice note-off (header 80h), note-on (header 90h), key-pressure (header A0h) message with note number {eeeeeee}, or (mapping type 3) by the 2nd data field of a control-change (header B0h) message with control number {eeeeeee}, or (mapping type 4 and 5) by the 1st data field of a program-change (header C0h) or after-touch (header D0h) message or (mapping type 6) by the two data fields of a pitch-bend (header E0h) message or (mapping type 7) by the 1st data byte of a note-on (header 90h) message.

Control-change messages are sent as pairs when setting the controller number to 32 .. 63 so as to allow mapping sensor signals at up to 14-bit resolution. The MSB (the byte containing the 7 most significant bits) is sent first in a control-change message using the set controller number minus 32 and the LSB (the byte containing the 7 least significant bits) is sent immediately afterwards in a control-change message using the set controller number.

If both impulse and continuous signal processing are active ({f} = 1, {g} = 1) the sensor value’s start and end are characterized using impulse signal processing and represented as one of the channel voice MIDI messages listed above, while the signal between start and end is characterized using continuous signal processing and always represented as the key-pressure value of a MIDI channel voice key-pressure (header A0h) message. Note that if smoothing is activated, {pppp} will also be used as the smoothing factor, ie. {pppp} + 1 samples will be taken for peak/dip detection and subsequently {pppp} will be used as smoothing factor.

For example, if impulse signal processing is activated ({g} = 1), the threshold {lllllll} is smaller or equal than the ceiling {mmmmmmm} and note-on mapping has been selected, then, once the sensor value rises above the threshold {lllllll}, a note-on message with velocity value greater than zero will be sent and no new note-on message with velocity greater than zero will be sent until the sensor value has dropped below {lllllll}. If continuous signal processing is activated as well ({f} = 1), then, after sending a note-on message, the sensor value will be represented by the key-pressure data field of a MIDI channel voice key-pressure message, until the sensor drops below {mmmmmmm} upon which a note-on message with velocity zero will be sent out.

If either impulse or continuous signal processing is activated, MIDI messages calculated as defined by the signal processing method(s) will be sent out. If both are deactivated no MIDI output is generated. MIDI running status is implemented in the MIDI output mapping when using stand-alone mode.

The 4-byte long configuration message sets the minimum and maximum of the most significant byte of the MIDI message value.

Mapping sensor inputs to actuator outputs

In order for actuator outputs to respond to sensor input the EDIT CONFIG command is used with a special value for the 2nd databyte in the [BODY]:

00000001: 1; configuration number
0xyyyyyy: x = 1; input-output mapping message flag
yyyyyy = [0..63]; (virtual) sensor input number
0mn00zzz: m = 0; input-output mapping disabled
m = 1; input-output mapping enabled
n = 0; trigger mode (directly translated output if continuous control enabled)
n = 1; toggle mode (inversely translated output if continuous control enabled)
zzz = [0..7]; actuator output number
0vvvvvvv: vvvvvvv = [1..127]; on-threshold (maximum input if continuous control is enabled)
0wwwwwww: wwwwwww = [0..126]; off-threshold (minimum input if continuous control is enabled)

Trigger mode means a sensor input value greater than or equal to the on-threshold {vvvvvvv} turns actuator output on and a message with velocity or data field smaller than or equal to the off-threshold {wwwwwww} turns actuator output off.

Toggle mode means a sensor input value greater than or equal to the on-threshold {vvvvvvv} or a sensor input value smaller than (and not equal to) the off-threshold {wwwwwww} toggles actuator output on and off.

If the actuator output that the sensor input is mapped to is continuous control enabled, the sensor input value is clipped between the thresholds and scaled to the difference between the thresholds. Toggle mode inverts the scaling.

Channel Voice MIDI messages can be sent to the digitizer to control actuators. The MIDI message that the sensor input is mapped to can be sent to the digitizer to control the actuator, independently from any sensor input.

See also the SET OUTPUT command.