midi: remove variable args in sysex messages (can be handled many ways now); allow sending any system message; add support for receiving mtc (as sysex); add support for sending sysex bytes as integers
This commit is contained in:
parent
61531385f8
commit
c91afb6dab
6 changed files with 34 additions and 22 deletions
|
|
@ -6,6 +6,13 @@
|
|||
- editor: hide impossible actions from context-menu (eg adding widgets in tab containers)
|
||||
- panel: layout issue with tabs & lineWidth property
|
||||
|
||||
- midi
|
||||
- remove variable args in sysex messages (dynamic properties and scripting can be used to this effect)
|
||||
- add support for sending sysex bytes as integers
|
||||
- allow sending any system message (eg MIDI time code)
|
||||
- add support for receiving MIDI time code (as raw sysex)
|
||||
|
||||
|
||||
## 1.2.1
|
||||
|
||||
- scripting
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ Create a virtual MIDI device that will translate OSC messsages to MIDI messages
|
|||
|
||||
Enable parsing of system exclusive messages (disabled by default).
|
||||
|
||||
**`mtc`**
|
||||
|
||||
Enable parsing of midi time code messages (disabled by default). These will be received as raw sysex messages.
|
||||
|
||||
**`pc_offset`**
|
||||
|
||||
Send program changes with a `-1` offset to match some software/hardware implementations
|
||||
|
|
|
|||
|
|
@ -63,12 +63,15 @@ PitchWheel event.
|
|||
|
||||
----
|
||||
|
||||
#### `/sysex msg v1 .. vN`
|
||||
#### `/sysex msg`
|
||||
|
||||
System exclusive message.
|
||||
|
||||
- `msg`: hexadecimal sysex data string of the form `f0 ... f7`. You may include placeholders of the form `nn` which will be replaced by `v1, .., vN` respectively.
|
||||
- `v1, .., vN`: values encoded as hexadecimal data strings to include in `msg`. Most probably, you will need to sepcify a [custom module](/docs/custom-module/) in order to convert numeric widget values into the required hexadecimal format. In general, this conversion will be different for each manufacturer / device.
|
||||
- `msg`: hexadecimal sysex data string of the form `f0 ... f7`.
|
||||
|
||||
Other system messages may be sent (midi time code for example: `f1 <mtc value>`). Instead of a single hexadecimal string, arguments can be separated and defined either as hexadecimal bytes or as integers. When received, system messages are always formatted as a single hexadecimal string.
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
|
|
|||
|
|
@ -153,9 +153,10 @@ for name in inputs:
|
|||
|
||||
inputs[name].set_callback(create_callback(name))
|
||||
|
||||
# Activate sysex support
|
||||
if 'sysex' in argv:
|
||||
inputs[name].ignore_types(False, True, True)
|
||||
# sysex / mtc support
|
||||
ignore_sysex = 'sysex' not in argv
|
||||
ignore_mtc = 'mtc' not in argv
|
||||
inputs[name].ignore_types(ignore_sysex, ignore_mtc, True)
|
||||
|
||||
|
||||
def midi_message(status, channel, data1=None, data2=None):
|
||||
|
|
@ -189,22 +190,16 @@ def send_midi(name, event, *args):
|
|||
|
||||
if mtype == SYSTEM_EXCLUSIVE:
|
||||
|
||||
# unhexlify('f0 7e 7f 06 01 f7') creates a sysex message
|
||||
# from hex MIDI data string 'f0 7e 7f 06 01 f7'.
|
||||
# We expect all args to be hex strings! args[0] may contain placeholders of
|
||||
# the form 'nn' that are replaced using args[1..N] to create the final message.
|
||||
try:
|
||||
midiBytes = args[0].replace(' ', '')
|
||||
i = 1
|
||||
for m in sysexRegex.finditer(midiBytes):
|
||||
midiBytes = midiBytes[:m.start()] + args[i].replace(' ', '') + midiBytes[m.end():]
|
||||
i += 1
|
||||
|
||||
msg = unhexlify(midiBytes)
|
||||
|
||||
if (msg and msg.startswith(b'\xF0') and msg.endswith(b'\xF7') and
|
||||
all((val <= 0x7F for val in msg[1:-1]))):
|
||||
m = msg
|
||||
m = []
|
||||
for arg in args:
|
||||
if type(arg) is str:
|
||||
arg = arg.split(' ')
|
||||
arg = [int(x, 16) for x in arg]
|
||||
for x in arg:
|
||||
m.append(x)
|
||||
else:
|
||||
m.append(int(arg))
|
||||
|
||||
except:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ MIDI_TO_OSC = {
|
|||
POLY_PRESSURE: '/key_pressure'
|
||||
}
|
||||
|
||||
for i in range(SYSTEM_EXCLUSIVE + 1, 256):
|
||||
MIDI_TO_OSC[i] = '/sysex'
|
||||
|
||||
OSC_TO_MIDI = {
|
||||
'/note': NOTE_ON,
|
||||
'/control': CONTROL_CHANGE,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ module.exports = {
|
|||
},
|
||||
'm': {alias: 'midi', type: 'array', describe: 'midi router settings',
|
||||
check: (o)=>{
|
||||
var err = o.filter(item=>!item.match(/^(list|debug|jack|sysex|pc_offset|path=(.*)|[^:]+:(virtual|[^,]+,[^,]+))$/))
|
||||
var err = o.filter(item=>!item.match(/^(list|debug|jack|sysex|mtc|pc_offset|path=(.*)|[^:]+:(virtual|[^,]+,[^,]+))$/))
|
||||
return err.length ? `Invalid option${err.length > 1 ? 's' : ''}: ${err.join(', ')}` : true
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue