How to create a midi map controller for custom hihat handler

hi, i need if possible a starting point advice, i wanna create a plugin/or a midi map controller in ardour.
what i would like to achieve is to map my roland td12 hihat.
because of some reason my module only point out a note(cc4) for express pedal range(open/closed value), and same 2 notes for bow and rim hitted.

so i would like to program something that will store the cc value and based on that, change the next note midi captured. for example if cc note value is <= 20 if the next note are d# (hihat bow) transpose it to → a# (closed hihat sound) else transpose it to f#(open hihat)

its just an example but should explain well what i want to do.

Are someone knwo wherei should start with? i mean, some midi code examples stuff and, where in ardour i can link the script file in order to make my midi track use it?
i would prefer to create a plugin like the → midiMonitor(Lua) to attach before my drums VST sound that will handle midi transposion

than you.


You should give a look at the script I made for my roland td4k which probably does what you are searching for.
It has been designed to go with MTPowerDrum kit but it can work with any other plugin since it’s just transposing notes. And it’s configurable so you may be able to change it to set it to your needs.
At least you’ll be able to use it as a starting base to make your own lua script.

Its here


oh! thank you! really! im exited to see what it does.! you are a life saver!!!

Glad it can help! :smiley:
Tell me if it suits your needs!

unfortunally out of the blue it didnt work for me.
im noticing the hihat CC note seems to not affect the transposing note.
the output cc(channel 4) note is 90 so should be closed, but the output note is alwais A#2 (the open HH note)
not sure what it is happening. but having the code i will surley figure it out.

im setting closed thrashold to 95(my max cc note for closed hihat) and 0 for open

again thank you

Hi !
That pretty strange… Did you try to change the default values directly in the code instead of changing from the GUI ?
Maybe you could send me a small Ardour session with two simple recordings inside : one with open hihat and strokes on the hihat and another one with closed hihat and strokes on the hihat… I may be able to give a look at what’s happening ?


hi! unfortunally adding directly inside code all the transposing note instead using the gui didn’t work.

seems that the plugin is not working at all, because the note midi output from my module is a#(open note)
then the note output by controller is still a#.

i tried change for every notes inside the source code giving the closed hihat var so just to see if the plugin is working.
what i was expecting was to see closed hihat note instead of a# (open) for every hit, but no. still only a# is the final output.

i dont know how to print() log message to see what’s happening and check midi events to see where the code is braking.
so its kinda difficult to debug it.

recording a session it will give you only the final note,
not the original midi event, the one that plugin is interpreting no? am i wrong? (if not i will record and pass it to you )

below a screen where i close hihat and given a hit.
the note from td12 was g#2 (pedal note),then a#2 the hit hihat note.
after the td hihat midimap you can see evry hit only a#2 note is being played.
so i am guessing something not working in the code.

again thank you


Based on what I see from your screenshot I think you should set the hihat closed threshold to 85 so that when you push the hihat pedal (gives CC 4 to 90) the plugin will correctly interpret it as pedal closed (threshold reached since 90 is bigger than 85).
I think that you may not be hitting the rim of the hihat which is causing the roland kit to output an A#2 instead of a D1. If the kit is outputing an A#2 when you hit the rim of the hihat then you should set the “Roland hihat note” to A#2 in the plugin.

About the recording, Ardour records the raw data coming from the kit since for example you can remove the roland plugin and put another one in place or maybe want to insert one before the roland plugin.
So if you record something, one would be able to see whats coming out of the td12.

But well for now since you inserted the midi note plugin it allows me to see what’s happening.

So try what I advised above and tell me!

thank you so much that is worked, i had to setup threshold as you said, and 20 for open hi hat to fit td12 default spec,
plus vh11 hihat has bow and rim note for hihat. so i changed the bow from a#2 to d1 and now its working!

just for couriousity, if i wanted to print on console LUA code (print(“bla bla”)) in ardour. is that complicated?
i wanted to see what was happening in some part of the code so that i can study it a bit.

is that complicated to configure?

Great !

I’m not sure that it’s possible to print to console from a DSP Lua script…
In the Lua samples, I did not find any such script printing stuff to the console except this one.

I also tried to add a print function inside my Lua code but did not find where it would print…
It’s a question for one of the devs… @x42 ? Could you help us on that ?

Cheers !

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.