mtytel / helm

Helm - a free polyphonic synth with lots of modulation
http://tytel.org/helm
GNU General Public License v3.0
2.36k stars 200 forks source link

Use channel pressure as aftertouch #170

Open jfrey-xx opened 6 years ago

jfrey-xx commented 6 years ago

Hello,

I have a M-Audio Code keyboard that can do aftertouch but not per key, as others might do. It sends one value for a whole channel, and this information is not taken into account in Helm. It seems to relate to #20 and #77.

After a bit of digging, JUCE differentiates aftertouch from "channel pressure", which my keyboard does. Here is a proposal for helm to read them both. The patch is not ideal because it would be probably better to add another modulation in the GUI, dedicated to channel pressure. I did not dare modifying the interface, however it should be trivial (except for the screen space) to add a "pressure" modulation; I tried to keep setAftertouch() separated from setPressure() as long as possible in the code.

I changed the init value of aftertouch from "velocity" -- unnecessary and even odd in my case -- to "0" (as aftertouch occurs after the key is pressed).

I changed some code within mopo, I guess it should be backported.

The code might become a bit cumbersome around the arpeggiator because I created separate structures to hold info about channel and pressure. Note that with these commits the aftertouch data is finally passed to the arpeggiator, which did not seem to be the case before (i.e. the aftertouch would not have any effect with the arpeggiator enabled). In the future I guess there should be a proper structure to hold all the info about a note / channel, that would help for example with #158.

Working on Linux (Ubuntu x64 16.04), with the standalone version as well as with the LV2 and VST plugins (using Ardour 5.11), although I did not test how everything holds when various channels are involved.

Thanks for this great piece of software, I am a total beginner when it comes to music, and beside the nice sounds that Helm can produce, it is a very neat tool to play with and learn how synthesizer works. It is because I found nothing as good as Helm so far that I was particularly frustrated not to be able to use all functionalities of my keyboard. Hope that this patch can help :)

jfrey-xx commented 6 years ago

Hello,

Don't hesitate to ask if I can help to integrate that faster. And don't hesitate to comment if you think that I did it wrong ;)

kjyv commented 6 years ago

I've tried it and it seems to work fine with my channel pressure keyboard (after a minor fix). Don't know if it also works properly when used with a polyphonic aftertouch capable keyboard though.

The change I made was in voice_handler.cpp:347 and arpeggiator.cpp:211 MOPO_ASSERT(channel >= 0 && channel <= mopo::NUM_MIDI_CHANNELS); (channel can be 0, so channel >= 1 failed)

jfrey-xx commented 6 years ago

I wonder as well how it would go with polyphonic aftertouch, I'd say that the channel aftertouch would "take over", but I don't have a device to test -- I'd love to, though. Updated my fork, thanks for your feedback :)

mtytel commented 6 years ago

Thanks for doing this! I'll set aside some time to look at it tomorrow.

f3flight commented 5 years ago

Hey guys, is this still not in implemented? I see https://github.com/mtytel/helm/commit/756e767e4d20e77836f45b4ba016ea547d7cf474 in master but that seems to be just a small portion of changes proposed here... I have a LinnStrument and really want channel pressure working... edit: tested @kjyv 's repo, it works there. The only thing missing is making all presets use this by default or via some easy switch, as it's not convenient to set it up every time a preset is changed, esp. because it's relative to current value, i.e. I have to first move volume to 0 and then assign both velocity and aftertouch to volume with a value of 1 (or less or more). Similar problem with bend range. Maybe add override button(s) for this in settings, not sure... And of course merging with this @mtytel 's repo.

saphtea commented 5 years ago

Hey guys! I just started using Helm and am enamored by how you handle keyboard based modulation, but aftertouch is a huge missing key for me right now as mine also does all channel aftertouch. Hoping to see this merged through, really loving the software so far it's making it incredibly easy and powerful to make responsive and dynamic instruments, I think aftertouch would be the icing on top to this. Anyways, LGTM, hoping to see it in a new build soon!

zeknife commented 3 years ago

Need this