Quantcast

A rather nasty bug in the MPL customizer

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

A rather nasty bug in the MPL customizer

Julie Porter

I have my script working rather well, that takes a pipe organ definition (Emutek or Uniflex) and creates a jOrgan model.

The Arduino translates the pin numbers into MIDI events.   This translation is also done in the script.

Keyboards can be mapped to any midi start note.  Typically this note is transposed to C.   I have a demo unit that starts on F.


Typically Keyboards will start on pin 1 which is MIDI note 1.   There are usually 128 pins on a given input board.  A second keyboard might start on pin 65. 

here is the MPL that is generated by my script
     <messages>
       <keyboard-pressKey>equal 145, sub 28 | lessEqual 97 | greaterEqual 36 | get pitch, greater 0 | get velocity</keyboard-pressKey>
       <keyboard-releaseKey>equal 145, sub 28 | lessEqual 97 | greaterEqual 36 | get pitch, equal 0</keyboard-releaseKey>
       <keyboard-releaseKey>equal 129, sub 28 | lessEqual 97 | greaterEqual 36 | get pitch, </keyboard-releaseKey>
     </messages>

If the customiser is run and the Finish button pressed then the MPL (after the save) but the effect is immediate on the exit of the customiser.  The MPL  is changed to this:
     <messages>
        <keyboard-pressKey>equal 145, lessEqual 97 | greaterEqual 36 | sub 28 | get pitch, greater 0 | get velocity</keyboard-pressKey>
        <keyboard-releaseKey>equal 145, lessEqual 97 | greaterEqual 36 | sub 28 | get pitch, equal 0</keyboard-releaseKey>
        <keyboard-releaseKey>equal 129, lessEqual 97 | greaterEqual 36 | sub 28 | get pitch, </keyboard-releaseKey>
      </messages>



The problem is that the transpose has to be done before the range check, for the MIDI mapping to display the range on the screen.  If it is done the other way round then the MIDI input is out of range and  bad things happen when someone is playing the console.


Not sure if much can be done about this as there is no one maintaining the code.    The work around was to add the Gain (which is the only useful customization) to the script, then rebuild the organ disposition.   This also makes it difficult to change on the fly any MIDI messages, or use the ability to ring in additional MIDI events.
















------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
jOrgan-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jorgan-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A rather nasty bug in the MPL customizer

Aaron Laws
Jonathan is the new maintainer I think, perhaps he'll get back to us soon?

I don't know MPL. I see that jorgan parses its own MPL in jorgan-core/src/main/java/jorgan/midi/mpl. I don't understand the sentence "If the customser is run...":

So you're doing "File" > "Customize..." then clicking "Finish" (without changing anything), and the MPL is changed as you describe?

If I'm doing the diff properly, it looks like it's taking out your "sub 28" statements. I take it that "sub" adds a value to the key value? So if 2 is passed in, sub 28 makes the result "30"?

I should be able to reproduce this issue by making one of my dispositions' <keyboard-pressKey> elements like yours, then customizing and clicking "Finish"?

In Christ,
Aaron Laws

On Thu, Apr 27, 2017 at 5:27 AM, Julie Porter <[hidden email]> wrote:

I have my script working rather well, that takes a pipe organ definition (Emutek or Uniflex) and creates a jOrgan model.

The Arduino translates the pin numbers into MIDI events.   This translation is also done in the script.

Keyboards can be mapped to any midi start note.  Typically this note is transposed to C.   I have a demo unit that starts on F.


Typically Keyboards will start on pin 1 which is MIDI note 1.   There are usually 128 pins on a given input board.  A second keyboard might start on pin 65. 

here is the MPL that is generated by my script
     <messages>
       <keyboard-pressKey>equal 145, sub 28 | lessEqual 97 | greaterEqual 36 | get pitch, greater 0 | get velocity</keyboard-pressKey>
       <keyboard-releaseKey>equal 145, sub 28 | lessEqual 97 | greaterEqual 36 | get pitch, equal 0</keyboard-releaseKey>
       <keyboard-releaseKey>equal 129, sub 28 | lessEqual 97 | greaterEqual 36 | get pitch, </keyboard-releaseKey>
     </messages>

If the customiser is run and the Finish button pressed then the MPL (after the save) but the effect is immediate on the exit of the customiser.  The MPL  is changed to this:
     <messages>
        <keyboard-pressKey>equal 145, lessEqual 97 | greaterEqual 36 | sub 28 | get pitch, greater 0 | get velocity</keyboard-pressKey>
        <keyboard-releaseKey>equal 145, lessEqual 97 | greaterEqual 36 | sub 28 | get pitch, equal 0</keyboard-releaseKey>
        <keyboard-releaseKey>equal 129, lessEqual 97 | greaterEqual 36 | sub 28 | get pitch, </keyboard-releaseKey>
      </messages>



