Nord Grand with triple sensors - midi implementation

Everything about the Nord Piano, Nord Piano 2, Nord Piano 3, Nord Piano 4, Nord Piano 5, and the Nord Grand.
Post Reply
Valpurgis
Posts: 256
Joined: 17 Sep 2011, 18:24
12
Your Nord Gear #1: Nord Stage 4
Has thanked: 12 times
Been thanked: 60 times

Nord Grand with triple sensors - midi implementation

Post by Valpurgis »

I have a Nord Stage 3 Compact which I want to control from a Kawai MP11 with triple sensors action. Have discussed this on the Nord Stage thread but hope for some help from one of the users having a Nord Grand, eventually another Nord Piano with triple sensors implementation:

« Kawai does this within the excisting midi specification in an easy, logical way:
A single keystroke with no retriggering - Note ON with veocity at key down, Note Off at key release.
Keystroke with as an example two retriggers of the same key before final key release: Note On with initial velocity, Note On with velocity of first retriggering, Note On with velocity of second retriggering, finally Note Off, Note Off, Note Off after the final release of the key.

I monitored this from the MP11. When recording this midi sequence and playing it back to the MP11 it will play the three notes as three consecutive notes witout key release until release of the third note. Playing the same midi sequence towards the NS3C result in a single note with startnat the first Note On snd relase after the last release of the key.

I have discussed this with Nord, initially they thought the NS3C would handle this as the MP11 handle it but after testing of my midi file they confirmed my findings. But they did not promise any promptly implementation of this method for the NS3.

Does anybody have a chance to monitor how a Nord Grand with triple sensors handle this. Does is send retriggering, and does it recognize it for incoming midi stream?»
These users thanked the author Valpurgis for the post:
davisjj
Claude Viool
Posts: 8
Joined: 29 Nov 2013, 15:36
10
Your Nord Gear #1: Nord Stage 3
Your Nord Gear #2: Nord Lead 4
Has thanked: 1 time
Been thanked: 3 times

Re: Nord Grand with triple sensors - midi implementation

Post by Claude Viool »

Nord handles repeat notes differently than Kawai.
They expect a note-on / note-off message for every note, repeat note (i.e. triple sensor repeat) or not.
Without a note-off (i.e. full key release), a repeated note for the same key will not sound.

Kawai on the other hand simply (and imo correctly) sends note-on message repeatedly for every (triple-sensor) repeat note, i.e. it omits the note-off messages.
Upon release of the key it sends a single note-off message.

So yes, you can control a Nord device using a Kawai keyboard but effectively you'll not be using the 3rd sensor.
In short, you'll have to completely release the key, just like with a 2-sensor keybed.

However... 8-)
There is a work-around...

I've written a short piece of Python code that simply inserts a note-off for every repeated note that is received for a given key.
I.e. only if no note-off message was received between two note-on messages for the same key.
It has to temporarily store received notes to make that happen, unless you play one finger at a time :)

It works like a charm, much better than i expected.
Caveat 1: i assume the inserted note-off velocity is the same as the note-on velocity of the newly received (repeated) note.
Caveat 2: the inserted note-off message adds an extra latency of about 0.1 msec. Without the inserted note, the latency of the Python code is also about 0.1 msec (if you can even accurately measure that). So in total maximum 0.2 msec (0.0002 sec) added. Mind you, that is with MIDI over USB. With old school serial MIDI it's probably a bit slower.

I've added a -v option so you can see what messages are passing, and also how long the added latency was.
I've also added a -c option to adjust the velocity curve a bit, although the default (1.0) is to leave it untouched. The higher the value, the more it is dampened. I use -c 2.2 so i can use the default (lineair) velocity setting of the VPC1. It's personal, adjust to taste.

Like i said, it works wonderful. I'm using a Kawai VPC1 to control a Nord Stage 3 Compact (waterfall, drawbar type).
But it's not production-quality code:
  • No installer
  • I've hard-coded the MIDI device strings for my Stage 3C and my VPC1 keyboard.
  • It requires installation of the Python Mido library
  • And it requires Python (Python 3 of course).
So, until Clavia comes with a firmware patch (if ever), you can still use a Kawai triple sensor keybed to control a Nord.
You'll need a computer and two USB cables. Although i'm sure a Raspberry PI 3 would do just fine.

(scroll window for the entire contents)

Code: Select all

#!/usr/bin/python

import mido
import time
import argparse
from math import pow, floor
import signal
import sys

def signal_handler(sig, frame):
	#~ print('Interrupt')
	sys.exit(0)

def NordVelocity(velocity):
	velocity = floor(128 * pow(velocity / 128, args.curve))
	return max(3, velocity)


signal.signal(signal.SIGINT, signal_handler)

