Firmware-811 Command-106

From I-CubeX Wiki
Jump to: navigation, search

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.


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
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)


Default Settings for sensor inputs

Default settings for each sensor input are:

Sensor input MIDI mapping type {ddd}: 3; control-change
Sensor input MIDI channel mapping {cccc}: 0
Sensor input MIDI ctl/note mapping {eeeeeee}: sensor input {aaa} + 1
Sensor input impulse end notification {k}: 0; off
Sensor input impulse maximum set to constant {j}: 0; off
Sensor input cont. and/or impulse signal diff. {i}: 0; off
Sensor input continuous signal smoothing {h}: 0; off
Sensor input impulse signal processing {g}: 0; off
Sensor input continuous signal processing {f}: 1; on
Sensor input threshold {lllllll}: 0; minimum
Sensor input ceiling {mmmmmmm}: 127; maximum
Sensor input noise gate {nnnnnnn}: 1
Sensor input constant value {qqq}: 0
Sensor input time window or smoothing factor {pppp}: 0; off

MIDI mapping settings

{dddcccc} 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.
  • 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 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 by the 2nd data field of a control-change (header B0h) message with control number {eeeeeee}, or by the 1st data field of a program-change (header C0h) or after-touch (header D0h) message or by the two data fields of a pitch-bend (header E0h) message.

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 (normal output if PWM enabled)
n = 1; toggle mode (inverted output if PWM enabled)
zzz = [0..7]; actuator output number
0vvvvvvv: vvvvvvv = [1..127]; on-threshold (maximum input if PWM enabled)
0wwwwwww: wwwwwww = [0..126]; off-threshold (minimum input if PWM 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 pulse-width modulation enabled, the sensor input value is clipped between the thresholds and scaled to the difference between the thresholds. Toggle mode inverts the scaling.

Mapping MIDI input to actuator outputs

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

00000001: 1; configuration number
01111111: 127; actuator outputs flag
00aabbbb: aa = [0..3]; MIDI mapping type (0 = note-off, 1 = note-on, 2 = key-pressure, 3 = control-change)
bbbb = [0..15]; MIDI channel
0ccccccc: ccccccc = [0..120]; base note number or control number
0000defg: d,e,f,g are response mode bits for actuator outputs 8 (d) .. 5 (g),
d,e,f,g = 0; trigger mode (normal output if PWM enabled)
d,e,f,g = 1; toggle mode (inverted output if PWM enabled)
0000hijk: h,i,j,k are response mode bits for actuator outputs 4 (h) .. 1 (k),
h,i,j,k = 0; trigger mode (normal output if PWM enabled)
h,i,j,k = 1; toggle mode (inverted output if PWM enabled)
0000mnpq: m,n,p,q are initialisation bits for actuator outputs 8 (m) .. 5 (q)
m,n,p,q = 0; actuator output is off after power-up or reset
m,n,p,q = 1; actuator output is on after power-up or reset
0000rstu: r,s,t,u are initialisation bits for actuator outputs 4 (r) .. 1(u)
r,s,t,u = 0; actuator output is off after power-up or reset
r,s,t,u = 1; actuator output is on after power-up or reset
0vvvvvvv: vvvvvvv = [0..127]; MIDI value threshold (maximum MIDI value if PWM enabled)

Initialisation bits apply to settings upon power-up, which can also be set with the SET OUTPUT INIT command, including the pulse width modulation interval and width range parameters that apply to all actuators.


Default settings for actuator outputs

Actuator output MIDI mapping type {aa}: 1; note-on
Actuator output MIDI sensor-actuator mapping {z}: 0; off
Actuator output MIDI channel mapping {bbbb}: 0
Actuator output MIDI base mapping {ccccccc}: 64
Actuator output response mode {d,e,f,g,h,i,j,k}: 0; trigger mode / normal output
Actuator output initialisation {m,n,p,q,r,s,t,u}: 1; on
Actuator output MIDI value threshold / max {vvvvvvv}: 1

Trigger mode means a note-off (header 80h), note-on (header 90h), key-pressure (header A0h) or control-change (header B0h) message with velocity or data field greater than or equal to the MIDI value threshold {vvvvvvv} turns actuator output on and a message with velocity or data field equal to zero turns actuator output off.

Toggle mode means a note-off (header 80h), note-on (header 90h), key-pressure (header A0h) or control-change (header B0h) message with velocity or data field greater than or equal to the MIDI value threshold {vvvvvvv} toggles actuator output on and off.

If the actuator output that the sensor input is mapped to is pulse-width modulation enabled, the sensor input value is clipped and scaled by the MIDI value threshold. Toggle mode inverts the scaling.

Base note is the note number or control number which triggers or toggles actuator output 1.

The MIDI running status feature is available in the MIDI input mapping when using stand-alone mode.

Sensor-actuator mapping uses the configuration of the sensor input and the configuration of the actuator output. Regardless whether sensor-actuator mapping is enabled, the actuator output will still respond to the MIDI input mapping as per its configuration and the sensor input will still output MIDI messages as per its configuration.