2022 our 25th year online!

Welcome to the Piano World Piano Forums
Over 3 million posts about pianos, digital pianos, and all types of keyboard instruments.
Over 100,000 members from around the world.
Join the World's Largest Community of Piano Lovers (it's free)
It's Fun to Play the Piano ... Please Pass It On!

SEARCH
Piano Forums & Piano World
(ad)
Who's Online Now
63 members (anotherscott, AndyOnThePiano2, danno858, benkeys, brennbaer, DaCapoDiTuttiCapi, APianistHasNoName, AlkansBookcase, Charles Cohen, 11 invisible), 1,854 guests, and 328 robots.
Key: Admin, Global Mod, Mod
Previous Thread
Next Thread
Print Thread
Hop To
Page 1 of 3 1 2 3
#2799605 01/08/19 04:58 AM
Joined: Mar 2018
Posts: 83
A
Audetto Offline OP
Full Member
OP Offline
Full Member
A
Joined: Mar 2018
Posts: 83
Hi

Piano is a CA78, Local Control OFF.

I am sending these Midi messages on a fixed channel and for a fixed note.

Time, Message

1, ON
2, ON
3, OFF
4, OFF

What is the expected behaviour?
Will the note go silent at time 3 or 4?

Background:

Piano -> App -> Piano

ON Messages are passed through unchanged
OFF Messages are delayed by 1 sec (so to achieve a dynamic legato/overlapping/pedal).

Works well until I play the same note multiple times.
It feels like the first OFF kills the note regardless how many ON I have sent.

I have only read that there should be as many OFF as ON, but I could not find any clear spec online.

Does anybody know how it is supposed to work.

Thank you


Kawai CA78
(previously Kawai KDP90)
Joined: Aug 2016
Posts: 9,792
G
9000 Post Club Member
Offline
9000 Post Club Member
G
Joined: Aug 2016
Posts: 9,792
Originally Posted by Audetto


Works well until I play the same note multiple times.
It feels like the first OFF kills the note regardless how many ON I have sent.

I have only read that there should be as many OFF as ON, but I could not find any clear spec online.

Does anybody know how it is supposed to work.

Thank you


I think yes, a note on most be accompanied by a note off, so that sounds normal. What are the velocities of the note ons you are sending? If the later one are low, the initial one would more or less kill the sound when terminated.


Bosendorfer D214VC ENPro
Past: Yamaha P-85, P-105, CP50, Kawai MP11, Kawai NV10
Joined: Feb 2010
Posts: 6,730
A
6000 Post Club Member
Online Content
6000 Post Club Member
A
Joined: Feb 2010
Posts: 6,730
Originally Posted by Audetto
I am sending these Midi messages on a fixed channel and for a fixed note.

Time, Message

1, ON
2, ON
3, OFF
4, OFF

What is the expected behaviour?
Will the note go silent at time 3 or 4?

Time 3. Assuming two things are true: (1) You're playing a sound that does not have a long Release built into it (notes don't go silent until the end of the Release portion of the envelope), and (2) you're not depressing a sustain pedal.

Originally Posted by Audetto
I have only read that there should be as many OFF as ON

That is false.