parser = argparse.ArgumentParser(description='Kawai to Nord MIDI note processing')
parser.add_argument('-c', '--curve',   type=float, default=1.0, help='velocity curve (default: %(default)s)')
parser.add_argument('-v', '--verbose', action='count',          help='increase verbosity')
args = parser.parse_args()


inputName = None
for inputName in mido.get_input_names():
	if 'USB-MIDI' in inputName:
		print("Input:  {}".format(inputName))
		break

outputName = None
for outputName in mido.get_output_names():
	if 'Nord Stage' in outputName:
		print("Output: {}".format(outputName))
		break

output = mido.open_output(outputName)

NOTES = {'note_on', 'note_off'}
keys_pressed = set()

with mido.open_input(inputName) as input:
	for msg in input:
		t0 = time.perf_counter()
		if msg.type in NOTES:
			if msg.note in keys_pressed:
				if msg.type == 'note_on':
					insert = mido.Message('note_off', note=msg.note, velocity=msg.velocity)
					output.send(insert)
					msg.velocity = NordVelocity(msg.velocity)
					print("repeat: ", msg)
					if args.verbose:
						print("%.6f" % (time.perf_counter() - t0))
					output.send(msg)
				else:
					if args.verbose:
						print("release: ", msg)
					keys_pressed.discard(msg.note)
					output.send(msg)
			else:
				if msg.type == 'note_on':
					keys_pressed.add(msg.note)
					msg.velocity = NordVelocity(msg.velocity)
					if args.verbose:
						print("key: ", msg)
						print("%.6f" % (time.perf_counter() - t0))
					output.send(msg)
				else:
					if args.verbose:
						print("release: ", msg)
					keys_pressed.discard(msg.note)
					output.send(msg)
		else:
			if args.verbose:
				print("other: ", msg)
			output.send(msg)
I've called my script k2n.py (Kawai to Nord of course :) )
Option -h is for help:

Code: Select all

# python k2n.py -h
usage: k2n.py [-h] [-c CURVE] [-v]

Kawai to Nord MIDI note processing

optional arguments:
  -h, --help            show this help message and exit
  -c CURVE, --curve CURVE
                        velocity curve (default: 1.0)
  -v, --verbose         increase verbosity
And running it looks like this:

Code: Select all

python k2n.py -v
Input:  USB-MIDI:USB-MIDI MIDI 1 24:0
Output: Nord Stage 3:Nord Stage 3 MIDI 1 28:0
key:  note_on channel=0 note=59 velocity=33 time=0
0.000041
release:  note_off channel=0 note=59 velocity=63 time=0
key:  note_on channel=0 note=59 velocity=86 time=0
0.000131
release:  note_off channel=0 note=59 velocity=99 time=0
key:  note_on channel=0 note=59 velocity=75 time=0
0.000080
repeat:  note_on channel=0 note=59 velocity=79 time=0
0.000282
repeat:  note_on channel=0 note=59 velocity=55 time=0
0.000234
release:  note_off channel=0 note=59 velocity=89 time=0
release:  note_off channel=0 note=59 velocity=89 time=0
release:  note_off channel=0 note=59 velocity=89 time=0
key:  note_on channel=0 note=53 velocity=81 time=0
0.000096
release:  note_off channel=0 note=53 velocity=83 time=0
Without the -v it only displays the 3rd sensor repeat notes.

The code comes without warranty (or support) but you may reproduce, monetize of whatever makes you happy. :D
Last edited by Claude Viool on 20 Jan 2020, 23:42, edited 8 times in total.
These users thanked the author Claude Viool for the post (total 2):
Mr_-G-, dmamfmgm
Valpurgis
Posts: 256
Joined: 17 Sep 2011, 18:24
12
Your Nord Gear #1: Nord Stage 4
Has thanked: 12 times
Been thanked: 60 times

Re: Nord Grand with triple sensors - midi implementation

Post by Valpurgis »

Very nice, impressed to see that you have put so much effort to find and implement a workaround!

But there is a restriction to your solution as I see it. When retriggering the Kawai from the middle sensor the strings are not damped/muted. The initial tone is sustaining through the retriggering. With your solution the inserted note off will mute the tone before a new triggering resulting in a more staccato repetition of the same key. Actually your fix translates the triple sensors action to a normal dual sensors keyboard. Agree?
Claude Viool
Posts: 8
Joined: 29 Nov 2013, 15:36
10
Your Nord Gear #1: Nord Stage 3
Your Nord Gear #2: Nord Lead 4
Has thanked: 1 time
Been thanked: 3 times

Re: Nord Grand with triple sensors - midi implementation

Post by Claude Viool »

The solution of expecting a note-off message in-between two repeated notes is Nord's implementation of triple sensor handling.
I've had my hands on a Nord Grand for about a week and it also produced the note-off MIDI messages in-between repeat notes from the 3rd sensor (i.e. stopping the key from going up al the way).

