Pitch-Bend Control Wrong On Java MIDI Interface
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openjdk-8 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When using a Java MIDI interface to connect a MIDI keyboard to either the Java Sound Synthesizer, or to an external MIDI synthesizer (via a hardware MIDI interface), the pitch-bend MIDI message is two half-steps (one note) low (out-of-tune).
It appears that the data1 (least-significant byte), and data2 (most-significant byte) values are interpreted as a signed 14-bit number (whose mid-point is 0), rather than an unsigned 14-bit number whose mid-point is X'00', X'40' = X'0200', as specified in the MIDI spec.
This results in all further notes played being a whole-step too low, and the pitch-bend values within the range of the MIDI keyboard not being a smooth progression from low to high.
Here is information from the MIDI trace:
Input IDLE.
Input ACTIVE.
Forwarded MIDI = E0, 00, 40 (this message generated by the code to compensate for being out-of-tune)
Received MIDI = E0, 00, 00
Received MIDI-message: E0
Received MIDI = E0, 00, 01 (should have been E0, 00, 41)
Input ACTIVE.
Received MIDI-message: E0
Received MIDI = E0, 00, 02 (should have been E0, 00, 42), etc.
Received MIDI-message: E0
Received MIDI = E0, 00, 03
Received MIDI-message: E0
Received MIDI = E0, 00, 05 Input IDLE.
Input ACTIVE.
Forwarded MIDI = E0, 00, 40
Received MIDI = E0, 00, 00
Received MIDI-message: E0
Received MIDI = E0, 00, 01
Input ACTIVE.
Received MIDI-message: E0
Received MIDI = E0, 00, 02
Received MIDI-message: E0
Received MIDI = E0, 00, 03
Received MIDI-message: E0
Received MIDI = E0, 00, 05
Input ACTIVE.
Received MIDI-message: E0
Received MIDI = E0, 00, 04
Received MIDI-message: E0
Input ACTIVE.
Received MIDI = E0, 00, 03
Received MIDI-message: E0
Input ACTIVE.
Received MIDI = E0, 00, 02
Received MIDI-message: E0
Input ACTIVE.
Received MIDI = E0, 00, 01
Received MIDI-message: E0
Input IDLE.
Input ACTIVE.
Received MIDI = 90, 3C, 00
Received MIDI-message: 90
Input ACTIVE.
Received MIDI = 90, 3C, 53
Received MIDI-message: 90
Input IDLE.
Input ACTIVE.
Input ACTIVE.
Received MIDI-message: E0
Received MIDI = E0, 00, 04
Received MIDI-message: E0
Input ACTIVE.
Received MIDI = E0, 00, 03
Received MIDI-message: E0
Input ACTIVE.
Received MIDI = E0, 00, 02
Received MIDI-message: E0
Input ACTIVE.
Received MIDI = E0, 00, 01
Received MIDI-message: E0
Input IDLE.
Input ACTIVE.
Received MIDI = 90, 3C, 00
Received MIDI-message: 90
Input ACTIVE.
Received MIDI = 90, 3C, 53
Received MIDI-message: 90
Input IDLE.
Input ACTIVE.
This is different from how it works on Oracle Java 8, where the value for 'no pitch-bend' shows up as E0, 00, 40.
It is possible to send the proper pitch-bend values from a Java-implemented MIDI transmitter, but received pitch-bend values (coming in on an input MIDI interface) get transformed to an improper value.
This problem has probably been in-existence from the first release of open Java. I tested on an old system having Open Java 7, and the problem was there too.
Until I created 'wrapper code' for the Java Sound (Gervill) Synthesizer, I had no way to test this functionality.
My expectation is that Open Java will handle pitch-bend messages the same way as Oracle Java does.
I am using Lubuntu 17.10, but the problem also occurs on Lubuntu 16.04.4.
ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: openjdk-8-jre 8u151-b12-
ProcVersionSign
Uname: Linux 4.13.0-36-generic i686
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: i386
CurrentDesktop: LXDE
Date: Tue Mar 13 19:00:12 2018
InstallationDate: Installed on 2016-05-01 (681 days ago)
InstallationMedia: Lubuntu 16.04 LTS "Xenial Xerus" - Release i386 (20160420.1)
SourcePackage: openjdk-8
UpgradeStatus: Upgraded to artful on 2017-10-23 (141 days ago)
The attached JAR-file has online help (click the Help button) to explain how to use it. Unfortunately, Java cannot 'see' ALSA MIDI devices, so you have to use a hardware MIDI interface (such as a USB MIDI keyboard).
The code to compensate for the out-of-tune pitch-bend makes things worse, but you can see everything coming in from the MIDI keyboard traced (printed on the terminal).
I can supply a Java Web Start version of jSynth, if you would prefer that.