HISE Logo Forum
    • Categories
    • Register
    • Login

    Button to trigger MIDI note

    Scheduled Pinned Locked Moved Scripting
    7 Posts 3 Posters 156 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.
    • rglidesR
      rglides
      last edited by

      Has anyone figured out how to make a button trigger a midi note?

      of course this button can play a note

      const var test = Content.getComponent("test");
      var EventId = 0;
      
      inline function ontestControl(component, value)
      {
      		if (value)
       	{
      		Synth.playNote(1, 100);
       	}
       	else
       	{
       		Synth.noteOffByEventId(EventId);
       	}
      };
      
      Content.getComponent("test").setControlCallback(ontestControl);
      
      

      but how can I also play the actual midi note? I'd like to be able to record the button presses in an empty midi file in a midi player, but that currently only records notes pressed by the keyboard, not the buttons

      Thanks!

      clevername27C VirtualVirginV 2 Replies Last reply Reply Quote 0
      • clevername27C
        clevername27 @rglides
        last edited by

        @rglides Try playNoteFromUI.

        rglidesR 1 Reply Last reply Reply Quote 0
        • rglidesR
          rglides @clevername27
          last edited by

          @clevername27 oh, so Synth.playNoteFromUI(1, 100); ?

          1 Reply Last reply Reply Quote 0
          • VirtualVirginV
            VirtualVirgin @rglides
            last edited by VirtualVirgin

            @rglides
            The methods

            Synth.addNoteOn(int channel, int noteNumber, int velocity, int timeStampSamples)
            and
            Synth.addNoteOff(int channel, int noteNumber, int timeStampSamples)

            will make MIDI messages that you can see in the Event Logger: MIDI Processor.

            I am not sure, but you may need to put the MIDI player in a separate container in the Module Tree for it to "see" the incoming MIDI messages created this way.

            You can listen to my orchestral mockups here:
            https://www.virtualvirgin.net/

            rglidesR 1 Reply Last reply Reply Quote 0
            • rglidesR
              rglides @VirtualVirgin
              last edited by

              @VirtualVirgin said in Button to trigger MIDI note:

              timeStampSamples

              Thanks! I'm confused by timeStampSamples but I guess I can just try some numbers out

              clevername27C 1 Reply Last reply Reply Quote 0
              • clevername27C
                clevername27 @rglides
                last edited by

                @rglides Engine.getSamplesForMilliSeconds

                rglidesR 1 Reply Last reply Reply Quote 1
                • rglidesR
                  rglides @clevername27
                  last edited by

                  @clevername27 Thank you!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  16

                  Online

                  1.8k

                  Users

                  11.9k

                  Topics

                  103.9k

                  Posts