Monophonic Aftertouch....



  • Well this looks like it's not on the top of christoph's list of things to fix (it's been broken a fairly long time now) so can anyone point me at the place in the source that (attempts to) handles Aftertouch?

    I will apply my vanishingly small C++ skills and break everything in an attempt to fix it...



  • I'm guessing ControlModulator.cpp line 226 - I use Atom to search for any references to "After Touch" and this one seems the most relevant but there are plenty of others.



  • @d-healey thanks - I'll take a look..."I'm just going outside, I may be some time..."



  • Ok well...

    	const bool isAftertouch = controllerNumber == 128 && (m.isAftertouch() || m.isChannelPressure());
    
    	const bool isPitchWheel = controllerNumber == 129 && m.isPitchWheel();
    

    ....isnt this the wrong way round?

    Controller number 129 == Aftertouch doesn't it?
    and
    Controller number 128 == PitchWheel

    ..surely it cant be that simple?



  • @Lindon No idea, I thought the MIDI standard only went up to 127...



  • JUCE has an isAftertouch() function, perhaps that will be useful - https://docs.juce.com/master/classMidiMessage.html#a08acde3017ba958b404f1b5e191c88e6



  • @d-healey said in Monophonic Aftertouch....:

    @Lindon No idea, I thought the MIDI standard only went up to 127...

    nope it goes beyond that 128 and 129 at least are "usually" defined as Pitch Wheel and Mono afterTouch respectively...



  • @d-healey said in Monophonic Aftertouch....:

    JUCE has an isAftertouch() function, perhaps that will be useful - https://docs.juce.com/master/classMidiMessage.html#a08acde3017ba958b404f1b5e191c88e6

    • yep I can see where Christoph has used these calls but in the code itself the bool logic looks wrong.. I think he's checking that the CC Message Number = 128 and then attempting to do the afterTouch processing if this is true - which is wrong I think, it should check if cc# = 129....


  • @Christoph-Hart - am I on the right track with this?

    • if so it seems a bit of an imposition(on you) to have me jump through the git push/pull authorisation process for this very very small change... more than willing to give it a go... but I will need hand holding a bit...


  • David is the master of this process, but I think you just need to fork HISE, make your changes and then create a pull request that I have to accept.

    But before you do so, you also need to sign that contract:

    http://hise.audio/download/HISE_CLA.pdf

    It's a common procedure in open source software, but it's required so that the dual licensing of HISE isn't jeopardized - it basically just transfers the right of use of your contributions to me and is as unintrusive as possible.



  • @Christoph-Hart - ok cool that looks simple enough...



  • @Lindon - well it looked too good to be true - and it was...
    so I:

    forked the latest MASTER

    • changed the code I thought needed changing in ControlModulator.cpp

    to this:

            const bool isAftertouch = controllerNumber == 129 && (m.isAftertouch() || m.isChannelPressure());
    
    	const bool isPitchWheel = controllerNumber == 128 && m.isPitchWheel();
    
    	if(isAftertouch || m.isControllerOfType(controllerNumber) || isPitchWheel)
    	{
    		if (m.isController())
    		{
    			inputValue = (float)m.getControllerValue() / 127.0f;
    		}
    		else if (controllerNumber == 128 && m.isPitchWheel())
    		{
    			inputValue = (float)m.getPitchWheelValue() / 16383.0f;
    		}
    		else if (m.isChannelPressure())
    		{
    			inputValue = (float)m.getChannelPressureValue() / 127.0f;
    		}
    		else if (m.isAftertouch())
    		{
    			const int noteNumber = m.getNoteNumber();
    
    			polyValues[noteNumber] = (float)m.getAfterTouchValue() / 127.0f;
    
    			inputValue = FloatVectorOperations::findMaximum(polyValues, 128);
    
    			jassert(inputValue != -1.0f);
    
    			if (inputValue < 0.0f) inputValue = 0.0f;
    
    		}
    		else
    		{
    			jassertfalse;
    		}
    
    		inputValue = CONSTRAIN_TO_0_1(inputValue);
    		
    		float value;
    
    		if(useTable) value = table->getInterpolatedValue(inputValue * (float)SAMPLE_LOOKUP_TABLE_SIZE);
    		else value = inputValue;
    
    		if(inverted) value = 1.0f - value;
    
    		targetValue = value;
    	}
    
    • basically just setting the midi controller numbers to their correct values in the boolean or statements at the top...

    Sadly this makes no difference and I dont know how to get it to provide me with debugging information - the HISE debug build crashes out with errors...and even if it didnt I wouldnt know what to add in that was the same as Console.print("something") and I wouldnt know where to look even if I did...

    So anyone got any clues, or is this back to @Christoph ?

    It occurs to me that i should remove any possibility that its my hardware doing this (an Arturia KeyLab) so can anyone else please run this wildly simple snippet:

    HiseSnippet 677.3ocsUs0aSCCE1tqdhVtHFhe.Q6oVwnJE1FH1CLVufpftUQFS71jmiaq0RribbFTg3+L+CfiSxVZGYSaQh7PUOmy2mymO2xDshwiiUZDtwwKh3H7iHdKjl48lSERzn9H7SHiowFt1Iy0AKhnwwbeDFu1GsNvMpiRe986OfFPkLdgKD5Dkfw+rHTXJ7NY+OIBBFR84GKBWB816Ohoj8TApDPOqQbQQT14zY7CoVX0HH75C7EFk1yPM7X.yAJ+EdyUeWlg+DQr3r.t0nKxCNnL2ndyEA9St7tFiP35SJt4qkcyeNYrvWbk+hLvSSC3TvX4b.t1pRp9JRp6MIogp.e6AbCxCuj7pmIuMHdLsHxTDwpsGRFIghyTJj1WVVYXQ0dFlzSAHjlNgzy4C0fwULZsqq6VN6351duoIRlQnjNJ4gJC+HYq1M+YyFM+USmqGZ5zRiYeMZUP.WmEFriUA7NQZgzzZLHYnR1YF2T.7vjvyrvcdgyluaS32RQcBMHg2pc68t1Kz17nuMozRld9a4bg8DtBHjQWsjs9cqjwxxiKATIGIElih341EE0tkTTQ4EB3eecTepgZqy49.bQbsQXkCtO+BXnIqp2fzmGetQEAiM+SKAzXp7SBnlU6Vsik4Af7wJsE1RuLVXVr7X68nE1szV3Rus2Q4tAYhvvlWtdqUhdgr1+a8luP3wjASmxYlBwVmL7aUc5+dHkunRLB4rwTiV7CDl.yIdvNQFGThTxCfWDAWy1QkY6ZssYFOtzO03OvSdvtVabdvtWFDERYZ0orrIE6JmGj5AzjLcaaCXsOX6zEkN8.7HtcbQgvlvSYLap3kf1Kmyqp.mWWANaWAN6TAN6VANuoBbd6sxw9QnOjXTgYiIfiICRWifwCjTnKKsiD8Wjb0bzI
    

    you should see the controller number and the reported value showing up in the console...where for me it shows

    129:<the midi note velocity>


Log in to reply
 

10
Online

1.3k
Users

4.2k
Topics

38.3k
Posts