The problem is that the transpose has to be done before the range check, for the MIDI mapping to display the range on the screen.  If it is done the other way round then the MIDI input is out of range and  bad things happen when someone is playing the console.


Not sure if much can be done about this as there is no one maintaining the code.    The work around was to add the Gain (which is the only useful customization) to the script, then rebuild the organ disposition.   This also makes it difficult to change on the fly any MIDI messages, or use the ability to ring in additional MIDI events.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
jOrgan-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jorgan-user



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
jOrgan-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jorgan-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A rather nasty bug in the MPL customizer

Julie Porter
In reply to this post by Julie Porter
>So you're doing "File" > "Customize..." then clicking "Finish" (without
changing anything), and the MPL is changed as you describe?

Yes that is what is happening.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
jOrgan-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jorgan-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A rather nasty bug in the MPL customizer

Aaron Laws
On Thu, Apr 27, 2017 at 6:56 PM, Julie Porter <[hidden email]> wrote:
>So you're doing "File" > "Customize..." then clicking "Finish" (without
changing anything), and the MPL is changed as you describe?

Yes that is what is happening.


I found the code that is responsible for changing this.

public void setPitch(int from, int to, int transpose) {

List<Command> commands = new ArrayList<Command>();

if (to < 127) {
commands.add(new LessEqual(to));
}
if (from > 0) {
commands.add(new GreaterEqual(from));
}
if (transpose < 0) {
commands.add(new Sub(-transpose));
} else if (transpose > 0) {
commands.add(new Add(transpose));
}

commands.add(new Get(KeyMessage.PITCH));

for (KeyMessage message : getMessages(KeyMessage.class)) {
if (message.getLength() > Message.DATA1) {
changeMessage(
message,
message.getTuple().set(Message.DATA1,
new Chain(commands)));
}
}
}

The call stack is:

Keyboard(Element).changeMessage(Message, Tuple) line: 527
Keyboard.setPitch(int, int, int) line: 208
KeyboardPanel.apply() line: 150
KeyboardsCustomizer.apply() line: 81
CustomizeWizard$1$1.run() line: 102

Here's what's going on: When you press "Finish" on the wizard, it applies all the keyboard customizations. One of the applications applies the "to", "from", and "transpose" values to the keyboard in Keyboard::setPitch.

Are you suggesting that the "if (transpose < 0) ..." should be above the "from" and "to" command additions? Is this a bug, or should there be an option to apply transposition before or after the "from" and "to" checks?

In Christ,
Aaron Laws

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
jOrgan-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jorgan-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A rather nasty bug in the MPL customizer

Julie Porter
In reply to this post by Julie Porter
> Are you suggesting that the "if (transpose < 0) ..." should be above the
> "from" and "to" command additions? Is this a bug, or should there be an
> option to apply transposition before or after the "from" and "to" checks?

All I am saying is that the program should not change the existing disposition values if the user does not want them changed.  That changing nothing, or changing the gain on a different window tab (page) should not arbitrarily change unrelated values.

As far as the behavior of the keyboard section, I am unsure as to what the correct behavior should be.  My script will add positive or negative transposition to the pin number in order to set the MIDI note pitch for low C.

Perhaps the best solution would be the user option check box.    It may be that a transposing MIDI keyboard might need it the other way round,




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
jOrgan-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jorgan-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A rather nasty bug in the MPL customizer

Aaron Laws
On Fri, Apr 28, 2017 at 3:53 PM, Julie Porter <[hidden email]> wrote:
> Are you suggesting that the "if (transpose < 0) ..." should be above the
> "from" and "to" command additions? Is this a bug, or should there be an
> option to apply transposition before or after the "from" and "to" checks?

All I am saying is that the program should not change the existing disposition values if the user does not want them changed.  That changing nothing, or changing the gain on a different window tab (page) should not arbitrarily change unrelated values.

Although it seems simple, it's a very complicated thing to do what you suggest here. Based on what I see in the code, if you enter the Customizer Wizard, you're asking jorgan to rewrite parts of your disposition. Currently, jorgan has no support for noticing that the user didn't touch certain parts of the wizard (so that it won't rewrite those parts of the disposition).

As far as the behavior of the keyboard section, I am unsure as to what the correct behavior should be.  My script will add positive or negative transposition to the pin number in order to set the MIDI note pitch for low C.

Perhaps the best solution would be the user option check box.    It may be that a transposing MIDI keyboard might need it the other way round,

I wonder if the normal way to solve this is to change your original definition (the output of your script) from:

equal 145, sub 28 | lessEqual 97 | greaterEqual 36 | get pitch, greater 0 | get velocity

to

equal 145, lessEqual 69 | greaterEqual 8 | sub 28 | get pitch, greater 0 | get velocity

? Again, I don't know MPL...is this equivalent? If you started with this, then perhaps jorgan wouldn't munch up your MPL?

In Christ,
Aaron Laws
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
jOrgan-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jorgan-user
Loading...