{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/aordano/control-board/master/schema/midiboard.schema.json", "title": "Midiboard Config", "description": "Configuration file for the midiboard MIDI control CLI tool", "type": "object", "properties": { "$schema": { "description": "Validation Schema for this file", "type": "string", "const": "https://raw.githubusercontent.com/aordano/control-board/master/schema/midiboard.schema.json", "default": "https://raw.githubusercontent.com/aordano/control-board/master/schema/midiboard.schema.json" }, "log_level": { "description": "Which levels of logs are printed.", "type": "string", "enum": ["Debug", "Info", "Warn", "Error", "Trace"] }, "config": { "description": "The actual configuration data. It's an array containing multiple possible devices and their controls.", "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "object", "properties": { "device": { "description": "The exact name of the MIDI device to listen, as the system reads it.", "type": "string" }, "controls": { "description": "Actual control entries to listen for. List a unique, memorable name per entry. Only lowercase, numbers and low dash allowed.", "type": "object", "patternProperties": { "^[a-z]{1}[a-z0-9_]+": { "type": "object", "description": "Entry for control. It can be of either Encoder, Trigger, or Switch type according to the action performed on the device.", "properties": { "key": { "description": "Key of the selected MIDI controller to listen for.", "type": "integer", "minimum": 0, "maximum": 128, "exclusiveMaximum": true }, "command": { "oneOf": [ { "type": "object", "description": "Commands to execute on increase or decrease of the encoder value.", "properties": { "kind": { "description": "Kind of action to perform. Encoder reads increments or decrements, sampling several inputs and executing the command if an increment or decrement is detected.", "type": "string", "const": "Encoder" }, "increase": { "description": "Command to be executed by Bash on detection of an increase in the encoder value.", "type": "object", "properties": { "cmd": { "description": "Base command to invoke.", "type": "string" }, "args": { "description": "Args provided to the command.", "type": "array", "items": { "type": "string" } } } }, "decrease": { "description": "Command to be executed by Bash on detection of an decrease in the encoder value.", "type": "object", "properties": { "cmd": { "description": "Base command to invoke.", "type": "string" }, "args": { "description": "Args provided to the command.", "type": "array", "items": { "type": "string" } } } } }, "additionalProperties": false, "required": [ "increase", "decrease", "kind" ] }, { "type": "object", "description": "Commands to execute on a press of the switch.", "properties": { "kind": { "description": "Kind of action to perform. Switch starts with the given state by default and reads an input, toggling the state and executing the corresponding command immediately.", "type": "string", "const": "Switch" }, "on": { "description": "Command to be executed by Bash after triggering an ON event.", "type": "object", "properties": { "cmd": { "description": "Base command to invoke.", "type": "string" }, "args": { "description": "Args provided to the command.", "type": "array", "items": { "type": "string" } } } }, "off": { "description": "Command to be executed by Bash after triggering an OFF event.", "type": "object", "properties": { "cmd": { "description": "Base command to invoke.", "type": "string" }, "args": { "description": "Args provided to the command.", "type": "array", "items": { "type": "string" } } } }, "initial_state": { "description": "Default state to be assumed at the start of the application.", "type": "string", "enum": ["ON", "OFF"] } }, "additionalProperties": false, "required": [ "on", "off", "initial_state", "kind" ] }, { "type": "object", "description": "Commands to execute on a press of the trigger.", "properties": { "kind": { "description": "Kind of action to perform. Trigger simply executes the corresponding command immediately.", "type": "string", "const": "Trigger" }, "execute": { "description": "Command to be executed by Bash after triggering the event.", "type": "object", "properties": { "cmd": { "description": "Base command to invoke.", "type": "string" }, "args": { "description": "Args provided to the command.", "type": "array", "items": { "type": "string" } } } } }, "additionalProperties": false, "required": ["execute", "kind"] } ] }, "threshold": { "oneOf": [ { "type": "object", "description": "Time thresholds for activation and detecion of encoder controls.", "properties": { "activation": { "description": "Activation threshold in milliseconds for a encoder control. This is the total time elapsed since the first detection of the associated key without triggering a new command. Encoder activation time should usually lie between 500ms and 2000ms.", "type": "integer", "minimum": 0, "maximum": 5000, "default": 750 }, "detection": { "description": "Detection threshold in milliseconds for a encoder control. This is the minimum time elapsed needed since the last detection of the key, to trigger a new detection. Encoder detection time should usually lie between 50 and 250 ms.", "type": "integer", "minimum": 0, "maximum": 500, "default": 300 } }, "additionalProperties": false, "required": [ "detection", "activation" ] }, { "type": "object", "description": "Time thresholds for activation and detecion of switch or trigger controls.", "properties": { "activation": { "description": "Activation threshold in milliseconds for a switch or trigger control. This is the total time elapsed since the first detection of the associated key without triggering a new command. Encoder activation time should usually lie between 500ms and 2000ms.", "type": "integer", "minimum": 0, "maximum": 5000, "default": 750 } }, "additionalProperties": false, "required": ["activation"] } ] } }, "required": ["command", "key"], "additionalProperties": false } } }, "thresholds": { "type": "object", "description": "Time thresholds for activation and detection of the controls.", "properties": { "encoder": { "type": "object", "description": "Time thresholds for activation and detecion of encoder controls.", "properties": { "activation": { "description": "Activation threshold in milliseconds for a encoder control. This is the total time elapsed since the first detection of the associated key without triggering a new command. Encoder activation time should usually lie between 500ms and 2000ms.", "type": "integer", "minimum": 0, "maximum": 5000, "default": 750 }, "detection": { "description": "Detection threshold in milliseconds for a encoder control. This is the minimum time elapsed needed since the last detection of the key, to trigger a new detection. Encoder detection time should usually lie between 50 and 250 ms.", "type": "integer", "minimum": 0, "maximum": 500, "default": 300 } }, "additionalProperties": false, "required": ["detection", "activation"] }, "switch": { "type": "object", "description": "Time thresholds for activation of switch controls.", "properties": { "activation": { "description": "Activation threshold in milliseconds for a switch control. This is the total time elapsed since the first detection of the key that will be considered for detections without triggering a new command. Switches should usually lie between 200ms and 1000ms.", "type": "integer", "minimum": 0, "maximum": 5000, "default": 300 } }, "additionalProperties": false, "required": ["activation"] }, "trigger": { "type": "object", "description": "Time thresholds for activation of trigger controls.", "properties": { "activation": { "description": "Activation threshold in milliseconds for a trigger control. This is the minimum time elapsed before triggering a new command. Triggers should usually lie between 1000ms and 10000ms.", "type": "integer", "minimum": 0, "maximum": 10000, "default": 1000 } }, "additionalProperties": false, "required": ["activation"] } }, "additionalProperties": false, "required": ["encoder", "switch", "trigger"] } }, "additionalProperties": false, "required": ["device", "controls", "thresholds"] } }, "required": ["config"] } }