lichen-community-systems / flocking-midi

A collection of MIDI components for Infusion and Flocking
1 stars 2 forks source link

outgoing polyphonic aftertouch messages incorrectly use velocity instead of pressure. #10

Open the-t-in-rtf opened 5 years ago

the-t-in-rtf commented 5 years ago

Now that I have a device that supports polyphonic aftertouch, I discovered that while incoming polyphonic aftertouch messages correctly use "pressure", outgoing messages must use "velocity" so that the value survives its trip through flock.midi.write.note:

https://github.com/colinbdclark/Flocking/blob/master/src/web/midi.js#L613

colinbdclark commented 5 years ago

After a further conversation with @the-t-in-rtf, it sounds like the issue is that when we are trying to encode an outgoing polyphonic aftertouch message, Flocking's implementation erroneously reuses the writer function for note messages, which expect to read and encode a velocity property, which isn't appropriate for polyphonic aftertouch messages (which need to encode the pressure property).

Here's the implementation of flock.midi.write.note. To fix this issue, we should simply ensure that the line that @the-t-in-rtf provides above does not reuse the note writer, but instead makes a call directly to flock.midi.write.threeByteMessage.

@the-t-in-rtf, if you've got a fix for this, a PR here is fine and then eventually we'll start the work of forward-porting everything to flocking-midi (which hasn't been looked at in a couple years, needs to be de-Nodeified and then finished.