Topic: Keyboard sampling freq

One thing I notice and dismissed immediately on version 8 was that chords were more difficult to play together than on version 7.
This, if true, is of course a good thing.

I've been listening to demos on YT and there is a particular brand that I never liked I'm not going to name names but it starts with Yam and ends with aha.
all the demos of the on their line,  again no names but it contains the letters C and L and P, a large 3 digit number, and G and P.
seem to play all the chord notes perfectly at the same time.
Is this a problem with my hearing or a real thing?

The AvantGrand series X sound normal to me and very good may I add.

I also sampled demos of Roland and Pianoteq and these seem normal even on YT.

Then I went to "options / MIDI" on PTQ 8 and it seems the first column are seconds and milliseconds.
any double notes under 4 milliseconds apart sound together, 4 and 5 I'm not sure, over 6 milliseconds defensively not together.
I was able (once) to play two notes in the same millisecond.
when playing 7 notes (2+5) 20 milliseconds from first to last sounds normal and 13 milliseconds sound together.

anybody has a similar experience?
is this a real thing?
is Pianoteq similar to a mechanical piano in this aspect?
is it that my keyboard cannot send too many event in the same millisecond?

--------------------------------

I don't think this information will be easy to find - when I got my Roland HP605 they refused to say how many levels of velocity they transmitted internally, they just said "over 127"...

