Welcome to the Piano World Piano Forums
Over 2.7 million posts about pianos, digital pianos, and all types of keyboard instruments
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)
Best of Piano Buyer
 Best of Piano Buyer
(ad)
Piano Life Saver - Dampp Chaser
Dampp Chaser Piano Life Saver
Find a Professional
Our Classified Ads
Find Piano Professionals-

*Piano Dealers - Piano Stores
*Piano Tuners
*Piano Teachers
*Piano Movers
*Piano Restorations
*Piano Manufacturers

Advertise on Piano World

(ad)
Accu-Tuner
Sanderson Accu-Tuner
Who's Online Now
108 registered members (Akaitsuki, Beowulf, AnthonyPaulO, Beardog, AAC127, ando, AZNpiano, 31 invisible), 1,046 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
(ad)
Estonia Pianos
Estonia Pianos
Quick Links to Useful Piano & Music Resources
Quick Links:
*Advertise On Piano World
*Free Piano Newsletter
*Online Piano Recitals
*Piano Recitals Index
*Piano & Music Accessories
*Live Piano Venues
*Music School Listings
* Buying a Piano
*Buying A Acoustic Piano
*Buying a Digital Piano
*Pianos for Sale
*Sell Your Piano
*How Old is My Piano?
*Directory/Site Map
*Virtual Piano
*Music Word Search
*Piano Videos
*Virtual Piano Chords & Scales
Previous Thread
Next Thread
Print Thread
Page 1 of 3 1 2 3
Multiple MIDI On question #2799605
01/08/19 04:58 AM
01/08/19 04:58 AM
Joined: Mar 2018
Posts: 47
A
Audetto Offline OP
Full Member
Audetto  Offline OP
Full Member
A

Joined: Mar 2018
Posts: 47
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)
(ad) ROLAND

Click Here

Re: Multiple MIDI On question [Re: Audetto] #2799665
01/08/19 09:25 AM
01/08/19 09:25 AM
Joined: Aug 2016
Posts: 2,729
G
Gombessa Offline
2000 Post Club Member
Gombessa  Offline
2000 Post Club Member
G

Joined: Aug 2016
Posts: 2,729
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.


Yamaha P-85, P-105, CP50, Kawai MP11 || Kawai NV-10
Re: Multiple MIDI On question [Re: Audetto] #2799696
01/08/19 10:37 AM
01/08/19 10:37 AM
Joined: Feb 2010
Posts: 4,887
A
anotherscott Online content
4000 Post Club Member
anotherscott  Online Content
4000 Post Club Member
A

Joined: Feb 2010
Posts: 4,887
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!

Re: Multiple MIDI On question [Re: anotherscott] #2799700
01/08/19 10:49 AM
01/08/19 10:49 AM
Joined: Aug 2016
Posts: 2,729
G
Gombessa Offline
2000 Post Club Member
Gombessa  Offline
2000 Post Club Member
G

Joined: Aug 2016
Posts: 2,729
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?


Yamaha P-85, P-105, CP50, Kawai MP11 || Kawai NV-10
(ad)
Piano & Music Accessories
piano accessories music gifts tuning and moving equipment
Re: Multiple MIDI On question [Re: anotherscott] #2799703
01/08/19 10:52 AM
01/08/19 10:52 AM
Joined: Mar 2018
Posts: 47
A
Audetto Offline OP
Full Member
Audetto  Offline OP
Full Member
A

Joined: Mar 2018
Posts: 47
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)
Re: Multiple MIDI On question [Re: Audetto] #2799711
01/08/19 11:16 AM
01/08/19 11:16 AM
Joined: Oct 2015
Posts: 2,008
Germany
JoBert Offline
2000 Post Club Member
JoBert  Offline
2000 Post Club Member

Joined: Oct 2015
Posts: 2,008
Germany
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).

