Velocity select instrument and variation



  • is this possible and if so how?
    Has anyone already done something like this?

    Bildschirmfoto 2021-05-20 um 12.13.24.png



  • Yes you can specify a velocity to trigger with the Synth.playNote() function.



  • This works
    But how do I get the terms in the array into Label1?

    // Knob1 Instrument - 1-16
    const var Knob1 = Content.getComponent("Knob1");
    // Knob2 Variation - 1-5
    const var Knob2 = Content.getComponent("Knob2");
    // Label shows Instrument
    const var Label1 = Content.getComponent("Label1");
    // Label shows Vartiation
    const var Label2 = Content.getComponent("Label2");
    
    
    var InstrumentID;
    var VariationID;
    var Wert;
    var Instrument = ["Bassdrum", "Snare", "HiHat", "Cymbal", "TomLow", "TomMid", "TomHigh"];
    
    inline function onKnob1Control(component, value)
    {
    //Every 5 velocity values a new instrument starts - within these values they are variations of the same instrument.
    	InstrumentID = value * 5;
    	Console.print("Instrument " + value);
    	
    	Wert = InstrumentID + VariationID;
    	Label1.set("text", "Instrument " + Wert);
    	Console.print("WERT " + Wert);
    
    };
    Content.getComponent("Knob1").setControlCallback(onKnob1Control);
    
    
    
    inline function onKnob2Control(component, value)
    {
    	VariationID = value;
    	Console.print("Variation " + value);
    	
    	Wert = InstrumentID + VariationID;
    	Label1.set("text", "Instrument " + Wert);
    	Label2.set("text", "Variation " + VariationID);
    	Console.print("WERT " + Wert);
    };
    
    Content.getComponent("Knob2").setControlCallback(onKnob2Control);
    
    Wert = InstrumentID + VariationID;
    Console.print("WERT " + Wert);
    
    
    function onNoteOn()
    {
    	Synth.playNote(60, Wert);
    }
    


  • Instrument[Wert] perhaps?



  • At most with a lot of if-statements or case-statements.
    for example:

    If WERT is greater than or equal to 1 and less than or equal to 5.

    Instrument = "Bassdrum"

    If WERT is greater than or equal to 6 and less than or equal to 10

    Instrument = "Snare"

    Etc.
    Dann hab ich bei 16 Instrumenten exakt 32 Zeilen - das geht doch sicher in 2 Zeilen oder?



  • @MikeB Sorry I don't understand



  • see the text inside please.

    HiseSnippet 1332.3ocsWstSibCE1Cf2RBMqXk1G.qHUUnKjM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ZLb.H1ExH3Zh1YW16gdVhJzlAuKK7JkrKxAmjeCtdpH9ljO3mNuR+jIe72pDpXcav+CvbLtTghnNzTcQEpnOcpaOK8vflzR9xKN0vM0aDwT9xC28VzWdIbZudCAsmWwFGYhvQtXbXtew.iEwQWLYgCzEV33OaEGhKisuspzFnq4dp1.1b10AgZyfRXJ8r0AiZAaSQHefK+9JTe9kBC+37DrOq0v7zzvmMO8Qa78oqhw2SwVWPtwCDBIwPighguBgdTn6UVn6uCr2EYwnKDWSQtV1y2izjQDPBKg2hvAFkQ8HxVDJI5hEhpMHGZfVundLOszZh8sYAPUNY.gcCsSWeFwdqYPuHoA2+frCt.X1cYh6xWkqftamrP+zRud9T0vMYqeYQrfQezgtiUQHW02N28Qz4cww14cowcY0CDtOCWmqbaOd7N2Xvq91uOy3M9cL4v60pEyUkB1Ev6+Ky5iVdDPAdHohKt7HpJfC4x3i60oA7rNWFfDgf4GpyblSepHZdQ8bMyzfI7LS9O3mXgkzychEVZfP35I2.46bipDneozhlU.LILOXLC9H8bRR8CLtn4ZOO96bc0Tw5.1GuMkmAad0LXyFyfMaNC1r0LXy2NC17cSzF8am+4dJYmniIvB02yTJ1wYOAExxLYjn+GviP7ou



  • Label1.set("text", "Instrument " + Instrument[value]);



  • Great - Thank you very much David - that's it.


Log in to reply
 

9
Online

1.3k
Users

4.2k
Topics

38.3k
Posts