However, they must have some sort of way to detect this because it sounds just like repeated notes, not like staccato notes.
Maybe they just retrigger the sample if the note-off / note-on messages follow up within a very short interval.
No idea, but in the end, it just works as you'd expect.

To demonstrate this, I attached a small recording i made just now using the k2n script. I triggered Kawai VPC1's 3rd sensor by stopping a key from going up all the way, using my left hand. Then i pressed the key repeatedly using my right hand, triggering the piano sound of the Stage 3C. Then i moved my left hand up a few milimeters, just above the trigger point of the 3rd sensor. You can clearly hear when that happens, the notes become staccato. But not when the 3rd sensor is triggering, it sounds perfectly legato (is that the term?).
I used a higher and a lower key to demonstrate this. No pedal of course.

So, you can rest assured, it works just fine :)
Attachments
Kawai2Nord.mp3
Example recording using k2n script
(1.19 MiB) Downloaded 192 times
Last edited by Claude Viool on 21 Jan 2020, 22:00, edited 3 times in total.
Valpurgis
Posts: 256
Joined: 17 Sep 2011, 18:24
12
Your Nord Gear #1: Nord Stage 4
Has thanked: 12 times
Been thanked: 60 times

Re: Nord Grand with triple sensors - midi implementation

Post by Valpurgis »

Very interesting, it obviously works very well! Even if I don’t really understand why the note off’s that your script insert interrupts the note between retriggering the next. However hope that Nord will have a look on how to interact with a triple sensor directly without the need for an external «translator» between the controller and the NS3. In the meantime you could maybe make a business out of making a complete translator box :-)
Jackrabbit710
Posts: 4
Joined: 06 Feb 2020, 16:30
4
Your Nord Gear #1: Nord Stage 3

Re: Nord Grand with triple sensors - midi implementation

Post by Jackrabbit710 »

Have Nord said that they will enable triple sensor from external keyboards? Seems daft not to.
Marco88
Posts: 5
Joined: 27 Dec 2021, 20:40
2
Your Nord Gear #1: Nord Stage 3
Been thanked: 3 times

Re: Nord Grand with triple sensors - midi implementation

Post by Marco88 »

Hi,
Thanks for posting all this. Really helped me out in my decision making on the investment on a Nord Grand, knowing the issue is the other way around when Nord Grand is the sender.
Adding my small contribution for completeness although the topic is quite old.
I've had my hands on a Nord Grand for about a week and it also produced the note-off MIDI messages in-between repeat notes from the 3rd sensor (i.e. stopping the key from going up al the way).
I had a Nord Grand over Christmas with firmware 1.6.0 containing the latest midi velocity update.
Such a shame… the triple sensor seems NOT implemented in the MIDI set.
The internal sound is produced when triggering half keystrokes. MIDI out however does NOT generate note off nor note on messages until lifting the key fully up.
As a result software plugins are missing notes, already when playing modest tempo triplets.
Very disappointing for a 3k plus ‘flagship’ and a showstopper for me.
I have contacted Nord support to hear about their roadmap.
Last edited by Marco88 on 27 Dec 2021, 20:56, edited 2 times in total.
These users thanked the author Marco88 for the post:
FZiegler
User avatar
Mr_-G-
Moderator
Posts: 4635
Joined: 18 Aug 2012, 16:48
11
Your Nord Gear #1: Nord Stage 2
Has thanked: 1423 times
Been thanked: 1231 times

Re: Nord Grand with triple sensors - midi implementation

Post by Mr_-G- »

@Marco88: Welcome to the forum and thanks for confirming the unexpected implementation of the triple sensor. Please do not open a new thread on the same subject in the same forum. It makes gathering the information on a single topic more difficult. Let's stick to this thread for any updates and I will close the duplicated thread. Hope you enjoy the forum.
Marco88
Posts: 5
Joined: 27 Dec 2021, 20:40
2
Your Nord Gear #1: Nord Stage 3
Been thanked: 3 times

Re: Nord Grand with triple sensors - midi implementation

Post by Marco88 »

I had a reply from Nord customer support, stating the following:

Your MIDI analysis is correct, and part of the reason for the MIDI engine being the same as one the none-triple switch instruments is the fact that there is also the Sample Synth section on the Nord Grand - which does not use the extended “piano” features of the triple switch keybed. For the Synth the “half way” and “bottom” strokes do not generate note on’s, and they would in this case get additional, unexpected, notes when playing.
We make note of your feedback here for consideration. It could be that a setting concerning this area, in the MIDI menu, would be a good solution - although we can’t say for sure what a future OS may bring.
These users thanked the author Marco88 for the post (total 2):
Mr_-G-, FZiegler
Post Reply