Re: Multiple MIDI On question [Re: Audetto] #2799718
01/08/19 11:46 AM
01/08/19 11:46 AM
Joined: Oct 2017
Posts: 973
Europe
A
arc7urus Offline
500 Post Club Member
arc7urus  Offline
500 Post Club Member
A

Joined: Oct 2017
Posts: 973
Europe
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.

Re: Multiple MIDI On question [Re: arc7urus] #2799771
01/08/19 02:39 PM
01/08/19 02:39 PM
Joined: Mar 2018
Posts: 47
A
Audetto Offline OP
Full Member
Audetto  Offline OP
Full Member
A

Joined: Mar 2018
Posts: 47
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)
Re: Multiple MIDI On question [Re: Audetto] #2799803
01/08/19 04:57 PM
01/08/19 04:57 PM
Joined: Aug 2016
Posts: 2,729
G
Gombessa Offline
2000 Post Club Member
Gombessa  Offline
2000 Post Club Member
G

Joined: Aug 2016
Posts: 2,729
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.


Yamaha P-85, P-105, CP50, Kawai MP11 || Kawai NV-10
Re: Multiple MIDI On question [Re: Audetto] #2799819
01/08/19 05:39 PM
01/08/19 05:39 PM
Joined: Sep 2009
Posts: 7,727
Raleigh, North Carolina
MacMacMac Offline
7000 Post Club Member
MacMacMac  Offline
7000 Post Club Member

Joined: Sep 2009
Posts: 7,727
Raleigh, North Carolina
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.

Re: Multiple MIDI On question [Re: Audetto] #2799824
01/08/19 05:57 PM
01/08/19 05:57 PM
Joined: Feb 2010
Posts: 4,887
A
anotherscott Online content
4000 Post Club Member
anotherscott  Online Content
4000 Post Club Member
A

Joined: Feb 2010
Posts: 4,887
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.

Re: Multiple MIDI On question [Re: Audetto] #2799830
01/08/19 06:09 PM
01/08/19 06:09 PM
Joined: Oct 2013
Posts: 1,910
France
Frédéric L Offline
1000 Post Club Member
Frédéric L  Offline
1000 Post Club Member

Joined: Oct 2013
Posts: 1,910
France
@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.


Yamaha CLP150, Bechstein Digital Grand, Garritan CFX, Ivory II pianos, Galaxy pianos, EWQL Pianos, Native-Instrument The Definitive Piano Collection, Soniccouture Hammersmith, Truekeys, Pianoteq
Re: Multiple MIDI On question [Re: Frédéric L] #2799832
01/08/19 06:22 PM
01/08/19 06:22 PM
Joined: Sep 2009
Posts: 7,727
Raleigh, North Carolina
MacMacMac Offline
7000 Post Club Member
MacMacMac  Offline
7000 Post Club Member

Joined: Sep 2009
Posts: 7,727
Raleigh, North Carolina
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?

Re: Multiple MIDI On question [Re: Audetto] #2799838
01/08/19 06:48 PM
01/08/19 06:48 PM
Joined: Oct 2013
Posts: 1,910
France
Frédéric L Offline
1000 Post Club Member
Frédéric L  Offline
1000 Post Club Member

Joined: Oct 2013
Posts: 1,910
France
@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.


Yamaha CLP150, Bechstein Digital Grand, Garritan CFX, Ivory II pianos, Galaxy pianos, EWQL Pianos, Native-Instrument The Definitive Piano Collection, Soniccouture Hammersmith, Truekeys, Pianoteq
Re: Multiple MIDI On question [Re: Audetto] #2799851
01/08/19 07:34 PM
01/08/19 07:34 PM
Joined: Feb 2010
Posts: 4,887
A
anotherscott Online content
4000 Post Club Member
anotherscott  Online Content
4000 Post Club Member
A

Joined: Feb 2010
Posts: 4,887
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.

Re: Multiple MIDI On question [Re: Frédéric L] #2799871
01/08/19 08:32 PM
01/08/19 08:32 PM
Joined: Sep 2009
Posts: 7,727
Raleigh, North Carolina
MacMacMac Offline
7000 Post Club Member
MacMacMac  Offline
7000 Post Club Member

