Gathering Aftertouch Data via my Arduino Mega (the Blue Board in the Back) |
Once the electronics generate a MIDI aftertouch message, it is conveyed to my Arduino Mega via the Arduino's built-in TX/RX serial connections. When the Arduino receives an aftertouch command, it induces pitch changes (vibrato) in the Polysix. The magnitude of the vibrato is proportional to data value in the aftertouch MIDI message. So, more key pressure generates a MIDI message with a bigger data value, which causes my system to put more vibrato on the pitch. Easy. But to be musically useful, the amount of vibrato needs to be controllable via the amount of force that I put on the keybed (not just ON or OFF), which means that the scaling between key force and vibrato response needs to be just right.
So, to get that scaling "just right", we need to get quantitative. I need to record the actual aftertouch values generated by my system as I press on the keys. Since I've got the Arduino in the system, I'm able to easily echo the MIDI aftertouch messages through the Arduino to my PC for logging and analysis. Below is a plot of the aftertouch data values logged by my PC for three key presses.
As you can see, the aftertouch values span 0-127, which the full range allowed in the 7-bit space afforded by aftertouch MIDI message. The next thing to notice how steep the curves are at the beginning and end of the each key press. Being very steep means that my vibrato comes on strongly and suddenly. My goal is to smooth that out so that I can have better control over more subtle amounts of aftertouch-induced vibrato.
My approach is to take the in-coming aftertouch value and to re-map it to a new value using my own aftertouch response curve. The new response curve will be shaped to reduce the slope of the onset of the aftertouch. Since I don't have the ability to set the response curve inside the keyscanning electronics (yet), I will have to implement the new response curve in the Arduino. Fine. But what response curve should I use? I don't know. We'll have to try some out.
Below is one of the first candidate curves that I tried. It is simply two linear segments stitched together. For small aftertouch values (like the onset), the slope is reduced so that the onset is more gentle. This sounds like what I want. The plot on the right shows the data from one of the key presses from the graph above. The blue curve is the raw data. The green curve is the re-mapped data. Note that, yes, the steep onset is reduced, but I don't like that flat plateau that follows the onset. That plateau will feel like a dead spot where nothing happens. That isn't good. Pressing harder should give a stronger response. This is a Fail.
As you can see, the aftertouch values span 0-127, which the full range allowed in the 7-bit space afforded by aftertouch MIDI message. The next thing to notice how steep the curves are at the beginning and end of the each key press. Being very steep means that my vibrato comes on strongly and suddenly. My goal is to smooth that out so that I can have better control over more subtle amounts of aftertouch-induced vibrato.
My approach is to take the in-coming aftertouch value and to re-map it to a new value using my own aftertouch response curve. The new response curve will be shaped to reduce the slope of the onset of the aftertouch. Since I don't have the ability to set the response curve inside the keyscanning electronics (yet), I will have to implement the new response curve in the Arduino. Fine. But what response curve should I use? I don't know. We'll have to try some out.
Below is one of the first candidate curves that I tried. It is simply two linear segments stitched together. For small aftertouch values (like the onset), the slope is reduced so that the onset is more gentle. This sounds like what I want. The plot on the right shows the data from one of the key presses from the graph above. The blue curve is the raw data. The green curve is the re-mapped data. Note that, yes, the steep onset is reduced, but I don't like that flat plateau that follows the onset. That plateau will feel like a dead spot where nothing happens. That isn't good. Pressing harder should give a stronger response. This is a Fail.
I then tried a whole bunch of other curves. Lots and lots. You can see many of them plotted together in the figure below. Some of them looked decent enough on paper to be worth trying on the Arduino. So, I coded them up as a simple look-up table and gave them a test drive.
To address this "problem", I'm thinking that there's probably a configuration setting in the keyscanning electronics that'll let me adjust the aftertouch threshold. The electronics are amazingly configurable and under continued development. I think that it's time for me to dive in and figure it out. Fun!
Next Step: Tuning the Portamento
Very detailed post, and thanks for the review on the Keyparts keybeds!
ReplyDeleteI'm also a fan of light aftertouch (I miss my CS-60) and wonder how well that keyscanner board can be adjusted for lighter touch. Do you have the manual for it or a link where to buy? Google and the Keyparts site don't yield much.
Hello Laurence,
DeleteThe Keyparts people are in the UK, so their web address is http://www.keyparts.co.uk.
Visiting them again, I see that they still have not released their keyboard controller for public sale. If you email them, and reference my post, maybe they'll let you sell you a "beta version" (like they did for me).
Their controller is a decent bit of kit. It's still working great in my Polysix.
Chip