fbpx
Skip to main content

MIDI Forum

How to detect numbe...
 
Notifications
Clear all

How to detect number of Piano keys device (61, 76.... or 88 keys)?

7 Posts
4 Users
0 Reactions
7,536 Views
Vu
 Vu
Posts: 10
Active Member
Topic starter
 

Hello,

I have been struggling.... I was wondering, is there a function/method or away, to figure out how many keys of Piano Input device?

For instance, once midi Piano connected successful, in the method "onMIDISuccess(midiAccess)", I need to display my "virtual piano key board" size base on number of Piano keys (48, 61 ...88 keys).

Any help, advise would be greatly appreciated.

Thank you.
Vu.

 
Posted : 01/06/2020 9:19 am
Geoff
Posts: 1043
Noble Member
 

As far as midi (midi spec 1) is concerned, I don't think that this is anything to do with midi, and there is nothing general about this. It is not impossible that a specific device might accept a SysEx message and answer, but this is highly unlikely.

There may however be some provision for something like this in midi 2.0, which has been announced, but as yet there may not be any midi 2 devices available. You might check this again in a year or two?

Geoff

 
Posted : 01/06/2020 10:01 am
Bjorn
Posts: 9
Active Member
 

While this might not work for all keyboards, the large majority have a number in their device name that corresponds to the number of keys.

 
Posted : 01/06/2020 10:44 am
Sema
 Sema
Posts: 179
Reputable Member
 

I'm pretty sure MIDI 2.0 devices will have this functionality.
For older models you can try to detect the model name using https://github.com/jazz-soft/JZZ-midi-Gear

 
Posted : 01/06/2020 2:10 pm
Vu
 Vu
Posts: 10
Active Member
Topic starter
 

Thank you all for responded. I will try to detect the model name using source Sema mentioned. And maybe handle it manually ...something like "..get lowest key and highest key input.." and then calculate how many keys between....
Thank you.
Vu.

 
Posted : 01/06/2020 2:43 pm
Geoff
Posts: 1043
Noble Member
 

As I understand it, OP was hoping there was a way to get the No of keys as a direct/immediate answer, that his system could make use of. REgarding this, I think my answer above is correct.

There IS a general SYSEX command that will request the device ID, and this will usually get an answer back, but the information provided would not immed help OP, as there would be a Mfg code, and a device code, and the codes are numbers. Sema's system linked above has created a list of devices (with names) and the numbers returned by the device ID request, so that there can be a look-up to translate the code obtained to a more useful designation that might be in the box or the keyboard body, i.e. GRX-88. Such a look-up will always be problematic, not every older device will be on it, and newer devices will need adding pretty much all the time.

I have a fairly old Casio keyboard which is midi capable and quite useful, however if has ZERO SysEx capability so you will get no reply from any Device ID enquiry! No doubt there are many other similar keyboards?

Geoff

 
Posted : 01/06/2020 2:45 pm
Vu
 Vu
Posts: 10
Active Member
Topic starter
 

Thank you Geoff,
...my current virtual keyboards ...manually handle "48 keys input" looks like:
https://ibb.co/qD81k0k

 
Posted : 01/06/2020 3:01 pm
Share: