Mute/enable a sampler when a controller value is greater than or less than
-
@afinch I don't think you need a range, you just want to check if it's greater than
>
64, don't you? -
@d-healey Yes so just >64, how would I implement that?
-
@afinch said in Mute/enable a sampler when a controller value is greater than or less than:
@d-healey Yes so just >64, how would I implement that?
if (cc > 64) // do one thing else // do something else
-
@d-healey So would it be something like this? I have linked a slider to CC1 and don't see the 'Ignore all events button' toggling on and off.
function onController() { if (Message.getControllerNumber() == 1) { if (cc > 64) { mute.setAttribute(0, 1); } else { mute.setAttribute(0, 0); } } }
-
@afinch
cc
was just a placeholder, you need to use the actual incoming cc number. -
@d-healey oh I see, I am a little confused as to how I specify CC1 there. Could you explain a bit further please?
-
You don't need to specificy it at that point. You've already done it on the line before
Message.getControllerNumber() == 1
What you need now is the CC value. You can use
Message.getControllerValue()
You should avoid magic numbers too. Instead of
mute.setAttribute(0, 1)
you should usemute.setAttribute(mute.ignoreButton, true)
-
@d-healey Based on what you said this is what I got to but I still can't seem to be able to get it too work, am I missing something obvious?!
function onController() { if (Message.getControllerNumber() == 1) { if (Message.getControllerValue() > 64) { mute.setAttribute(mute.ignoreButton, true); } else { mute.setAttribute(mute.ignoreButton, false); } } }
-
@afinch Looks good to me but without seeing the whole thing I can't say why it's not working. Can you post a snippet?
-
@d-healey basically trying to control the knob so it triggers the ignore button.
Here it is: HiseSnippet 1449.3oc4X80aaaCDmxNLs1sMasHOrWFfdXOj.zEX2llNfht3l+UXz5Dinzh8VAiDsMmkHEnnRhaVeaedF12f0uJ6aP+FrcjR1h10Iw0HsaXyOH363wi+3w638SpsT3SSRDRjSkiFDSQN2F6Mfq5scOBiiZtCxYIbKRhhJcyTs0fXRRBM.43T94ZENUV.Y98gM2hDR39zBUHzqELe5KYQLUg11MdAKLbOR.8HVjk0q2noufusHTjB3oLtFJl32mzktOQaVILxYwcCXJgzSQTzDjCdKQv.udhS4Y1+ZVB63PpVnNxCbTl5CNgJOgQOcOQXfF4Zc1+GscOVXP6gwhDD341EQlxYQlkwsXArQ5KhPesY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vIH4gxc2U3iuBC7k7To980Y9ISwIew39Td1ZfeEuVRkgXziou1bW9IP+RPS1sE6jQ+an1w6c2RvEw8Dbl+3cmfZltcoRarO0MDTcAMGKzrbiCogTRhU776Z7RFmRji2z8SJV7o+JZS875avYv0UWV69eCNqk+eOm0KKzsTNiUWX0kp+keNeargikqlR7+TP8PQpBn5NjtIF5o6A7v8o1LSKoumMStlVVCHOJOvH7Wvu7AqOjFqdv5CGD4OzUvdK++l1VNkobMMNyqhEBDjCsSosdM2uHnLh3KEuwOqchFq2znAPI27cwpfaokcG8kFv3ZqUS+l8r236qKD995HzzmyCli47v4XNqOGy4Qywb1XNlyimi47CW5bzjVdVpRDkcIYwmKR+9qN2xVH6.2ptz9i2YVql7.5YCSFxt8vJYbWdf8mfYuzvvOxFsxIryqO8zIaoJgsj8G6YDe0hupTSn0sTkcW.pU6cypVb1cT0RYzeiKG79q
-
You need to get a reference to your muter in the script.
-
@d-healey Sorry I meant to include that in the example. Even with that it still doesn't seem to be working.
HiseSnippet 1408.3oc4X0raaaDDdojYRjRhaSfOzKEfHnGjARMjRbbJPfaX7eABIxVvzIn.8fwZxURaM4tDKW5ehQ.5g97z1Gg7pz2f7FzN6RJwULxJJBooos5.glYmY1uc9Ymgrqf6SRR3BjUsCNOlfrtgs24L4fMGfoLT6sPVKZ2AmHIBmLVabdLNIgDfrrp9TECqZKfz+d6i2.GhY9jBVHzK4TexyoQTYA2ttOiFFtCNfb.MxP5Uca6yYaxC4o.dpZ2DEi8OF2mrKVIVEaj0U1NfJ4BOIVRRPV1avCN2a.+TVl7ujlPOJjnHZg7.CkwduSHhSnjS2gGFnPthWw+agPaNfFFzcnuHAAVtagmoZlmYI6Nz.5H9EdnuTufSgFl9HqJiC4piA4VlPtoAjm.jrLfzBYP5V1d9BZrrXEEdttcaFDv5ggPgITxjEY8F6M4f.L4JQ3iI6H.hQJzXslMuqC7X4G0Kk4KoblCmsKWR1i0X45WTuV8WW2o7R85Mw0TaifGFRDSbYUzWLM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EnI9S3W9hsFNfqZwVCWD4OzTvYK++51VVUIL0zd5WRKDFcNzLkNAdO.EjfgP+jfxHrufeneV6DEVullCfRl9aWUytih1YzWFv1t4JMQQPmyC88UEBeK3gmrN2aNz49ygNqNG57f4Pm0lCcd3bny2MUcTCs7jTIOJ6RxhOui5MasttIQV.2ntz7Cro2q1r.xYCSFxt8vHYbaVf4WZYmzvv2QFEyRx4cL4zxsTEvQRw6hk90mp9HNiFXs3q.0FZcKjY2Ef5zc6rpEqsGUsTE8W.sNG1VB
-
@afinch I don't see anything different in that second snippet, what am I missing?
By the way, if you use script tags when posting your snippet it will only take a single line and is easier to copy.
-
@d-healey I thought I had added the reference in the muter script, and will do!
-
@d-healey am I working in the correct script editor, should I be working in the sampler one?
-
@afinch Yes it should be the script you've added in the sampler
-
@d-healey I am expecting the knob to cause 'Ignore all events' to toggle off.
-
You haven't scripted anything for the knob or connected it through processor ID as far as I can see. But that's a different issue to the CC stuff we've been discussing so far.
-
@d-healey Oh I see, so the code is fine but the actual CC data isn't being put in correctly. You can't achieve what I wanted to do just be assigning the knob to CC 1? I want to control it as a slider really. So a slider that moves from 0 to 127 (CC1) and when it meets the 64 value the Ignore button is toggled. Need to get out of the the Kontakt way of thinking!
HiseSnippet 1448.3oc4X0saaaCElxNrs1sMasnWra1fPwtvAnKvpMMc.Ec0M+UXz5DinzfcWAiDsMWjHEnnRhaPuaOOa6Qn6QYuA8MX6PIYKZEGOWitt+7EB9b34P9wCOGd9j5JEdz3XgDYU6fgQTj0MvtC4pAaNfv3n1agrVF2gDqnR6LUaLLhDGS8QVVUetVgUskPo+d+S2fDP3dzBUHzgBlG8krPlpPa2VufEDrCwmd.Kzv50Z01Sv2TDHR.7TE2DEQ7NlzmtKQaVELx5Ja6yTBoqhnnwHK7FB+gtCDmxyr+PVL6n.pVvA4BSTl58NgJOgQOcGQfuF4ZcE+2Ag1b.Kvu6nXQLBl4tEQlpYQl6f6v7Yi0WDg97zArK7vLFYUYRHWcBH6XB4lFP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cY5KT2leBzIEzjcAyVzdjj.0HsS1UuifKhFH3LuI6aAEM86SklXepaHn7BZaVn4Ns1mFPIwFwyut0KYbJQNY63OnXgyG76kM0yqu.mAWacYs8+MXyV8+8rYmUna4btr1vpKU+C+b9F3T1W1Zxx+cA08EIJfD7HhnXnotKvP2iZxYsh9Z6L4lZYMfbob+TgeG9kOnyHBt5AcFMHxazTA6s7+m11xpJkqY6k9RZA.04.yT5X38.zPBHg9IAkgDOo30dYsSzX8ZoZ.TxS+XX0vczx1i+RCXbS860CcNesmmtP3afH7z849KfOOXA7YsEvmGt.9r9B3yiV.e91Y5ilzxyRThvrKIK9bQ52r055lBYG3F0klewtz0pM2md1njgraOLRF2l6ax5XmjffKXiVYI6bOldZ4VpRXKo0c9c9om+au4Ge5XBqEeUo1PqaoJ6t.TmtamUsXs83pkpn+.3VCzSE
-
@afinch said in Mute/enable a sampler when a controller value is greater than or less than:
@d-healey So a slider that moves from 0 to 127 (CC1)
Knobs and CCs are totally separate.
So you want a knob that can control muters when the value is over 64, and you want CC1 to do the same?Do you want the incoming CC to also control the knob? If so, is there a reason you don't want to use MIDI learn to control the knob?