Joined: Sep 2009
Posts: 7,727
Raleigh, North Carolina
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.

Re: Multiple MIDI On question [Re: MacMacMac] #2799881
01/08/19 09:09 PM
01/08/19 09:09 PM
Joined: Feb 2010
Posts: 4,887
A
anotherscott Online content
4000 Post Club Member
anotherscott  Online Content
4000 Post Club Member
A

Joined: Feb 2010
Posts: 4,887
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,

Re: Multiple MIDI On question [Re: Audetto] #2799890
01/08/19 09:20 PM
01/08/19 09:20 PM
Joined: Sep 2009
Posts: 7,727
Raleigh, North Carolina
MacMacMac Offline
7000 Post Club Member
MacMacMac  Offline
7000 Post Club Member

Joined: Sep 2009
Posts: 7,727
Raleigh, North Carolina
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.

Re: Multiple MIDI On question [Re: MacMacMac] #2799900
01/08/19 09:46 PM
01/08/19 09:46 PM
Joined: Aug 2016
Posts: 2,729
G
Gombessa Offline
2000 Post Club Member
Gombessa  Offline
2000 Post Club Member
G

Joined: Aug 2016
Posts: 2,729
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.


Yamaha P-85, P-105, CP50, Kawai MP11 || Kawai NV-10
Re: Multiple MIDI On question [Re: MacMacMac] #2799905
01/08/19 10:07 PM
01/08/19 10:07 PM
Joined: Feb 2010
Posts: 4,887
A
anotherscott Online content
4000 Post Club Member
anotherscott  Online Content
4000 Post Club Member
A

Joined: Feb 2010
Posts: 4,887
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

Moderated by  Piano World 

Shop Our Online Store!
Shop Our Store Online
Shop PianoSupplies.com

Did you know Piano World has an online store, and that it's loaded with goodies pianists and music lovers want?
Check it out and place your order.

Special Purchase!
Keyboard and Roses Piano Bench Cushion Keyboard & Roses 14"x30" piano bench cushions Regularly sold for $79 to $100, now only $39. (while supplies last)

(ad)
Pianoteq
PianoTeq Bechstein
(ad)
Faust Harrison Pianos
Faust Harrison 100+ Steinways
New Topics - Multiple Forums
CHECK OUT LOT 60
by martin snow. 03/20/19 07:28 PM
regrets
by dolce sfogato. 03/20/19 06:24 PM
Semi Concert Grand Blind Test
by Keith D Kerman. 03/20/19 05:57 PM
Kawai CA98
by Nordomus. 03/20/19 04:24 PM
How to master new skills with 'deliberate practice'
by thepianoplayer416. 03/20/19 02:30 PM
What's Hot!!
PIANO TEACHERS Please read this!
-------------------
European Tour for Piano Lovers
JOIN US FOR THE TOUR!
--------------------
Posting Pictures on the Forums
-------------------
Forums RULES & HELP
-------------------
ADVERTISE on Piano World
Forum Statistics
Forums41
Topics191,008
Posts2,808,699
Members92,831
Most Online15,252
Mar 21st, 2010
Please Support Our Advertisers
Faust Harrison 100+ Steinways

Dampp Chaser Piano Life Saver

Sweetwater

 Best of Piano Buyer

PianoTeq Bechstein
Visit our online store for gifts for music lovers


 
Help keep the forums up and running with a donation, any amount is appreciated!
Or by becoming a Subscribing member! Thank-you.
Donate   Subscribe
 
Our Piano Related Classified Ads
| Dealers | Tuners | Lessons | Movers | Restorations | Pianos For Sale | Sell Your Piano |

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


copyright 1997 - 2019 Piano World ® all rights reserved
No part of this site may be reproduced without prior written permission
Powered by UBB.threads™ PHP Forum Software 7.6.2