Velocity-notenumber script?



  • @hisefilo See my woodwind library (specifically the controller handler script) for some hints.



  • @d-healey 🙂 thanks David!


  • administrators

    Or just use this buddy...

    /** TableVelocity Booster
    *
    *   This script is boosting the velocities according to the table value 
    *   of the given note number and the gain slider.
    *
    *   Usage: 1. Set the table to create a boost curve for the note range.
    *          2. Set the gain slider to control the amount of boost
    *   
    *   It will "fill up" the velocity to the max amount. Example:
    *   
    *   Table value is at 50% for a given note, gain is at 100%.
    *   If you press a key with velocity 40, it will add 50% of the difference
    *   to 127 (~43). If the gain is at 80%, it would add 40% and so on.
    */
    
    Content.setHeight(150);
    const var table = Content.addTable("table", 0, 0);
    table.set("width", 512);
    table.set("height", 150);
    const var gain = Content.addKnob("Gain", 600, 0);
    gain.set("mode", "NormalizedPercentage");
    function onNoteOn()
    {
    	local tableValue = table.getTableValue(Message.getNoteNumber());
    	local veloDifference = 127 - Message.getVelocity();
    	local delta = parseInt(tableValue * veloDifference * gain.getValue());
    	local newVelocity = Message.getVelocity() + delta;
    	
    	Console.print("In: " + Message.getVelocity() + "Out: " + newVelocity);
    }
    function onNoteOff()
    {
    	
    }
    function onController()
    {
    	
    }
    function onTimer()
    {
    	
    }
    function onControl(number, value)
    {
    	
    }
    


  • @christoph-hart yeah!!! Thanks, scripting is not my field. Maybe in future Hise should add this kind of hardcoded scripts (for newbies like me:)


  • administrators

    Nah this is a prime example for custom MIDI processing. A generic module would not make sense.



  • @christoph-hart I can see the script doing the job on console output but seems not to affect the modules,

    Velo Gain: In: 32Out: 127
    Velo Gain: In: 44Out: 127
    Velo Gain: In: 40Out: 127



  • @hisefilo Did you place it at the top of the tree?



  • @d-healey Yep!

    HiseSnippet 1329.3oc4XstaZbDEdVvqcA2DkH4V0etB0JgyEKvI1ooQU9BX6hRvlZHt4eQi2c.FkcmY6ryZGZUdM56PeC5SQUeDxiPdCZOyLKrK1DLXkjVoh7OXNy4x24Lma3VBtKIJhKPVE5LHjfr9b61CXx905ioLTi5HqaZ2DGIIBGCocGD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dmoibkf06HvrnPdzXJtMIf1AJVhxR74Qj8Eje9X0ibV503pwVS3p2s09fONQYZikwBc1xNA7Xlbrri7i+jXOaszGunIC+S+sxZg+EVp6CeU3G0lFywNn4ZcoenvsfT8fPexdL0lL.ESWi5jt3Xe4HpYAbSNiG1myntYSLNlHEzd8HhrtwD8scjR3GDjRYksOl3SvYSx+5seFjbhEM0sre+gk7yVXY1VGehOceksAtNpBVm+S02eICrKZObaOMfWYzQmQtyUCVn8gYTdlWzFviuPpDJkVchK8Th+3uKWdlw09c4Cxbs7++bt1w7XIk0qIFJDU6HA+9m1v7DWBfDFi3q5VaoVAK4bkgqO0lv7zG9a3SxkUUmsRtr5vK+jXi.rqf+RWyVtpZ0OSSA7al9+fPA6lpyNUGteqJ1.q.ReoqqJXeeH5LYIVetk3AysDObtkXi4VhMmaIdzbKw2NEITyY2IVxCLkd.gV6o+cEVV6wTsQzY4n+QJy2+O
    

  • administrators

    Fail. I forgot Message.setVelocity(newVelocity);



  • @christoph-hart Yesss! it's working now! thank you!!!!!

    /** TableVelocity Booster
    *
    *   This script is boosting the velocities according to the table value 
    *   of the given note number and the gain slider.
    *
    *   Usage: 1. Set the table to create a boost curve for the note range.
    *          2. Set the gain slider to control the amount of boost
    *   
    *   It will "fill up" the velocity to the max amount. Example:
    *   
    *   Table value is at 50% for a given note, gain is at 100%.
    *   If you press a key with velocity 40, it will add 50% of the difference
    *   to 127 (~43). If the gain is at 80%, it would add 40% and so on.
    */
    
    Content.setHeight(150);
    const var table = Content.addTable("table", 0, 0);
    table.set("width", 512);
    table.set("height", 150);
    const var gain = Content.addKnob("Gain", 600, 0);
    gain.set("mode", "NormalizedPercentage");
    function onNoteOn()
    {
    	local tableValue = table.getTableValue(Message.getNoteNumber());
    	local veloDifference = 127 - Message.getVelocity();
    	local delta = parseInt(tableValue * veloDifference * gain.getValue());
    	local newVelocity = Message.getVelocity() + delta;
    	Console.print("In: " + Message.getVelocity() + "Out: " + newVelocity);
            Message.setVelocity(newVelocity);
    }
    function onNoteOff()
    {
    	
    }
    function onController()
    {
    	
    }
    function onTimer()
    {
    	
    }
    function onControl(number, value)
    {
    	
    }
    

Log in to reply
 

3
Online

337
Users

1.0k
Topics

7.0k
Posts

Looks like your connection to Forum was lost, please wait while we try to reconnect.