An ON command for middle C initiates the middle C sound. You can continue to initiate it multiple times, without sending any OFF command (that's essentially the virtue of a triple sensor). The OFF command for middle C will terminate it, regardless of how many times you had sent the ON command. And if it didn't, you'd have stuck notes for those repetitions, because once you lift a key, you can't lift it again!

Joined: Aug 2016
Posts: 9,792
G
9000 Post Club Member
Offline
9000 Post Club Member
G
Joined: Aug 2016
Posts: 9,792
Originally Posted by anotherscott
The OFF command for middle C will terminate it, regardless of how many times you had sent the ON command.


Whole that answers when a note should be terminated, it doesn't mean there shouldn't be an OFF corresponding to each ON, right?


Bosendorfer D214VC ENPro
Past: Yamaha P-85, P-105, CP50, Kawai MP11, Kawai NV10
Joined: Mar 2018
Posts: 83
A
Audetto Offline OP
Full Member
OP Offline
Full Member
A
Joined: Mar 2018
Posts: 83
This is a valid explanation.

Both things are true though, as I have found on the MIDI spec

Page 94 here https://www.midi.org/specifications-old/category/midi-1-0-detailed-specifications

If an instrument receives two or more Note On messages with the same key number and MIDI channel,
it must make a determination of how to handle the additional Note Ons. It is up to the receiver as to
whether the same voice or another voice will be sounded, or if the messages will be ignored. The
transmitter, however, must send a corresponding Note Off message for every Note On sent. If the
transmitter were to send only one Note Off message, and if the receiver in fact assigned the two Note
On messages to different voices, then one note would linger. Since there is no harm or negative side
effect in sending redundant Note Off messages this is the recommended practice.

The CA78 seems to have decided to
1) play the note again
2) stop at the first OFF
3) ignore other OFF
which seems to be a valid implementation.

I guess it requires more work on my side then.

Last edited by Audetto; 01/08/19 10:53 AM.

Kawai CA78
(previously Kawai KDP90)
Joined: Oct 2015
Posts: 2,558
2000 Post Club Member
Offline
2000 Post Club Member
Joined: Oct 2015
Posts: 2,558
Originally Posted by Audetto
The CA78 seems to have decided to
1) play the note again
2) stop at the first OFF
3) ignore other OFF
which seems to be a valid implementation.

It's especially valid in the context of a 3-sensor DP like the CA78, where you can indeed generate multiple note on messages without first generating note off messages (by lifting the key above the second sensor, then striking it down again to the third sensor, multiple times, but never lifting up to the first sensor), but where it is impossible to generate the matching multiple note off events at different times.

