Ignore note range



  • Hello guys, can anyone help me create a script to ignore midi events or mute notes based on note ranges? In other words, notes out of the C1-C4 range won't do a sound!



  • @hisefilo

    const var knbMin = Content.addKnob("knbMin", 0, 0);
    knbMin.setRange(0, 127, 1);
    knbMin.set("text", "Low Note");
    
    const var knbMax = Content.addKnob("knbMax", 150, 0);
    knbMax.setRange(0, 127, 1);
    knbMax.set("text", "High Note");
    
    const var btnRelease = Content.addButton("btnRelease", 300, 12);
    btnRelease.set("text", "On Release");function onNoteOn()
    {
    	if (Message.getNoteNumber() < knbMin.getValue() || Message.getNoteNumber() > knbMax.getValue())
        {
            Message.ignoreEvent(true);
        }
    }
    function onNoteOff()
    {
    	if (btnRelease.getValue())
        {
            if (Message.getNoteNumber() < knbMin.getValue() || Message.getNoteNumber() > knbMax.getValue())
            {
                Message.ignoreEvent(true);
            }
        }
    }
    function onController()
    {
    	
    }
    function onTimer()
    {
    	
    }
    function onControl(number, value)
    {
    	
    }
    


  • @d-healey wow that's much more than I expected!!!!!! Thanks David



  • I've not been able to get this to work. Is there a step missing? Please see snippet.

    HiseSnippet 1426.3oc4XstSabDEdVLCBatnlznp9yUn9CiDEYmDRpTZaLWSsBFbYgz9OzvtisG4cmY6tiI3RhTdJ5KS+Q6iPeT3Mn8L6EOqgEisUKpM0BAdNWly24Ly4xPy.gMMLTDfLJdbeeJxXQrUetry1cHLNp9NHikwMHgRZfYLos56SBCoNHCiBuRQvn3rnnOW8xsHtDtMUSBgdifYS2m4wjZpMq8Zlq6dDG5wLuLR+zZ0sE7sEthd.dJfqf7I1cIsoGPThMCFYL2tNLoHvRRjzPjwraIb5a0Q7Vdr7ugExNykpVTEYAaTL48DtNJDq9NZ6NLWmlo9cHBYfapiBEhiBOB2f4vFPWGM9jHFlZMxFOLlYTvq5TBOiLva1X38.rkc.yWp4nv1B35b3fpEANBxBqXYQF+JdaAH.WttGoKcu.Xw.EJ+rJUVybiJUV8Es5wskLA2TvOPHoGxKuZoKKUrz6KccNsZkGKkQBDttz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maQ.Twa6hXc6l6w2OTX7FB9NFboXJFsXd9tzc4mScgq6QX7gv86nHZJ0gGaogfK76H3L6r4OGQgyk1soAYwdtNzlRIwtqlxipkFDGP5KpsOLaJI.hSzoLVTc7iEi575ywwv0TUbz7ii28U3+mu66HQOIi2tAAtnpxogIcrfmaYSAjv4T2PU58LpVZwqqjVKyhxchV7mvmDlUUqMRXVMk48hM7H1AhSsia3otKOeDEvu4Q+OTKhanVaVMsImJ1.UfYmZaqB1eIDcxWiGOwZ7jIVimNwZrwDqwylXMd9DqwWMBMTOIcydRgWbpGPn4tQCWXXrKm.2bitki9KhZFYgB
    


  • @Tod-Slaughter

    Hi,

    It looks like you copied the whole script into the on init callback. What you need to do is copy the script, then right click inside your script processor and select Load Script from clipboard



  • @d-healey Thanks, I didn't know that, 🙂


Log in to reply
 

5
Online

556
Users

2.1k
Topics

16.5k
Posts