last mechanical piano I played was a big Boserdorfer in a Toronto store - I recommend it!
(I never really liked my HP605)
(it's probably over 7 years since I upgraded from the CLP120 and now and then I still vibrate the pedal instead of half pedalling...)

Re: Keyboard sampling freq

Antonio M wrote:

One thing I notice and dismissed immediately on version 8 was that chords were more difficult to play together than on version 7.
This, if true, is of course a good thing.

I've been listening to demos on YT and there is a particular brand that I never liked I'm not going to name names but it starts with Yam and ends with aha.
all the demos of the on their line,  again no names but it contains the letters C and L and P, a large 3 digit number, and G and P.
seem to play all the chord notes perfectly at the same time.
Is this a problem with my hearing or a real thing?

The AvantGrand series X sound normal to me and very good may I add.

I also sampled demos of Roland and Pianoteq and these seem normal even on YT.

Then I went to "options / MIDI" on PTQ 8 and it seems the first column are seconds and milliseconds.
any double notes under 4 milliseconds apart sound together, 4 and 5 I'm not sure, over 6 milliseconds defensively not together.
I was able (once) to play two notes in the same millisecond.
when playing 7 notes (2+5) 20 milliseconds from first to last sounds normal and 13 milliseconds sound together.

anybody has a similar experience?
is this a real thing?
is Pianoteq similar to a mechanical piano in this aspect?
is it that my keyboard cannot send too many event in the same millisecond?

--------------------------------

I don't think this information will be easy to find - when I got my Roland HP605 they refused to say how many levels of velocity they transmitted internally, they just said "over 127"...

last mechanical piano I played was a big Boserdorfer in a Toronto store - I recommend it!
(I never really liked my HP605)
(it's probably over 7 years since I upgraded from the CLP120 and now and then I still vibrate the pedal instead of half pedalling...)

I have a smaller cousin of the digital piano you have. And it happens here too. I suspect this is more of a limitation of USB polling rates. Default is generally 125 Hz on windows which would translate to 8ms. I am not sure if midi input is polled higher or not. I couldn't find any info or any way to change that. My mouse and keyboard drivers let me increase it to 1000 Hz though but that's only for these two devices.
Midi standard would also have something to do with this. Perhaps more tech savvy people here would know better.

Re: Keyboard sampling freq

ankipruthi wrote:

I have a smaller cousin of the digital piano you have. And it happens here too. I suspect this is more of a limitation of USB polling rates. Default is generally 125 Hz on windows which would translate to 8ms. I am not sure if midi input is polled higher or not. I couldn't find any info or any way to change that. My mouse and keyboard drivers let me increase it to 1000 Hz though but that's only for these two devices.
Midi standard would also have something to do with this. Perhaps more tech savvy people here would know better.

(well, now I'm using a old Korg350LP at least is doesn't get unusably(*) sticky during the summer like the Roland (with or without Air Conditioning on!), maybe its just my fingers chemistry or my chemical cleaning product - really unusable...)

But I do get multiple events in under 8ms... maybe more than one event can be send in each cycle... ???
I don't know if PTQ reports when it receives the event or if the timing of the event is sent by the keyboard - (I guess this is searchable).

And I forgot to say something that I really wanted to say:
even if I don't like the Yamaha sound when it's played by a good pianist I don't notice it is a Yamaha - all this through YT.
I never tried a CFX, but I did try a few AvandGrand before the X series.

(*) so many words missing from the English language...

Re: Keyboard sampling freq

ankipruthi wrote:
Antonio M wrote:

One thing I notice and dismissed immediately on version 8 was that chords were more difficult to play together than on version 7.
This, if true, is of course a good thing.

I've been listening to demos on YT and there is a particular brand that I never liked I'm not going to name names but it starts with Yam and ends with aha.
all the demos of the on their line,  again no names but it contains the letters C and L and P, a large 3 digit number, and G and P.
seem to play all the chord notes perfectly at the same time.
Is this a problem with my hearing or a real thing?

The AvantGrand series X sound normal to me and very good may I add.

I also sampled demos of Roland and Pianoteq and these seem normal even on YT.

Then I went to "options / MIDI" on PTQ 8 and it seems the first column are seconds and milliseconds.
any double notes under 4 milliseconds apart sound together, 4 and 5 I'm not sure, over 6 milliseconds defensively not together.
I was able (once) to play two notes in the same millisecond.
when playing 7 notes (2+5) 20 milliseconds from first to last sounds normal and 13 milliseconds sound together.

anybody has a similar experience?
is this a real thing?
is Pianoteq similar to a mechanical piano in this aspect?
is it that my keyboard cannot send too many event in the same millisecond?

--------------------------------

I don't think this information will be easy to find - when I got my Roland HP605 they refused to say how many levels of velocity they transmitted internally, they just said "over 127"...

last mechanical piano I played was a big Boserdorfer in a Toronto store - I recommend it!
(I never really liked my HP605)
(it's probably over 7 years since I upgraded from the CLP120 and now and then I still vibrate the pedal instead of half pedalling...)

I have a smaller cousin of the digital piano you have. And it happens here too. I suspect this is more of a limitation of USB polling rates. Default is generally 125 Hz on windows which would translate to 8ms. I am not sure if midi input is polled higher or not. I couldn't find any info or any way to change that. My mouse and keyboard drivers let me increase it to 1000 Hz though but that's only for these two devices.
Midi standard would also have something to do with this. Perhaps more tech savvy people here would know better.


I dont know if it helps:
USB2 is capable of 8kHz polling rate.
Depending on your OS, and on the Midi device connected, you may change the polling rate.
On Linux (Ubuntu in my case) there are multiple options - some prefer to hack around the original files of the OS or recompile kernels,
but I just use a low latency kernel that is set to 1000hz clock time,
and ontop I use libinput-tools which can set overrides for sepecific USB ports or globaly. Install it, and than open some shell and enter

sudo libinput list-devices

Check for your desired sysname (the port its connected to)

sudo libinput debug-events

Check here what Device Type you are looking for

than create an override config by

sudo nano /etc/libinput/local-overrides.quirks

and put the following command in it:

[Quirks]
MatchUdevType=<DeviceType>
MatchName=<sysname>
Option "PollingRate" "1000" (or 8000 or whatever)

Restart the service by

sudo systemctl restart libinput

This should give you down to 0.125ms capabilities.

Cheers

Last edited by Vepece (01-02-2023 00:31)
Ubuntu 22 + Kernel lowlatency + 1000Hz + PipeWire + WirePlumber | i5-8265U + taskset Limit 4 Cores + CPUPower-GUI fixed clock freq | PTQ8Stage @ 32bit/48kHz/128Buffer/256Polyphony = Perf. Index ~60-90

Re: Keyboard sampling freq

Vepece wrote:

I dont know if it helps:

It sure should!

Thank you, lots of new information!
(Linux Debian here)

Re: Keyboard sampling freq

Vepece wrote:

sudo libinput list-devices

Check for your desired sysname (the port its connected to)

sudo libinput debug-events

installed - trying: cannot identify the usb MIDI (I must be missing it)

run debug-events:
- mouse events!
- computer keyboard events!
- page turner events!
- press the piano keyboard - no events...
--- close Pianoteq - still no events...

any ideas?
anyway it goes I thank you again for your post with lots of information!

Re: Keyboard sampling freq

Antonio M wrote:
Vepece wrote:

sudo libinput list-devices

Check for your desired sysname (the port its connected to)

sudo libinput debug-events

installed - trying: cannot identify the usb MIDI (I must be missing it)

run debug-events:
- mouse events!
- computer keyboard events!
- page turner events!
- press the piano keyboard - no events...
--- close Pianoteq - still no events...

any ideas?
anyway it goes I thank you again for your post with lots of information!

Mh, maybe the protocols used for USB Midi are different and libinput cant handle them. I used it in the past for polling rates of my Keyboard and Mice and it worked.
Til friday Im busy but I should have plenty of time to mess around with my sytem at the weekend and will check on that and post some update regarding libinput, or worst case look for another solution by myself.

Ubuntu 22 + Kernel lowlatency + 1000Hz + PipeWire + WirePlumber | i5-8265U + taskset Limit 4 Cores + CPUPower-GUI fixed clock freq | PTQ8Stage @ 32bit/48kHz/128Buffer/256Polyphony = Perf. Index ~60-90

Re: Keyboard sampling freq

Vepece wrote:
Antonio M wrote:
Vepece wrote:

Check for your desired sysname (the port its connected to)

installed - trying: cannot identify the usb MIDI (I must be missing it)

run debug-events:
- mouse events!
- computer keyboard events!
- page turner events!
- press the piano keyboard - no events...
--- close Pianoteq - still no events...

any ideas?
anyway it goes I thank you again for your post with lots of information!

Mh, maybe the protocols used for USB Midi are different and libinput cant handle them. I used it in the past for polling rates of my Keyboard and Mice and it worked.
Til friday Im busy but I should have plenty of time to mess around with my sytem at the weekend and will check on that and post some update regarding libinput, or worst case look for another solution by myself.

Dont think I forgot about it, but Im actually more busy than expected this weekend - but I will definitely get back to you again!

Ubuntu 22 + Kernel lowlatency + 1000Hz + PipeWire + WirePlumber | i5-8265U + taskset Limit 4 Cores + CPUPower-GUI fixed clock freq | PTQ8Stage @ 32bit/48kHz/128Buffer/256Polyphony = Perf. Index ~60-90

Re: Keyboard sampling freq

Vepece wrote:

Dont think I forgot about it, but Im actually more busy than expected this weekend - but I will definitely get back to you again!

No worries. I'm a software guy... hardware is very confusing. However I like to understand "everything"
I did find "midisnoop" which only confirms what we can see from the midi report on Pianoteq.
Also MIDI standard download requires an account (I have enough accounts already) and
seems that MIDI should send the time elapsed from the previous event in some multiple of micro seconds previously defined
(sometimes large amount of microseconds as the minimum)
I'm starting to be afraid this is deviating too much from Pianoteq interest topics...

I am now down to a latency that allows me to play the broken octaves on the you-know-what Beethoven sonata.

But on my original quest: Anyone noticed the Yamaha CLPs, even the GP ones, pianos produce a too perfect chord simultaneous notes... ???

Re: Keyboard sampling freq

Antonio M wrote:
Vepece wrote:

Dont think I forgot about it, but Im actually more busy than expected this weekend - but I will definitely get back to you again!

No worries. I'm a software guy... hardware is very confusing. However I like to understand "everything"
I did find "midisnoop" which only confirms what we can see from the midi report on Pianoteq.
Also MIDI standard download requires an account (I have enough accounts already) and
seems that MIDI should send the time elapsed from the previous event in some multiple of micro seconds previously defined
(sometimes large amount of microseconds as the minimum)
I'm starting to be afraid this is deviating too much from Pianoteq interest topics...

I am now down to a latency that allows me to play the broken octaves on the you-know-what Beethoven sonata.

But on my original quest: Anyone noticed the Yamaha CLPs, even the GP ones, pianos produce a too perfect chord simultaneous notes... ???

I am actually very intrigued to hear that a CLP can produce perfect simultaneous notes given the internal protocol is midi . Midi as far as I know is at the same time a format and a protocol and as a protocol it is serial, which means that only one note can be transmitted on a given channel at instant t . It is actually not a limitation as the delta time between 2 events is more or less of the same magnitude that the actual real delta when your fingers press 2 notes or more, at the same time, on the piano . Perfect synchro is an ideal for the fingers but doesn’t exist in reality and this is actually important as it is all about ‘humanisation’ of a rendition . So , while I think it is actually possible for a sofware ( VST or internal piano software) to group notes that events separated by 1ms or less and group them as sounds that have to be rendered simultaneously via polyphony , it seems to me , like a ‘false’ good idea as it doesn’t reproduce the real human asynchronous input . Maybe , I’m wrong as I only writing this based on what I know . So feel free to correct me.

Last edited by joannchr (05-02-2023 14:30)

Re: Keyboard sampling freq

Some (old) principles of MIDI here:

http://www.96khz.org/oldpages/limitsofmidi.htm

With a standard serial Transmission Frequency of 31250 Hz and a typical 3-Byte message you get ca. 1 ms resolution:

30 / 31250Hz = 0.96 ms

As long as somewhere in the transmission chain of a MIDI note the rate is "bottlenecked" to 31250 Hz, then you cannot play more than 1 note per ms.

The question is: Is there always a limitation to 31250 Hz when using Pianoteq with MIDI 1.0?

Or is it possible to get a higher resolution than 1 ms with Pianoteq when faster serial busses like USB are used for MIDI transmission?

Last edited by groovy (05-02-2023 15:24)

Re: Keyboard sampling freq

joannchr wrote:

[...] I am actually very intrigued to hear that a CLP can produce perfect simultaneous notes given the internal protocol is midi [...]

My question came about because I have no access to a strings and hammers piano - so I can't compare.

There is no doubt that I did try a small Yamaha (CLP, CVP. Arius... one of them) where it was actually difficult not to play the chords perfectly simultaneously.
I remember asking Brian (I think is name is Brian) on the piano store about it - this was 5 or more years ago.

joannchr wrote:

[...] Perfect synchro is an ideal for the fingers but doesn’t exist in reality [...]

yes, I thought that's why the Yamaha CLPs sound strange to me (again over YT - but others sound normal)
and that's how this question started... I don't think you're wrong. It's not natural.

groovy wrote:

[...] Or is it possible to get a higher resolution than 1 ms with Pianoteq [...]

in Pianoteq / options / MIDI I did get two notes reported on the same millisecond.
Could not do it with 3 notes - let me try again... this time I got reported:
- 1 ms for 2 notes
- 0 ms for releasing 2 notes
- 4 ms for 3 notes

Re: Keyboard sampling freq

Antonio M wrote:
joannchr wrote:

in Pianoteq / options / MIDI I did get two notes reported on the same millisecond.
Could not do it with 3 notes - let me try again... this time I got reported:
- 1 ms for 2 notes
- 0 ms for releasing 2 notes
- 4 ms for 3 notes

I don't understand your numbers.
But I can give an own example: Sometimes I can trigger two NoteOn events on the keyboard with the same timestamp in Pianoteq's midi monitor

73.256 s : E4
73.256 s : D4

This doesn't prove, that the midi resolution had been better than 1 ms, because the last digit (6 ms) is probably rounded inside Pianoteq. (is it, Modartt?)

Re: Keyboard sampling freq

groovy wrote:
Antonio M wrote:
joannchr wrote:

in Pianoteq / options / MIDI I did get two notes reported on the same millisecond.
Could not do it with 3 notes - let me try again... this time I got reported:
- 1 ms for 2 notes
- 0 ms for releasing 2 notes
- 4 ms for 3 notes

I don't understand your numbers.
But I can give an own example: Sometimes I can trigger two NoteOn events on the keyboard with the same timestamp in Pianoteq's midi monitor

73.256 s : E4
73.256 s : D4

This doesn't prove, that the midi resolution had been better than 1 ms, because the last digit (6 ms) is probably rounded inside Pianoteq. (is it, Modartt?)

yes, that's what I did.
in this case 73.256 - 73.256 <= 0.999999999...999 ms or < 0.5 ms with rounding...

Re: Keyboard sampling freq

groovy wrote:

Some (old) principles of MIDI here:

http://www.96khz.org/oldpages/limitsofmidi.htm

[...]

Just staring to go through that. it says:
"MIDI 1982 10 fingers 29.4 ms". right?
I think that's it. In a couple of tries I got just 20 ms for 10 fingers - way less than 29.4

so do he have MIDI 8? that would be 4.1 ms for 10 fingers.

worst case for MIDI 1982: 960 micro seconds, almost 1 ms.
worst case for MIDI 8: 132 micro seconds, more than 1/10 ms.

but that article is from 1999... maybe things changed since - I can't really find info on that.

Probably we can have MIDI played that don't depend on fingers execution - that should allow to experience how chords sound with different time gaps between it's notes - maybe later...

(I thought I lost this post... Ctrl+Shift+T to the rescue!)

Re: Keyboard sampling freq

Antonio M wrote:

"MIDI 1982 10 fingers 29.4 ms". right?

Don't know, unclear what the author did there. But I freely adapted the idea of 10 fingers.

https://i.postimg.cc/Hx7QWhx2/10-keys-at-once.jpg

I pressed 10 white keys (C3-E4) at once with a folding rule.
I wrote down the timestamp of PTQ's midi monitor of the first and the last of that ten note-on events. Five repetitions:

613 ms, 623 ms, delta 10 ms
458 ms, 470 ms, delta 12 ms
918 ms, 933 ms, delta 15 ms
141 ms, 151 ms, delta 10 ms
684 ms, 696 ms, delta 12 ms

The smallest delta for ten notes has been 10 ms, so I think my system is using the standard ~1 ms MIDI 1.0 resolution per event.

The keyboard is directly connected per USB with my Linux laptop and Pianoteq 8 STD.

Last edited by groovy (06-02-2023 22:32)

Re: Keyboard sampling freq

Hey @Antonio M,

today I had time to mess around regarding the polling rate.

Short answer: No solution

Long:
I checked my Kawai VPC-1.

First I wanted to see its capabilites, so first I need to find the device, in some Shell:

lsusb

My Device was named odd:

Bus 001 Device 005: ID 0f54:0101 Kawai Musical Instruments Mfg. Co., Ltd MP6 Stage Piano

To further check on its details:

lsusb -v -d 0f54:0101

That prompted me alot, most interesting:
idProduct really is saved wrong by Kawai. Its claiming

idProduct          0x0101 MP6 Stage Piano

My VPC-1 is Production Date August 2022, so they never checked/changed that. Funny, I would have bet some user reported this already. I will report it to them: Lets see their reply.

Further interesting is what kind of USB Protocol it supports:

bcdUSB               1.10

I was lucky and it tells me USB 1.1 instantly, some devices may use values like 0x100 for USB 1.1 or 0x200 for USB 2.0.

Thats already a little bad in my opinion, in theory this means at USB 1.1 Full Speed it allows for 1ms - if it runs in Full Speed. Lets check:

lsusb -t

prompts me:

|__ Port 4: Dev 5, If 0, Class=Audio, Driver=snd-usb-audio, 12M

12Mbps - so yes, Full Speed.

It also tells us the next most interesting and last thing:

Driver=snd-usb-audio

snd-usb-audio does NOT allow to change the polling rates!
only Human Interface Device with the Driver "usbhid" does and can be changed by my suggested libinput method.

This means, only sample rate and buffer size of our Server/Software can be altered as we already know - but nothing on the Driver side as far as I see it now.
Mhhhh... Too bad.
I wished my Device would atleast use USB2.0 Full Speed that features 0.125ms instead of 1ms.

No matter what MIDI Standard is used like 1982 vs 8: USB1.1 will still be the bottleneck for my case only allowing 1ms!
So for the future: Look out what kind of MIDI Controller you buy. I would appreciate if many users could read out their USB Type so we create a list and see if there even is any Device that features USB2.0 Full Speed or better.
I could check on the Roland FP90X in the next months when I visit a friend with my Laptop - but thats all I could contribute to that list (or I go to our local music store and ask bold if I can check on their devices )


Greetings

Last edited by Vepece (10-02-2023 20:33)
Ubuntu 22 + Kernel lowlatency + 1000Hz + PipeWire + WirePlumber | i5-8265U + taskset Limit 4 Cores + CPUPower-GUI fixed clock freq | PTQ8Stage @ 32bit/48kHz/128Buffer/256Polyphony = Perf. Index ~60-90

Re: Keyboard sampling freq

Audio and midi is served by the standard kernel module "snd-usb-audio". The audio and midi device in my Korg B2 is a USB 2.00 device for example:

bcdUSB               2.00
Bus 001 Device 005: ID 0944:020f KORG, Inc. B2

This USB Device 005 is used like a USB 1.1 device with "Full Speed" of 12 Mbit/s by the driver:

lsusb -t
...
    |__ Port 3: Dev 5, If 4, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 3: Dev 5, If 2, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 3: Dev 5, If 0, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 3: Dev 5, If 3, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 3: Dev 5, If 1, Class=Audio, Driver=snd-usb-audio, 12M
...

The midi input of the alsa driver snd-usb-audio is used by the Process ID 1284, which is Pianoteq in this moment:

cat /proc/asound/B2/midi0

B2

Output 0
  Tx bytes     : 0
Input 0
  Rx bytes     : 690
  Owner PID    : 1284
  Buffer size  : 4096
  Avail        : 0
  Overruns     : 0

Each time I press a key the counter Rx bytes is increased by 3 bytes (note on) and 3 bytes (note off) as expected.

Full Speed USB is using the USB frame period of 1 ms. As far as I know each 1 ms frame transports a payload of 1023 bytes (forgot the details, have to check that!). That's a lot midi events per frame.

Interesting is the line "Buffer size  : 4096" in the upper code block. I don't fully understand, if this means the Input Buffer of the driver buffers 4 USB frames. That would mean a minimum 4 ms latency via the USB hop. (In the context of USB Audio I read in past an 1 ms frame is normally buffered with 2 frames in the USB device and 2 frames in the USB host, which also makes 4 ms in sum).

Re: Keyboard sampling freq

Thank you, Vepece.
Thank you, groovy.

I get the same numbers and the same as groovy:

lsusb
    Bus 001 Device 006: ID fc02:0101  USB MIDI Interface
    Bus 001 Device 008: ID 0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound Device

lsusb -t
    |__ Port 4: Dev 6, If 1, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 4: Dev 6, If 0, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 5: Dev 8, If 0, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 5: Dev 8, If 1, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 5: Dev 8, If 2, Class=Audio, Driver=snd-usb-audio, 12M

cat /proc/asoubs/card0/midi0
USB MIDI Interface

Output 0
  Tx bytes     : 0
Input 0
  Rx bytes     : 2687477
  Owner PID    : 1424
  Buffer size  : 4096
  Avail        : 0
  Overruns     : 0

Rx bytes increases by almost 9 bytes per second without user intervention.  (I did not play 1/2 million notes since last reboot)

I also tried the ruler to play 20 (twenty) notes at a time...
I got about 40ms on press
and about 20ms on release. (intervals between to events range from 0 to 2 ms)

This is a bit different from the result groovy got... - but the 40ms might be cause by uneven pressing and/or flexible ruler...

Re: Keyboard sampling freq

Hi Antonio

Antonio M wrote:

Rx bytes increases by almost 9 bytes per second without user intervention.  (I did not play 1/2 million notes since last reboot)

... eventually that is "MIDI active sensing", which sends keepalives each 0.3 s. If your unknown midi events are not shown in Pianoteq's midi monitor, then it probably is MIDI active sensing.

I also tried the ruler to play 20 (twenty) notes at a time...
I got about 40ms on press
and about 20ms on release. (intervals between to events range from 0 to 2 ms)

... that is the expected result in my opinion. Twenty note-offs in 20 ms means 1 event per 1 ms at best.


Late Edit:

groovy wrote:

As far as I know each 1 ms frame transports a payload of 1023 bytes (forgot the details, have to check that!).

After reading a bit in the USB protocol at
https://www.beyondlogic.org/usbnutshell/usb4.shtml
the MaxPacketSize is 64 bytes (and not 1023 bytes), because the Transfer Type for USB MIDI is Bulk (and not Isochronous like AUDIO):

$ lsusb -v -s 001:005
...
   Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0025
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                16
        iJack                   3 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                64
        bNrInputPins            1
        baSourceID( 0)         16
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                48
        bNrInputPins            1
        baSourceID( 0)         32
        BaSourcePin( 0)         1
        iJack                   4 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                32
        iJack                   0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)      16
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)      48

A MaxPacketSize of 64 bytes means there are much less MIDI events in an USB frame period of 1 ms (remember a note-on has 3 bytes plus start and stop bits each byte in the MIDI1.0 protocol).

Last edited by groovy (11-02-2023 12:46)

Re: Keyboard sampling freq

Very interesting conversation, folks.

Replying to say that you can write a simple midi monitor using python + mido (which in turns require a few OS dependencies but they are easy on Linux). That can provide a few more insights on what is going on into your MIDI chain than what Pianoteq provides.

Another useful document for these matters, which I don't think I've seen mentioned in this thread is https://www.usb.org/sites/default/files/midi10.pdf


Looking forward to what you are finding!
Cheers

Where do I find a list of all posts I upvoted? :(

Re: Keyboard sampling freq

With your link to usb.org I found one more overseen component, thank you!
The 3-byte MIDI events are first converted to "32-bit USB-MIDI Event Packets" (4-byte), before they are sent in a bulk transfer via USB-cable to the PC. I assume these  "32-bit USB-MIDI Event Packets" are the payload of the earlier mentioned 64-byte bulk packets (correct?). And a 1 ms USB frame can contain several of those 64-byte bulk packets (true?).

At least the most important question is:
Where in the whole USB picture is the bottleneck, that limits the effective rate to 1 MIDI event per 1 ms we see in Pianoteq's midi monitor?

USB 1.1 seems not to be the limiting factor, because even one 64-byte bulk packet can contain roundabout sixteen 4-byte USB-MIDI Event Packets. Because of some overhead probably less than 16 USB-MIDI Event Packets. But 10 note-on events per 64-byte bulk packet are possible I think. And when there are more 64-byte bulk packets possible in a 1 ms USB frame, then it is very easy to transport say 10 notes in 1 ms with USB 1.1.

Ergo the "serialisation" to 1 note per 1 ms happens outside the USB protocol. My guess is a normal MIDI 1.0 stream inside the keyboard (here Korg) to its internal USB converter (aka USB-MIDI interface).

A second possibility for the bottleneck would be the MIDI 1.0 stream after the incoming USB frames are reconverted in the ALSA USB MIDI driver inside the PC. But I guess at the PC side only the original sequence of MIDI events of the source (keyboard) is recovered.

Sorry for the speculations, the whole picture is not easy to understand and express for me. But it is getting clearer ...

Last edited by groovy (13-02-2023 00:33)

Re: Keyboard sampling freq

groovy wrote:

With your link to usb.org I found one more overseen component, thank you!

You are most welcome!

groovy wrote:

I assume these  "32-bit USB-MIDI Event Packets" are the payload of the earlier mentioned 64-byte bulk packets (correct?). And a 1 ms USB frame can contain several of those 64-byte bulk packets (true?).

I agree with your interpretation, but I am not an expert in USB standards or implementations. Not by any stretch of the imagination, even though I do have written a few low-level codes that spoke with other devices via USB.

groovy wrote:

At least the most important question is:
Where in the whole USB picture is the bottleneck, that limits the effective rate to 1 MIDI event per 1 ms we see in Pianoteq's midi monitor?

Hard to tell without further testing.

If you have a Raspberry Pi Pico or some other programmable board that you can configure as a USB device, you can test many things quite simply. Being programmable you can change things in a way that you know and see what happens. You can use tinyusb implementation which works out of the box on the Pico with very little effort, and then you can send the packets as you please and see how they arrive. If I recall correctly the Pico is USB v1.1

I would do this test myself and report back, if I had not given my Pico's to someone else (but they are very inexpensive, from most places the shipping costs more than the Pico itself).

Of course the result of this test will not tell you what the Korg or the Kawai controllers do, but at least it will tell you if an independent USB implementation of MIDI does the same or not.

Where do I find a list of all posts I upvoted? :(

Re: Keyboard sampling freq

It seems the work has already been done. There many factors to consider, including the keyboard itself.

https://link.springer.com/article/10.37...018-1042-7

Last edited by levinite (27-02-2023 06:21)

Re: Keyboard sampling freq

levinite wrote:

It seems the work has already been done. There many factors to consider, including the keyboard itself.

https://link.springer.com/article/10.37...018-1042-7

levinite wrote:

It seems the work has already been done. There many factors to consider, including the keyboard itself.

https://link.springer.com/article/10.37...018-1042-7

(I'm not used to read these papers)

What I read: there is latency; some have higher latency than others; latency is not consistent; most of the values seem to not be important for us musicians.
PCI interface is faster than USB (but not by meaningful amounts)
I'm not sure: some instruments have much higher latency - maybe it's by design as the original physical instrument may have that latency in the first place.

There are references to other studies that are relevant to us that, I believe, concluded:
"
[...]1.5 to 5 ms are perceivable and can be controlled by performers when producing music (**)
[...]humans can discriminate changes in temporal intervals of 1 ms[...]
"

this seems to support what I posted before:
- bellow 4 ms chords sound simultaneous.
- above 6 ms chords do not sound simultaneous.

I post these questions because I have no opportunity to play on string pianos: I don't know if dynamics, touch, tone... are similar anymore.
and, going back to the question that led me to start this thread
- do Yamaha CLPs bunch the cords in the same millisecond?
it really felt like that the last time I tried one - I had to try hard to not do it - and that's what I hear on YT.

We all agree that the total latency is not generated by the MIDI interface alone.
(what happened?! I was just going to write 2 lines)
(**) except DB.

Re: Keyboard sampling freq

If usb 2.0 is used, the connected device positions itself as an audio device and the descriptors are correct, then the message can fly to the computer with a delay of 20-30 μs.  I observed this using the analyzer when I created a midi device from stm32.  A package can contain several midi events at once.  Defining device descriptors as an audio class causes the usb host to poll the device for messages at a high frequency.

Last edited by scherbakov.al (06-03-2023 12:17)

Re: Keyboard sampling freq

scherbakov.al wrote:

If usb 2.0 is used, the connected device positions itself as an audio device and the descriptors are correct, then the message can fly to the computer with a delay of 20-30 μs.  I observed this using the analyzer when I created a midi device from stm32.  A package can contain several midi events at once.  Defining device descriptors as an audio class causes the usb host to poll the device for messages at a high frequency.

Hm, i doubt that. The best service interval for audio using the USB Audio Class 2 (UAC2) standard (don't mix up with USB 2.0) is already a 125 μs microframe.
Usually two microframe buffers at the sending and receiving endpoint results in 500 μs streaming latency:
https://www.xmos.ai/download/Why-do-you...2(1.0).pdf

Re: Keyboard sampling freq

groovy wrote:
scherbakov.al wrote:

If usb 2.0 is used, the connected device positions itself as an audio device and the descriptors are correct, then the message can fly to the computer with a delay of 20-30 μs.  I observed this using the analyzer when I created a midi device from stm32.  A package can contain several midi events at once.  Defining device descriptors as an audio class causes the usb host to poll the device for messages at a high frequency.

Hm, i doubt that. The best service interval for audio using the USB Audio Class 2 (UAC2) standard (don't mix up with USB 2.0) is already a 125 μs microframe.
Usually two microframe buffers at the sending and receiving endpoint results in 500 μs streaming latency:
https://www.xmos.ai/download/Why-do-you...2(1.0).pdf

I don't know what speeds are used in different digital piano controllers. But the following speeds are achievable for midi transfer via usb, this can be seen from the screenshots of the analyzer window:

(Here I am looking at what is going on between stm32 and computer)

Here the device has connected but no messages have been sent yet:
https://i.ibb.co/8dQDgMt/2023-03-06-23-32-16.png

Here the device started being interrogated as an audio midi:
https://i.ibb.co/9Z0pd8C/2023-03-06-23-33-04.png

At the beginning there is a data packet with a midi message, and then there is a subsequent poll for the presence of data:
(It can be seen that the polling rate is quite high)
https://i.ibb.co/0mJ9BqF/2023-03-06-23-33-38.png

The message itself:
https://i.ibb.co/tmcxVgB/2023-03-06-23-34-09.png

On the screenshots, you can see after what time intervals it is possible to send / receive data. This high polling rate starts after the first message is sent.  A data packet can contain several midi messages at once.
Somehow this is faster than the spec you mentioned. I don't know, but it's how it is..
(It feels like Kawai VPC1 is somehow not perfect with speeds. I haven't tested in detail..)

Last edited by scherbakov.al (06-03-2023 22:09)

Re: Keyboard sampling freq

Hi, great you could show data with a protocol analyzer!
I try to interprete what I see:

scherbakov.al wrote:

Here the device has connected but no messages have been sent yet:
https://i.ibb.co/8dQDgMt/2023-03-06-23-32-16.png

... I guess it is the common USB 1.1 framerate ("Service interval") of 1 ms 

scherbakov.al wrote:

Here the device started being interrogated as an audio midi:
https://i.ibb.co/9Z0pd8C/2023-03-06-23-33-04.png

... I see two 4-byte USB-MIDI Event Packets, starting near 7 ms. What does "99+" mean? 99 bytes following and the few USB-MIDI Event Packets are just a brief header?

scherbakov.al wrote:

https://i.ibb.co/0mJ9BqF/2023-03-06-23-33-38.png

... this could be the partially filled 64-byte bulk packets inside a USB frame.

scherbakov.al wrote:

https://i.ibb.co/tmcxVgB/2023-03-06-23-34-09.png

... this could be the content of a 64-byte bulk packet filled with some USB-MIDI event packets. If that is true, it proves that USB 1.1 is not a bottleneck for received MIDI events in intervals >= 1 ms. That had been expected upwards.

scherbakov.al wrote:

Somehow this is faster than the spec you mentioned. I don't know, but it's how it is..

... it is no contradiction in my opinion. It just proves, that the source feeding the USB connection is limited to a MIDI event rate of 1/ms. The keyboard controller is probably working internally with the standard MIDI 1.0 resolution of ~1 ms.

scherbakov.al wrote:

(It feels like Kawai VPC1 is somehow not perfect with speeds. I haven't tested in detail..)

... please make clearer what you mean with that sentence once you have tested!

Thank you!

Re: Keyboard sampling freq

scherbakov.al wrote:
groovy wrote:
scherbakov.al wrote:

If usb 2.0 is used, the connected device positions itself as an audio device and the descriptors are correct, then the message can fly to the computer with a delay of 20-30 μs.  I observed this using the analyzer when I created a midi device from stm32.  A package can contain several midi events at once.  Defining device descriptors as an audio class causes the usb host to poll the device for messages at a high frequency.

Hm, i doubt that. The best service interval for audio using the USB Audio Class 2 (UAC2) standard (don't mix up with USB 2.0) is already a 125 μs microframe.
Usually two microframe buffers at the sending and receiving endpoint results in 500 μs streaming latency:
https://www.xmos.ai/download/Why-do-you...2(1.0).pdf

I don't know what speeds are used in different digital piano controllers. But the following speeds are achievable for midi transfer via usb, this can be seen from the screenshots of the analyzer window:

(Here I am looking at what is going on between stm32 and computer)

Here the device has connected but no messages have been sent yet:
https://i.ibb.co/8dQDgMt/2023-03-06-23-32-16.png

Here the device started being interrogated as an audio midi:
https://i.ibb.co/9Z0pd8C/2023-03-06-23-33-04.png

At the beginning there is a data packet with a midi message, and then there is a subsequent poll for the presence of data:
(It can be seen that the polling rate is quite high)
https://i.ibb.co/0mJ9BqF/2023-03-06-23-33-38.png

The message itself:
https://i.ibb.co/tmcxVgB/2023-03-06-23-34-09.png

On the screenshots, you can see after what time intervals it is possible to send / receive data. This high polling rate starts after the first message is sent.  A data packet can contain several midi messages at once.
Somehow this is faster than the spec you mentioned. I don't know, but it's how it is..
(It feels like Kawai VPC1 is somehow not perfect with speeds. I haven't tested in detail..)

What you show in the last pic is the data rate of the usb bus to the usb controller , not the actual polling rate or latency to the computer buffer, but even with the (slower) isyncronous standard high speed usb is capable of 65.5Mbits/sec or about 8 Bytes /uSec. You show a lower rate. I doubt that the midi data is sent in the isyncronous mode. It is more likely midi is sent in an asyncronous mode i.e. usb controllers transfer data, and the controller is polled by the OS, gets the data when ready and buffers it.

Here is how I see it. When we press a key a few bytes of midi data are sent with some minimum latency between (usb) hardware components which probably has its own buffers so multiple midi packets could be waiting between polls. The OS polls at a set rate, possibly what you have captured in the earlier pictures. I suspect the kernel itself does the polling. The midi receiving thread must wait (sleep) until signaled and (the kernel must be using a cpu to do this). No thread, not even the kernel has its own dedicated cpu and it is likely that the waiting thread must wait for the kernel to first restore it to a running state on the next 'available' cpu before the data is actually sent from the OS buffer. Of course, priorities also come into play. This is quite oversimplified and does not account for additional delays. It should be instructive to play a midi and run (Linux) atop. Hit "y" to see thread mode, notice the cpu idle time and how often Pianoteq's threads are in a sleeping (S), not a running state. There is quite a lot going on 'under the hood' that can and does influence latency.

Re: Keyboard sampling freq

levinite wrote:

What you show in the last pic is the data rate of the usb bus to the usb controller,

And the rate is obviously USB 1.1 Full Speed 12Mbit/s according to the marker 83 ns for the smallest period in the last image:

1/(83 ns) = 12 MHz -> 12 Mbit/s

Re: Keyboard sampling freq

groovy wrote:
levinite wrote:

What you show in the last pic is the data rate of the usb bus to the usb controller,

And the rate is obviously USB 1.1 Full Speed 12Mbit/s according to the marker 83 ns for the smallest period in the last image:

1/(83 ns) = 12 MHz -> 12 Mbit/s

Good point. I did not notice that.  It also means that the 12Mbits/s includes overhead of the usb protocol.

Re: Keyboard sampling freq

Antonio M wrote:

One thing I notice and dismissed immediately on version 8 was that chords were more difficult to play together than on version 7.

...

Then I went to "options / MIDI" on PTQ 8 and it seems the first column are seconds and milliseconds.
any double notes under 4 milliseconds apart sound together, 4 and 5 I'm not sure, over 6 milliseconds defensively not together.
I was able (once) to play two notes in the same millisecond.
when playing 7 notes (2+5) 20 milliseconds from first to last sounds normal and 13 milliseconds sound together.

anybody has a similar experience?

I did a quick test having Cakewalk play 3 octaves (36 notes) at the same time through a MIDI cable and back in to Pianoteq 8 using the MIDI ports on a Roland Duo-Capture EX - not a state-of-the-art interface by any means.

Pianoteq pretty consistently time-stamped the 36 notes across a range of only 24 milliseconds with many notes on the same timestamp - call it 2/3 of a millisecond per message.

I then adjusted the notes to play at 1ms intervals (2 ticks at 960PPQ and 125BPM). Due to various sources of jitter in the system, the timestamps were sometimes the same and sometimes 2ms apart, but most showed the expected 1ms interval, and the range of timestamps was 36ms as expected.

The sound of 36 attacks over 36ms was noticably more diffuse than 36 notes over 24ms. But with fewer notes the difference gets harder to hear - all but inditinguishable with a more typical 6-7 note chord.

I did the same with Pianoteq 7 and observed no differences in timestamping or sound.

Bottom line: Both Pianoteq 7 and 8 appear to processing MIDI Note Ons at the limit of MIDI 1.0 message transmission frequency.

Re: Keyboard sampling freq

brundlefly wrote:

Pianoteq pretty consistently time-stamped the 36 notes across a range of only 24 milliseconds with many notes on the same timestamp - call it 2/3 of a millisecond per message.

Probably the Cakewalk MIDI sequencer is using a trick in the MIDI protocol, called "Running Status":

"Only if only grade values are transferred in faster succession and instead of the explicit note-off command a note-on command with a dynamic value 0 is used, the transmission of the status bytes can be dispensed with (running status). However, the amount of data to be transmitted for this block only drops by 1/3."

"If a data byte comes instead of an expected status byte, the last status byte is considered repeated and the current data byte is one of its data (running status)."

(Google translate of https://de.wikipedia.org/wiki/MIDI )


Is cakewalk using note-on with velocity 0 instead of the usual note-off?

Re: Keyboard sampling freq

Yes, Cakewalk uses running status and actual Note Offs, but Note Off velocity is fixed at 0.

Re: Keyboard sampling freq

brundlefly wrote:

I did the same with Pianoteq 7 and observed no differences in timestamping or sound.

Bottom line: Both Pianoteq 7 and 8 appear to processing MIDI Note Ons at the limit of MIDI 1.0 message transmission frequency.

thank you!

I kinda guessed that.
The perception of these details on the sound depend on so many factors that we can easily dismiss if not used to these analyses...

Re: Keyboard sampling freq

brundlefly wrote:

Yes, Cakewalk uses running status and actual Note Offs, but Note Off velocity is fixed at 0.

Are you sure?
That should be impossible. The principle of "running status" is that real note-off status bytes are omitted. Just note-on status bytes are used and the end of a note is simulated by note-on with velocity 0.

Re: Keyboard sampling freq

... I installed midisnoop, that is showing "Running status" more clearly. MIDI source is an decades old korean keyboard with 49 keys and a 5-pin-DIN MIDI output, connected with an Edirol UM-1SX USB-MIDI-converter to my laptop.

Experiment was again to press 10 notes simultaneously (with the folding rule).
The first 10 events are the Note On events in a delta of 6ms.

Then I released the keys simultaneously and got 10 release events with Note On and Velocity 0. The time delta for all releases is 7 ms.

The "Running status" MIDI data reduction/compression of the keyboard controller had reduced the standard delta of 10 ms to 6-7 ms (a factor ~2/3).

Pianoteq interpretes the event 'Note On with Velocity 0' semantically as Note Off Velocity 0 in its event logger, which is ok in my opinion.

https://i.postimg.cc/QxSPQ6zx/Keyboard-with-Running-status-DIN-to-USB-MIDI-10-notes.png

Last edited by groovy (09-03-2023 19:36)

Re: Keyboard sampling freq

groovy wrote:
brundlefly wrote:

Yes, Cakewalk uses running status and actual Note Offs, but Note Off velocity is fixed at 0.

Are you sure?
That should be impossible. The principle of "running status" is that real note-off status bytes are omitted. Just note-on status bytes are used and the end of a note is simulated by note-on with velocity 0.

I believe that's a misinterpretation. The purpose of running status is to send a status byte only when the status changes, and it is not limited to Note On/Off messages, In fact it's arguably more important for transmitting Continuous Controller messages which tend to have a higher density than Note messages. So in my test there would be is a series of Note Ons that require no change in status after the first, then a change to Note Off followed by a series of additional Note Offs that require no status byte.

That said, however, I confirmed CW is sending Note On with velocity 0 and Pianoteq's monitor is reporting it as "Note Off".

In any case, My intent was primarily to show that both Pianoteq 7 and 8 are capturing note timings down to a resolution of 1ms, and neither is quantizing the closely-spaced notes of a chord to the same timestamp as suggested by the OP.

Last edited by brundlefly (10-03-2023 17:19)

Re: Keyboard sampling freq

Yes, of course Runnings Status is not limited to Note On/Off status bytes. I know that and just abbreviated and simplified it in one sentence for this thread about the polyphony of played MIDI notes.

When playing just MIDI notes on a keyboard one single Note-On status byte is sufficient to play eternally with the highest "compression" rate of ~2/3. Each additional Note-Off status byte would reduce that efficiency.

In the first post a Yamaha CLP-120 is mentioned. It seems to work like my Korean keyboard. The Yamaha cannot send Note-Off status bytes (8nH). It "only" sends Note-On status bytes with velocity 0 (9nH, v=0) and therefore probably is using Running Status:

Midi implementation chart CLP-120:
https://i.postimg.cc/P53Xbg6K/Yamaha-CLP-130-120-Velocity-MIDI-implementation-chart.png
(the 2nd column)

brundlefly wrote:

That said, however, I confirmed CW [Ann: Cakewalk] is sending Note On with velocity 0 and Pianoteq's monitor is reporting it as "Note Off".

... thinking over it, it also could be more than just unprecise reporting in Pianoteq's monitor.
It is possible Pianoteq rewrites the incoming Note-On-velocity-0 events to Note-Off-velocity-0 events, sends them to the soundengine and presents this new MIDI event in the logger.

What do you think?

Last edited by groovy (11-03-2023 00:16)

Re: Keyboard sampling freq

groovy wrote:

Each additional Note-Off status byte would reduce that efficiency.

Yes, but it's not "Impossible"  to use both Note Offs and running status. If you're going to implement Note Off velocity and still have the efficiency of running status, that's exactly what you would need to do.

... thinking over it, it also could be more than just unprecise reporting in Pianoteq's monitor.
It is possible Pianoteq rewrites the incoming Note-On-velocity-0 events to Note-Off-velocity-0 events, sends them to the soundengine and presents this new MIDI event in the logger.

What do you think?

From the standpoint of efficiency, I think it's more likely that the monitor works in parallel to render the MIDI input to text while the engine renders the raw MIDI to sound. Presenting Note Ons as Note Offs is probably just to the user in distinguishing "Off"s from Ons at a glance.

Re: Keyboard sampling freq

brundlefly wrote:

If you're going to implement Note Off velocity and still have the efficiency of running status, that's exactly what you would need to do.

... it just wouldn't make much sense in a played MIDI keyboard, because every released key then has to generate a Note Off Status Byte in the first place. And then the following running status just survives until the next Note On Status Byte arrives. The running status would be steadily interrupted and "decompressed" by new played keys. - But maybe somewhere in the world a keyboard exists, that is doing this hybrid method, who knows?
(the shown Yamaha and Goldstar don't)
 

From the standpoint of efficiency, I think it's more likely that the monitor works in parallel to render the MIDI input to text while the engine renders the raw MIDI to sound. Presenting Note Ons as Note Offs is probably just to the user in distinguishing "Off"s from Ons at a glance.

Yes, but a parallel logging and soundprocessing could also happen when the incoming MIDI event has been rewritten previously to real Note Off (and not just cosmetically) - Probably only Modartt knows the facts.

Re: Keyboard sampling freq

PS: Just found a strong indication, that the conversion of Note-On Vel 0 to Note-Off Vel 0 is just "cosmetical" in PTQ's  midi monitor. I recorded the incoming chords in Pianoteq, saved the MIDI file (*.mid) and found with a hex-editor just a single Status Byte (0x90) and no Note-Off Status Byte (0x80) using the little Goldstar keyboard.

With my other Korg keyboard both Note-On and Note-Off Status Bytes are in the recorded MIDI file.

If the data were rewritten to standard Note-Off events by Pianoteq, I would have expected to see that in the recorded MIDI data.

PPS: And strong indication, that the Korg B2 is using (like the most DP?) what I called "hybrid" running status just for illustration. Pressing and releasing a chord I saw a running status for the Note-On Status byte and a running status for the explicit Note-Off Status Byte in the recorded MIDI file. New hypothesis: All MIDI keyboards that send explicit Note-Off velocities are using running status

Last edited by groovy (11-03-2023 12:32)

Re: Keyboard sampling freq

groovy wrote:

PPS: And strong indication, that the Korg B2 is using (like the most DP?) what I called "hybrid" running status just for illustration. Pressing and releasing a chord I saw a running status for the Note-On Status byte and a running status for the explicit Note-Off Status Byte in the recorded MIDI file. New hypothesis: All MIDI keyboards that send explicit Note-Off velocities are using running status

What I was trying to convey earlier is that this is just garden-variety running status - a status byte is sent only when the status changes, and the implementation of running status is indpendent of whether Note Offs are used or not.

Re: Keyboard sampling freq

But a sender has not to use running status, the sender is free to use complete 3-byte Note messages -- or is it mandatory?

Just the receiver should always be able to handle incoming running status streams.

Two questions are open at the moment:

Why do I find just ~1 note event per 1 ms from the Korg in Pianoteq's logging, when the recorded and saved MIDI file of Pianoteq indicates that running status is used? (We would expect 1 note per 2/3 ms)

Is it possible that the data reduction (removing of redundant status bytes) takes place in the moment when the standard midi file is saved? (and not before?)

Last edited by groovy (11-03-2023 18:34)

Re: Keyboard sampling freq

Things clear up after looking into the USB data with wireshark and usbmon. The USB connection expands each note event to complete 3 byte messages (no 2 byte running status notes exist in the USB path). The acceleration happens earlier over the 5-pin serial line between Goldstar keyboard and USB-MIDI converter (running status compression).

When the 3 byte messages arrive at the PC and are saved to standard midi file format, they are saved in the data reduced form using the running status method already known.

Alsa tools like amidi and aseqdump show the expanded note messages how they arrive with the USB packets. Like Pianoteq the alsa tool aseqdump translates Note-On vel 0 to the term "Note Off" in the monitoring.   

Because the Korg B2 is directly connected via USB with the PC and complete 3 byte Note-On/Off messages are visible inside the USB frames, the Korg is probably not using running status internally.

Re: Keyboard sampling freq

groovy wrote:

Things clear up after looking into the USB data with wireshark and usbmon. The USB connection expands each note event to complete 3 byte messages (no 2 byte running status notes exist in the USB path). The acceleration happens earlier over the 5-pin serial line between Goldstar keyboard and USB-MIDI converter (running status compression).

When the 3 byte messages arrive at the PC and are saved to standard midi file format, they are saved in the data reduced form using the running status method already known.

Alsa tools like amidi and aseqdump show the expanded note messages how they arrive with the USB packets. Like Pianoteq the alsa tool aseqdump translates Note-On vel 0 to the term "Note Off" in the monitoring.   

Because the Korg B2 is directly connected via USB with the PC and complete 3 byte Note-On/Off messages are visible inside the USB frames, the Korg is probably not using running status internally.

Resonses in this thread on the MIDI Association forum seem to support that (i.e. running status is only used across DIN connections and USB interfaces restore the status byte if not present):

https://www.midi.org/forum/5262-running-status

But if the keyboard/controller is connected via 5-pin DIN too a standalone USD MIDI interface, you should (usually?) see that higher message frequency in real time.

Re: Keyboard sampling freq

brundlefly wrote:

But if the keyboard/controller is connected via 5-pin DIN too a standalone USD MIDI interface, you should (usually?) see that higher message frequency in real time.

Yes, that's what I have shown in post 38 of this thread:
https://forum.modartt.com/viewtopic.php...85#p988685

I could play 10 notes in just 6-7 ms with the Goldstar keyboard, that had its 5-pin DIN-MIDI connected via an Edirol USB-MIDI interface to the Pianoteq PC. That is better "realtime" behavior, than a directly USB connected keyboard to the same PC, which needed 10 ms for 10 notes (in other words 1 note per ms average).

Last edited by groovy (13-03-2023 20:06)