Meaning: If you generate multiple note ons in this fashion (lifting above sensor 2, then striking again, never lifting above sensor 1), and if you then finally "lower the damper" of that key by fully lifting the key, then the piano will simply generate all note off events at the same time, at the moment the key goes above sensor one (well, I'm assuming that the CA78 generates these note offs with the same time stamp, technically they are of course still one after the other, in the serial MIDI protocol).

So while a sequence like "note on -> note on -> note off -> note off" can be generated using the instrument's keyboard, there will never be an actual time delay between the two note offs. So there wouldn't be any reason for the piano to wait for the last note off to stop playing the note (for which it would have to maintain some sort of counter, or stack, or whatever).


Kawai Novus NV10
My amateur piano recordings on YouTube
Latest Recording: Always With Me (from Studio Ghibli: Spirited Away)
Joined: Oct 2017
Posts: 1,181
A
arc Offline
1000 Post Club Member
Offline
1000 Post Club Member
A
Joined: Oct 2017
Posts: 1,181
A note OFF event releases (stops) the corresponding note ON. Multiple ON events (for the same note and on the same channel) will be released by a single OFF event. Instead of using OFF, some MIDI implementations use the ON event with velocity of zero, which has the same meaning.

From the spec (https://www.midi.org/)
Quote

Note Off

Category: Voice
Purpose

Indicates that a particular note should be released. Essentially, this means that the note stops sounding, but some patches might have a long VCA release time that needs to slowly fade the sound out. Additionally, the device's Hold Pedal controller may be on, in which case the note's release is postponed until the Hold Pedal is released. In any event, this message either causes the VCA to move into the release stage, or if the Hold Pedal is on, indicates that the note should be released (by the device automatically) when the Hold Pedal is turned off. If the device is a MultiTimbral unit, then each one of its Parts may respond to Note Offs on its own channel. The Part that responds to a particular Note Off message is the one assigned to the message's MIDI channel.

Data

Two data bytes follow the Status.

The first data is the note number. There are 128 possible notes on a MIDI device, numbered 0 to 127 (where Middle C is note number 60). This indicates which note should be released.

The second data byte is the velocity, a value from 0 to 127. This indicates how quickly the note should be released (where 127 is the fastest). It's up to a MIDI device how it uses velocity information. Often velocity will be used to tailor the VCA release time. MIDI devices that can generate Note Off messages, but don't implement velocity features, will transmit Note Off messages with a preset velocity of 64.

Joined: Mar 2018
Posts: 83
A
Audetto Offline OP
Full Member
OP Offline
Full Member
A
Joined: Mar 2018
Posts: 83
Ok, ok: I was imaging some reference count but it is clearly not the case.

I think the algorithm I want, could work like that.
Imagine I want to set the duration of every note to 5 seconds no matter what the pianist does.

This thing complicates a lot my app as before I was relying on the ability of android to sort Midi commands out if order: I was just changing the Note Off time to T+5 seconds.

With this behaviour I must deliver the events (OFF) at the right time (so not in the future) as they might be cancelled by other Note ON that arrive meanwhile.

So imagine ON received at times 1, 3

Originally I was posting OFF at time 6, 8 (in the future, as I was doing it when the ON arrives),
but not when I receive ON at 3, I must cancel the future OFF at 6 and only deliver OFF at 8.
Or maybe 2 OFFs at 8 to keep the count ok.

Some threading and sleeping seems required now.


Kawai CA78
(previously Kawai KDP90)
Joined: Aug 2016
Posts: 9,792
G
9000 Post Club Member
Offline
9000 Post Club Member
G
Joined: Aug 2016
Posts: 9,792
Originally Posted by Audetto

This thing complicates a lot my app as before I was relying on the ability of android to sort Midi commands out if order: I was just changing the Note Off time to T+5 seconds.


Can you rely on the fact that Note-Offs in these cases typically come simultaneously? You can have subsequent Note-On events at any x time, but all the Note-Offs for that the same keypress should come together (when the physical key is released, however many Note-Offs have been queued will all trigger together). That may make things easier and save you the need to count events.


Bosendorfer D214VC ENPro
Past: Yamaha P-85, P-105, CP50, Kawai MP11, Kawai NV10
Joined: Sep 2009
Posts: 14,439
Yikes! 10000 Post Club Member
Offline
Yikes! 10000 Post Club Member
Joined: Sep 2009
Posts: 14,439
I think you have your answer now ...
Originally Posted by Audetto
With this behaviour I must deliver the events (OFF) at the right time (so not in the future) as they might be cancelled by other Note ON that arrive meanwhile.

So imagine ON received at times 1, 3

Originally I was posting OFF at time 6, 8 (in the future, as I was doing it when the ON arrives),
but not when I receive ON at 3, I must cancel the future OFF at 6 and only deliver OFF at 8.

Joined: Feb 2010
Posts: 6,730
A
6000 Post Club Member
Online Content
6000 Post Club Member
A
Joined: Feb 2010
Posts: 6,730
Originally Posted by Gombessa
Originally Posted by anotherscott
The OFF command for middle C will terminate it, regardless of how many times you had sent the ON command.

While that answers when a note should be terminated, it doesn't mean there shouldn't be an OFF corresponding to each ON, right?

OFF is simply sent when a certain sensor is triggered, no one-to-one correspondence is required, So for example, on a 3-sensor board, you can send Note ON, then lift just slightly (not enough to trigger a Note OFF) and restrike to send a second Note ON, and continue to do that as many times as you want, then release the key and send a single Note OFF which will silence the note, no matter how many times you struck it. It does not send an additional Note OFF for every time you restruck the key. The Note OFF is a simple command instigated by a single event: "the key has been released above this point." There is no mechanism to "keep count" of how many Note ONs there were, nor is there any need for such a mechanism.

Originally Posted by JoBert
the piano will simply generate all note off events at the same time, at the moment the key goes above sensor one (well, I'm assuming that the CA78 generates these note offs with the same time stamp

Only a single Note Off is generated when that sensor is triggered. MIDI time stamping is relevant for sequencers, but not live performance. The notes you play in real time on the CA76 are not time stamped.

Originally Posted by Audetto
Or maybe 2 OFFs at 8 to keep the count ok.

I'm not sure exactly what you're after, but there is no need to "keep the count ok" as far as MIDI is concerned. As arc7urus said, "Multiple ON events (for the same note and on the same channel) will be released by a single OFF event." There is no requirement for each ON to have an OFF, and MIDI does not inherently "keep count" of anything.

Joined: Oct 2013
Posts: 3,868
3000 Post Club Member
Offline
3000 Post Club Member
Joined: Oct 2013
Posts: 3,868
@abotherscott : there is a need to count NOTE ON. If you read the specs :

The transmitter, however, must send a corresponding Note Off message for every Note On sent.


Then if we have 3 Note On, we will need 3 Note Off to be compliant. However, some sound generator can switch all note off while receiving the first Note Off and the 2 others are not needed, but the emitter can’t know if the receiver would need them.


http://www.sinerj.org/
http://humeur-synthe.sinerj.org/
Yamaha N1X, Bechstein Digital Grand, Garritan CFX, Ivory II pianos, Galaxy pianos, EWQL Pianos, Native-Instrument The Definitive Piano Collection, Soniccouture Hammersmith, Truekeys, Pianoteq
Joined: Sep 2009
Posts: 14,439
Yikes! 10000 Post Club Member
Offline
Yikes! 10000 Post Club Member
Joined: Sep 2009
Posts: 14,439
If this is true, then It seems that a properly functioning piano MUST violate the spec.
Originally Posted by Frédéric L
If you read the specs:
The transmitter, however, must send a corresponding Note Off message for every Note On sent.
You really have to have a piano allow for a note-on, followed by another, and another ... and eventually just one note-off. How else could MIDI handle repetitions?

Joined: Oct 2013
Posts: 3,868
3000 Post Club Member
Offline
3000 Post Club Member
Joined: Oct 2013
Posts: 3,868
@MacMacMac : MIDI over USB was invented to permit sending numerous Note Off at an high rate. wink

More seriously, it could be interesting to measure the higher limit, but if it is a 16 bits counter, you would have an hard time doing it.


http://www.sinerj.org/
http://humeur-synthe.sinerj.org/
Yamaha N1X, Bechstein Digital Grand, Garritan CFX, Ivory II pianos, Galaxy pianos, EWQL Pianos, Native-Instrument The Definitive Piano Collection, Soniccouture Hammersmith, Truekeys, Pianoteq
Joined: Feb 2010
Posts: 6,730
A
6000 Post Club Member
Online Content
6000 Post Club Member
A
Joined: Feb 2010
Posts: 6,730
Again talking in terms of a 3-sensor piano...

In theory, a device *could* keep track of how many times it sent consecutive human-generated Note On events to the tone generator, and then artificially generate a like number of nearly-simultaneous Note Off events when the human sends his one Note Off event (i.e. when he releases the key high enough to trigger that sensor). But MIDI has no such functionality built into it. At least nothing I'm aware of.

If you put a MIDI monitor app on the MIDI out of a 3-sensor piano (or record it into a sequencer), and generate 20 Note-On events from a single key without ever releasing the key high enough to send a Note Off, and then release the key, if you look at the MIDI stream, I'm quite sure you'd see 20 Note On events and a single Note Off event (not 20 Note Off events in rapid succession upon key release). If anyone tries this and sees otherwise, I'd be curious to know about it.

Joined: Sep 2009
Posts: 14,439
Yikes! 10000 Post Club Member
Offline
Yikes! 10000 Post Club Member
Joined: Sep 2009
Posts: 14,439
Speed isn't what counts. You don't want ANY note-offs upon repetition. You want note-on, note-on, note-on ... and eventually note-off. Speedy note-offs are not the point at all.[quote=Frédéric L]@MacMacMac : MIDI over USB was invented to permit sending numerous Note Off at an high rate.

Joined: Feb 2010
Posts: 6,730
A
6000 Post Club Member
Online Content
6000 Post Club Member
A
Joined: Feb 2010
Posts: 6,730
Originally Posted by MacMacMac
Speed isn't what counts. You don't want ANY note-offs upon repetition. You want note-on, note-on, note-on ... and eventually note-off. Speedy note-offs are not the point at all.

Multiple Note-Offs in extremely rapid succession wouldn't hurt anything... it's just that there's no need to do it,

Joined: Sep 2009
Posts: 14,439
Yikes! 10000 Post Club Member
Offline
Yikes! 10000 Post Club Member
Joined: Sep 2009
Posts: 14,439
If you're repeating a note you DO NOT want the note-off. You want the first note-on to continue to ring, followed by another note-on, and another.
You don't want the note-off until you release that key.
And then ... only ONE note-off is needed. I can't see why any piano would generate more than one.

Joined: Aug 2016
Posts: 9,792
G
9000 Post Club Member
Offline
9000 Post Club Member
G
Joined: Aug 2016
Posts: 9,792
Originally Posted by MacMacMac

And then ... only ONE note-off is needed. I can't see why any piano would generate more than one.


My guess is that the MIDI spec for Note-On and Note-Off is not limited to pianos? Also, because digital pianos typically include dozens/hundreds of additional non-piano voices/functions, and furthermore serve as MIDI controllers for other instruments, it makes sense to follow the MIDI spec even if it's not strictly necessary in a single specific use case. The standard would probably suffer significantly if every instrument decided to ignore the standard and implement the spec in a way that only behooves itself.

Anyways, I figure most DPs behave this way in order to adhere to the spec, not because they believe it absolutely necessary for the proper functioning of the piano tone.


Bosendorfer D214VC ENPro
Past: Yamaha P-85, P-105, CP50, Kawai MP11, Kawai NV10
Joined: Feb 2010
Posts: 6,730
A
6000 Post Club Member
Online Content
6000 Post Club Member
A
Joined: Feb 2010
Posts: 6,730
Originally Posted by MacMacMac
If you're repeating a note you DO NOT want the note-off. You want the first note-on to continue to ring, followed by another note-on, and another.
You don't want the note-off until you release that key. And then ... only ONE note-off is needed.


If you repeat a note, you may or may not want a note off in between, those are equally valid musical decisions (and can be determined by how high you lift your finger). BUT, assuming you want to take advantage of the 3-sensor feature as we've been talking about which allows you to repeat a note without lifting the key so high as to send a Note Off (which would silence the note, unless your sustain pedal is down), then I agree, "you don't want the note-off until you release that key" -- however, sending additional Note Off commands at that point. won't hurt anything, either.

Page 1 of 3 1 2 3

Link Copied to Clipboard
What's Hot!!
Piano World Has Been Sold!
--------------------
Forums RULES, Terms of Service & HELP
(updated 06/06/2022)
---------------------
Posting Pictures on the Forums
(ad)
(ad)
New Topics - Multiple Forums
Estonia 1990
by Iberia - 04/16/24 11:01 AM
Very Cheap Piano?
by Tweedpipe - 04/16/24 10:13 AM
Practical Meaning of SMP
by rneedle - 04/16/24 09:57 AM
Country style lessons
by Stephen_James - 04/16/24 06:04 AM
How Much to Sell For?
by TexasMom1 - 04/15/24 10:23 PM
Forum Statistics
Forums43
Topics223,390
Posts3,349,223
Members111,632
Most Online15,252
Mar 21st, 2010

Our Piano Related Classified Ads
| Dealers | Tuners | Lessons | Movers | Restorations |

Advertise on Piano World
| Piano World | PianoSupplies.com | Advertise on Piano World |
| |Contact | Privacy | Legal | About Us | Site Map


Copyright © VerticalScope Inc. All Rights Reserved.
No part of this site may be reproduced without prior written permission
Powered by UBB.threads™ PHP Forum Software 7.7.5
When you purchase through links on our site, we may earn an affiliate commission, which supports our community.