From 48402e277d25bdb7b2e367dca241423846dd4cf9 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 15 Sep 2025 08:15:33 +0200 Subject: [PATCH] midi: add option to disable outgoing note_on,vel=0 to note_off conversion --- .gitignore | 5 ++--- CHANGELOG.md | 3 +++ resources/docs/docs/midi/midi-configuration.md | 6 +++++- src/server/python/head.py | 4 +++- src/server/python/main.py | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 59fb7d0b..4a9197ae 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,8 @@ node_modules/ /app/ # python/midi build -*.pyc -src/server/python/build -src/server/python/__pycache__ +src/server/python/* +!src/server/python/*.py # docs build src/docs/widgets-reference.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ae16792..fb920ee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ - scripting - user scripts are longer protected against infinite loop and the main window object may be reached (it's not supported to break out of scripting context, but resources are no longer wasted to prevent it) +- midi + - add `no_auto_note_off` option + - breaking change - dropped support for iOS 10.3 diff --git a/resources/docs/docs/midi/midi-configuration.md b/resources/docs/docs/midi/midi-configuration.md index d7e7a8fc..feb3984a 100644 --- a/resources/docs/docs/midi/midi-configuration.md +++ b/resources/docs/docs/midi/midi-configuration.md @@ -94,7 +94,11 @@ Send program changes with a `-1` offset to match some software/hardware implemen **`note_off_velocity`** -Enable receiving noteOff messages with a velocity and on a different address than noteOn messages. +Use `/note_on` for noteOn messages and `/note_off` for noteOff messages instead of the defaut `/note` and velocity 0 for note off. + +**`auto_note_off`** + +Prevent converting outgoing noteOn messages with velocity 0 to noteOff messages. **`device_name:virtual`** (*Linux / Mac only*): creates a virtual midi device with one input port and one output port diff --git a/src/server/python/head.py b/src/server/python/head.py index 5a0b3a12..5f62ccf2 100644 --- a/src/server/python/head.py +++ b/src/server/python/head.py @@ -46,8 +46,10 @@ ignore_mtc = 'mtc' not in argv ignore_rpn = 'rpn' not in argv and 'nrpn' not in argv # option: parse active sensing ignore_active_sensing = 'active_sensing' not in argv -# option: note off velocity +# option: note off velocity (/note_on and /note_off instead of only /note and velocity 0 for note off) note_off_velocity = 'note_off_velocity' in argv +# option: no auto note off (do not translate received note_on with velocity 0 to note off) +no_auto_note_off = 'no_auto_note_off' in argv # option: list midi ports list_midi = 'list' in argv list_midi_exit = 'list-only' in argv diff --git a/src/server/python/main.py b/src/server/python/main.py index 0d77d809..76137c0a 100644 --- a/src/server/python/main.py +++ b/src/server/python/main.py @@ -260,7 +260,7 @@ def send_midi(name, event, *args): m = [mtype, args[0]] if mtype == NOTE_ON: - if args[2] == 0: + if args[2] == 0 and not no_auto_note_off: mtype = NOTE_OFF elif mtype == PITCH_BEND: