HISE Logo Forum
    • Categories
    • Register
    • Login

    Control velocity from each incoming midi note with a Knob / Slider?

    Scheduled Pinned Locked Moved Scripting
    6 Posts 2 Posters 31 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      Rognvald
      last edited by

      I know it is possible to link a button to incoming each midi note.
      Can the same be accomplished with a Knob for each note?
      ( controlling the velocity while the note is being pressed )
      I often do this in Max/Msp, PureData.

      Thanks I hope :)

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Rognvald
        last edited by

        @Rognvald Do you want the knob to set the velocity or the velocity to set the knob value?

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        R 1 Reply Last reply Reply Quote 0
        • R
          Rognvald @d.healey
          last edited by

          @d-healey Ahh, the Knob to control the Velocity

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Rognvald
            last edited by d.healey

            @Rognvald

            Ok let's say your knob is called knbVelocity and you have a reference to it in onInit

            const knbVelocity = Content.getComponent("knbVelocity");
            

            In the onNoteOn callback you can use the knob's value to set the Message's velocity.

            Message.setVelocity(knbVelocity.getValue());
            

            Ideally this should be done using two MIDI processors. The Interface script should be deferred - which means you won't be able to use setVelocity there. A second MIDI processor should be used for setting the velocity, and the knob on the GUI should be connected the knob of the second MIDI processor.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            R 2 Replies Last reply Reply Quote 0
            • R
              Rognvald @d.healey
              last edited by

              @d-healey Ok thanks for all this info, I will have a blast and see what comes out :)

              1 Reply Last reply Reply Quote 0
              • R
                Rognvald @d.healey
                last edited by

                @d-healey I am currently using this code for buttons to midi. Is there any way to insert this velocity function or would I also need to put this code on the second Midi Processor? Little confused but I am sure it can work.

                onInt

                const Buttons = Content.getAllComponents("Button");
                
                //	this list will save the played note eventIds
                reg eventIds = Engine.createMidiList();
                
                //	this played keys will trigger the buttons
                reg keysThatTrigger = [48, 49, 50, 51];
                
                //	this notes will sound 
                reg triggeredNotes = [48, 49, 50, 51];
                
                inline function onButtonsControl(component, value)
                {
                	local index = Buttons.indexOf(component);
                	
                	if (value)
                		eventIds.setValue(triggeredNotes[index], Synth.playNote(triggeredNotes[index], 60));
                	else
                		Synth.noteOffByEventId(eventIds.getValue(triggeredNotes[index]));
                };
                
                for (b in Buttons)
                	b.setControlCallback(onButtonsControl);
                

                onNoteOn

                function onNoteOn()
                {
                	Message.ignoreEvent(true);
                	
                	if (keysThatTrigger.contains(Message.getNoteNumber()))
                	{
                		local index = keysThatTrigger.indexOf(Message.getNoteNumber());
                		Buttons[index].setValue(true);
                		Buttons[index].changed();
                	}
                }
                

                onNoteOff

                function onNoteOff()
                {
                	if (keysThatTrigger.contains(Message.getNoteNumber()))
                	{
                		local index = keysThatTrigger.indexOf(Message.getNoteNumber());
                		Buttons[index].setValue(false);
                		Buttons[index].changed();
                	}
                }
                
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post

                21

                Online

                2.0k

                Users

                12.8k

                Topics

                111.1k

                Posts