Drum Mapping- user defined
-
I would like to implement drum mapping for the drum HISE instrument I am building.
The idea is to allow a user to specify which MIDI note each drum component should correspond to. So, if my kick drum defaults to C1 and a user selects C0 from a combobox, then pressing C0 on a midi controller should trigger the kick drum sound. Sample assignment doesn't change, but only which midi input note corresponds to which midi output note.
Has anyone done anything like this? How do I do this? A HISE snippet you could share perhaps, please?
Thank you!
-
This should point you in the right direction...
HiseSnippet 813.3ocsU00aZCCE0gRlFYioUo8Cv6MPpEBc.cRUUqs7wDZkVznqZuU453.VMXG43zNzT+Ou+AaWmDJPaEClzxCHtebrO95645AJIkEEIUHqBWLMjgrds8voB83ViIbApWaj0ar6ShzLEN00ISCIQQLOjk0Ve13vpPdTx2u9zIj.hfxl6BgtTxorS4S354dGbzW3AAcIdrK3SVH65G0iJEsjAxXfOaY6hBIzaHiXmQLokyFY8hNdbsTMTSzrHjU9SjdSGNVdmHM+K4Q7qCXFiZngvBk5tqLvyvXiWTqw7.uAyN2QHXUFLuJrUZU3c184d7G7OuZ71j.34HVrdXkaUzq1emdtOG8rVfd4So211CoJdnddDC2dkcOAbQ4SfqfEoUZtnbUyY2RBYHzUlPtg0UAFOfnTSW2cvMbcKePQmhNvEQjFeKQgmPBwGh6HFwErJTECNZlRvo7HcozbqV8XOOLQH0ig1j.HOruTgYD5XL3jgmJiw2QDZrVhULXAK5.+TIhoujDDyJUuwN3lvFiqVsmHLVik935MfcUFqyLa59HLM.1t+dKiog6RX1eO+XAUykBrTbFPjyEkJ67yhNX3qOT2fVqJ7QBoh04VnpTRqhYlijItSAtOtjYKGMaKmAAbXVsyhmbMSUpbY76ODuasxo3xV9E2hnkxesVxxGjrJ26buyiOC99lCgSgkCYtXUxf.C5mF0nyTq.VIQxFuCbgCrZVdP61x8yuX85mooMYKjnTzSv0mGxxrWsfDk0kB+6a8ZSzDiHHyGjWHSo4F5X0lcKLcIURTvtMK5FsLDlu7D8BnZkdwAD8xRYy7qr.P4XIMiQWHh35oKNeaCz2tq83m0ktaaOfqoied9l6Y3KT09ey2rokEs636yn54jMuc2u+uNZbCnxWAwNWLpOQq3+.YYC5mgviGTFvDgfE.ajsUNSGUpsqw1TYFxDdIF+F9xBVyXakEr1rfnIDpRdEMUnXlG+xDO.mDIOKU.deDrw0PIhmTdOAlPdEkZJD6BL+4Qr2Fi3CaLh5aLhFaLhlaLh82XDebEHLOGcbrVNIUV.NFzIYrgkUGAA5pR5.Q+A+yFGd
-
@d-healey Thank you very much! Let me see if I'll able to wrap my mind around it
-
@d-healey Working on a similar situation. I'm currently hitting C1 and can get the sound from C2. However it doesn't trigger that output in Midi. Example when I compile and run my vst the C2 notes aren't getting recorded. Here is my snippet. ```
HiseSnippet 3766.3oc6c0zababFlqsYhWUqz3fTfhfVjoJoFRMtJ76kabS7Zs1xQNV1azp3lhhTapcmcWBykjgjqjUbEpaQRCZ6gzq9l+Izis2L5oVfbnWZOmdon.8Rt1SsyvOVNjKoVtTKcTRnBhr4vYd3y77Ny67xYFNtkkQGnssgEUkpauuIjpxYnauutyflCTT0o13xTUNK85auI3xViFZ6nXAjYnVaeSEaaXWpJUN4UwYqR0SQ49ymew0TzTz6.CShh5VFpcfWWcnpSXpsZ7VpZZqqzEts5PhbKzXiNF5MMzLFgnzIoYnLU5bWk9vanfy1Inop7TWoqpigUaGEGnMUkSslQ28aOvXOcu7eKUa0czf3KXoZi.xK40Mz5hYLNUplCT051JnpaSQU4zsBEhS5IDOO8lpcUGmdnf7rt2.DVBR8nxINL5wRROlrSuJDz6Tdz6rzs6XoZ5DdGL29Fzan6.s5ofLAjzxKuTm3uJP2z.kCcmUGpbW35VnKFWhkYYXXNOPjgYkKr3B3+6UeUPanCXCcaGj8GUJzkZvNNfaonMBt3BVv9fNirrP2w6FaYrG30ALWvuv+zq09l2.rohM5IbKCMDDu2hKDP.aHl7lPKGUnMhICwYd4kFRj6kNO39Kt..rjkRWUiqZYLxboWCrDyRm2M06guPhy+p8wWwxvszhKbfWE.0Tx1ArKpUKInHBFPg9PmlFCMMzQWD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debug without knowing the code. Write a simple example that has the minimal amount of code and widgets to demonstrate the problem. Also, post snippets in code tags :)
-
I wasn't able to get it working when I tried last time around.
-
Sorry David I thought I had it in code brackets
Broke it down.
All the code works and triggers the sound from the other note. However I can't get note 36 that I'm hitting on the keyboard to print note 48 when recording.oninit //Play Button 1 inline function onplayButton1Control(component, value) { if (currentSelectRow == 1){ Synth.playNote(48, 127); }; // Setting the callback for the Play Buttons. Content.getComponent("playButton1").setControlCallback(onplayButton1Control); function onNoteOn() { if (Message.getNoteNumber() >= 36 && Message.getNoteNumber() <= 44 ){ Synth.playNote((Message.getNoteNumber() + (currentSelectRow * 12)), 127); } }
-
@jssrecording When you say
print note 48
- what do you mean? The only reference I see to note 48 is in your button callback which isn't linked toonNoteOn
as far as I can tell. -
@d-healey This is the section that multiplies the * 12 from note 36 to = 48. It's in the onNoteOn section.
But what I mean by print is record a midi note on 48. It currently records note to 36. Which I know is obvious because I'm hitting the note 36 C1 on the keyboard. But I want is it to record note 48 C2.Synth.playNote((Message.getNoteNumber() + (currentSelectRow * 12)), 127);
-
@jssrecording There is no MIDI out from HISE, only audio. So you'll only record in your DAW the key that you press.
-
@d-healey Okay thanks David! Will probably do some refactoring with my sample structure layout.
-
Here was my solution to custom midi mapping
HiseSnippet 1836.3oc4X0sSabDEdWLaRX.GkzzH0dS0VSu.ZAhW9IglnnXv1PoI.VwDZkpqRW1cLdD6Ni0tiIPiPpR8cnW1mkbQe.5iPeDxaP6Yl8e7ZhcRHsREYALmYNy7c9Nyb9wM7XVXeelmh5D6cZWrh5TZMOkx6TsiIgprUME0qqssoOG6oGHZ8S6Z56isUTUKroPf5DiqH+40OZcSGSpENQjhx9LhE9IDWBOQZiJOl33rgoMdOhapUubksrXzpLGVO.OEzJqz0z5HyCw6XJV1XZJpWotMgy7ZxM4XeE0wWmYeZyNrWPCV+9DexANXw.CklvFEHdClis.wBoJU6PbraDY29JJpZMRXgBArvGqsMwlDKOgMtgbB8DMRyGpicQvyHM7JmK7JmG7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Tv0PcabaydNbce3sP7RcHziv16wj5WDcVjEdm7Lwhn94tr7VTZjD6ErUiUFD0M7zVBkEX+KFY.xLbBzWsEs5zsn0fOvep2htA7A9uMgOveVC9.+Y8Aaj4XfAYQuHSLXE.5DU02uQFL8vYlwaUFC0nOCc9EaQm2nEsbKJ7aXvRsnK2htRK5caQuWK5p4ahwPoHhPA2NNocfHF3YcsgWr5yXEU8RTeAEQuL.Eo87eiHbhGPNQBV3PLeew5mYV840MdPVUBN+XklIQ14zaV8uzXwGHvoP8zWAErWvBOGF9p9NgYkavYxeGw8vwDWWVpaVyJ11vJyqZ53b.jsXlrThX2F7tD53Fx8Y.M8QZCTBD4BdvJNBwT6H6MCHkO+gYogD9Z1.RJz6H4qv8fbHk4gqer.kbudxiVL+YWT2kCV4+k56D89puyHxNRRYkXSOsnD6JsTo4jyxRDMjs0F1120CyV0zg.WUkcBbcszd3y222pUFtVGS0CyaYymY5d3Rn6yqLrLvIQ09bZz+DkQDFqAYDCJXZhq7qQUd0+o7l3H4Y7aoOiv8bpvsb3ZDbXO4Lbq7rmSs+ydxrm8fac6CWCXu8EvMVi99ZOApgHJntN8XrCb4QhwOBtsHqNIRZ1x21lQYc6vnDqrkeC03b3gXuzXOWCZMNGBFmUWGroeltOdBjSzz67cPboVLat9qOQK.t5hvN5+mpw4qF.aj19fSxRb5B.e63g5wliwaFsPMo6YJgShOXKv86wy1QUMrE4.rSVGS+cc+V6Xdu7MCT3+mey.Ok0iCcVusI7RTDQCJYoIzPtEFPBkhcDe0wpiIBNGLtbTvtlXpsbveC+DNogXrZ3jFQS9A4LbMs7XO2JHCo3w50jR.6lJ6keBssEi0i+RcEbCz8F44VVBxddCEk70XwQVikFYMVdj0XkQVi6NxZbuQViUu.MDoNWqGm4F7zCDzntrVDU03uGG0BJ+il.K1k
-
@d-healey Hey David. I was wondering if you could please give me nudge here. I managed to get your basic code going (by removing "Ignore events" line from OnNoteOn).
What I am trying to accomplish is to have a note transposed to a user-defined note. I added a Combobox with ID ComboBoxKickMidi. The combobox contains a list of notes that can be selected (C0, C#0...).This is the jambalaya code I came up with which, to my surprise, is not working
OnInit
const var map = Engine.createMidiList(); //Add another line for each note you want to remap map.setValue(KickNumber, 36); //Set kick value const var KickNote = Content.getComponent("ComboBoxKickMidi"); // Declare combobox
OnNoteOn
function onNoteOn() { local KickNumber = Message.getNoteNumber() + 1; if(KickNumber == KickNote.getValue()) { Message.setNoteNumber(map.getValue(Message.getNoteNumber())); } }
The error message I get with regards to map.SetValue line:
Interface:! Line 1217, column 13: API call with undefined parameter 0
What do I need to change to get this going?
Thank you!
-
Line 1217, column 13:
This implies you haven't posted all of the code... I have no idea what that error is referring to because I don't know what's on Line 1217.
-
@d-healey The line in question is this one:
map.setValue(KickNumber, 36); //Set kick value
When removed, all other lines compile OK.
-
@gorangrooves What is KickNumber?
-
@d-healey If you look at the OnNoteOn section, I introduced it there. It is supposed to be a numerical value that is calculated from a note that user selects (ex. User selects C0, it gets turned into midi note 36).
-
@gorangrooves said in Drum Mapping- user defined:
local KickNumber = Message.getNoteNumber() + 1;
I'm currently making a video on this exact subject!
A local variable only exists between the
{}
where it's declared. It is local to the code block. So you can't access that variable anywhere else. You need to declare your script-wide variables in on init. -
@d-healey I understand. Thank you. So, I would use this in OnInit?
var KickNumber = Message.getNoteNumber() + 1;
-
@gorangrooves
Message.getNoteNumber();
only works inon note on
andon note off
.You need to create a variable in on init. Something like this
reg kickNumber
You should use a reg variable because it is more efficient for variables that will be accessed in real-time callbacks such as on note.
Then inside on note you will save the note number in that variable.
function onNoteOn() { kickNumber = Message.getNoteNumber() + 1; }
This -
map.setValue(KickNumber, 36);
- won't work in on init though because kickNumber will be undefined.
So you'd probably need to set it in on note. But if you're doing that then there's probably no point in using themap
variable at all. You might as well just useMessage.setNoteNumber(36);
I would think.