How to change Midi CC to aftertouch in midi machine

I don’t want to use the aftertouch option (using velocity) but use an expression-pedal to control aftertouch in an addressed synth.
In some DAWs I can do that with a midi-transformer but not in all. So I would like to do that in MidiGuitar to be independent from DAWs or standalone-synth.

I did this so far but no result:
function OnNote(channel, pitch, velocity)
– for any note played, send out the exact same note
Note(channel, pitch, velocity)
end

function OnControl(channel, cc, value)
– Control(2, 20, value) --this works when I move the expression pedal
AfterTouch(channel, 60, value) --this does not send out aftertouch when I move the expression pedal
end

function OnFrame(notes)
end

function OnStart(info)
– assign a description to be displayed in the header
info.description = “transforms midi CC to aftertouch”
end

you may need to swtich the aftertouch on in the interface. and block this original aftertouch…

The idea is to convert cc to aftertouch.
The aftertouch option in the interface converts velocity to aftertouch as I understand it.
There is a midi-machine example of converting aftertouch to cc, so I thought it would be possible the other way around.
But I seems not to work the way I scripted it. I also tried with enabled aftertouch option in the interface.
I thought if I send AfterTouch(channel, 60, value) I would just do that.

it kind of works this way with pitchbend, so I thought maybe would this also work with aftertouch. I have indeed never wanted to convert from cc to aftertouch ( I actually added the aftertouch2cc at the time)
Maybe try to echo the existing OnAftertouch data first, and try mod that. I never tested the aftertouch() function…

I think it could be a good feature.
I played around with Arturia Analog Lab V presets. A lot of them have cool aftertouch settings.
To have this controlled with MG2/aftertouch = velocity is confusing as there are also parameters assigned to velocity on those presets.
Therefore to have a pedal sending CC11 being converted to aftertouch would separate velocity from aftertouch.
The aftertouch() is mentioned in the “Demo Script.lua” so I guess it is supported.
Thanks for your reply.

I found this page:
https://www.jamorigin.com/products/midi-machine/
Here it says that the aftertouch functions are not implemented yet.
Is this still true?
Why is it in the “Demo Script.lua” ?

I dont know, I made that demo script spontaneously, I never checked the function aftertouch() because nobody asked for it at that time. I was workign for JO at that time, I quit in oktober 2020. The midi-machine web page was never complete (and I wasnt the web editor), so I auctually didnt look there at all.

  • enable aftertouch in MG
  • make sure your controller sends on the CC channel

-- COPYFROMHERE
--
--  CC2AFTERTOUCH
--
--
-- Paul D 2023


-- our global stack:
CC=15
touch=0

function OnNote(channel, pitch, velocity)
	Note(channel, pitch, velocity)   -- alters every incomcing note message
end

function OnBend(channel, pitch, bend)
	Bend(channel, pitch, bend)       -- alters every incoming bend message     
end

function OnControl(channel, cc, value)
    if(CC==cc) then
       touch = value   -- store cc value
    end
	Control(channel, cc, value)     
end

function OnAfterTouch(channel, pitch, velocity)
  AfterTouch(channel, pitch, touch) -- swap actual aftertouch value with CC value..
end


function OnFrame(notes)
end


function OnStart(info)
	info.description = "CC TO AFTERTOUCH"
	info.link = "https://jamosapien.com/t/how-to-change-midi-cc-to-aftertouch-in-midi-machine/5118/8"
    Knob("CC", 0, 1, 127, 1)                      
end

--COPYSTOP
1 Like

Hi Paul,

Thank you for thinking about this thread.
It is not working here. Just sending out the incoming CC.
I can’t see when and how the OnAftertouch() should be called.
There is no aftertouch received but Control.
I had tried before seeing your solution for the sostenuto to do the same in OnFrame but couldn’t get it working.

aftertouch in mg should be switched on, then the normal OnAftertouch is called. But the AfterTcuch() there uses the value the CC controller provided (touch)
The AfterTouch is only send when a note is sounding! It can not be send without the note known upon which it should act.

1 Like

Aah. I get it. Works now.
Thank you.

The AfterTouch looks like Poly-Pressure(aftertouch) because of the pitch-value. Some Synth only understand Channel-Pressure. Is there also a possibility to send channel-pressure?

1 Like

well, it IS poly aftertouch here… :wink:
there is currently no way to generate channel pressure in MG

1 Like