HISE Logo Forum
    • Categories
    • Register
    • Login

    onNoteOn || Trigger UI Button with Midi Note?

    Scheduled Pinned Locked Moved Scripting
    13 Posts 2 Posters 366 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.
    • ChazroxC
      Chazrox @d.healey
      last edited by

      @d-healey this isnt triggering the button. Is there a step I might be missing somewhere else? This is on the main interface script onNoteOn. Its triggering a sinewave generator right now but I plan to delete the sinwave generator and just use it as a midi player. 1 note/chord player.

      Screenshot 2025-06-06 at 2.20.31 AM.png

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

        @Chazrox If you want to trigger the button's action you need to call the .changed() function after setting the value

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        ChazroxC 1 Reply Last reply Reply Quote 0
        • ChazroxC
          Chazrox @d.healey
          last edited by

          @d-healey that works but I get stuck notes. Im trying to achieve a while-key-down effect. Im rewatching your "While Key Pressed" video but I dont think thats exactly what I need. What should I be looking for as far as apis?

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

            @Chazrox what does your button do?

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            ChazroxC 1 Reply Last reply Reply Quote 0
            • ChazroxC
              Chazrox @d.healey
              last edited by Chazrox

              @d-healey my button is triggering a chord. I have everything scripted out and it works fine with mouse clicking the button. Just need the '1-note' part to work.

              this is what my buttons callback looks like. ugly...but for some reason this works best for my use.

              //! CHORD 2 BUTTON CONTROLS
              inline function onButton2Control(component, value)
              {
              	local Chord2Choice = cmbChord2.getValue();
              	local chord2 = ChordLibrary[cmbChordType2.getValue() - 1];
              	local Octave2 = Knob2.getValue() * 12;
              
              	
              	if (value)	
              	{
              		eventId3 = Synth.playNote(chord2[0] + 72 + Octave2 + Chord2Choice - 1, 64);
              		eventId4 = Synth.playNote(chord2[1] + 72 + Octave2 + Chord2Choice - 1, 64);
              		eventId5 = Synth.playNote(chord2[2] + 72 + Octave2 + Chord2Choice - 1, 64);
              		eventId14 = Synth.playNote(chord2[3] + 72 + Octave2 + Chord2Choice - 1, 64);
              		eventId16 = Synth.playNote(chord2[4] + 72 + Octave2 + Chord2Choice - 1, 64);
              		eventId17 = Synth.playNote(chord2[5] + 72 + Octave2 + Chord2Choice - 1, 64);
              		eventId18 = Synth.playNote(chord2[6] + 72 + Octave2 + Chord2Choice - 1, 64);
              		
              		Engine.setKeyColour(chord2[0] + 72 + Octave2 + Chord2Choice - 1, SetKeyColour);
              		Engine.setKeyColour(chord2[1] + 72 + Octave2 + Chord2Choice - 1, SetKeyColour);
              		Engine.setKeyColour(chord2[2] + 72 + Octave2 + Chord2Choice - 1, SetKeyColour);
              		Engine.setKeyColour(chord2[3] + 72 + Octave2 + Chord2Choice - 1, SetKeyColour);
              		Engine.setKeyColour(chord2[4] + 72 + Octave2 + Chord2Choice - 1, SetKeyColour);
              		Engine.setKeyColour(chord2[5] + 72 + Octave2 + Chord2Choice - 1, SetKeyColour);
              		Engine.setKeyColour(chord2[6] + 72 + Octave2 + Chord2Choice - 1, SetKeyColour);
              	}
              	else
              	{
              		Synth.noteOffByEventId(eventId3);
              		Synth.noteOffByEventId(eventId4);
              		Synth.noteOffByEventId(eventId5);
              		Synth.noteOffByEventId(eventId14);
              		Synth.noteOffByEventId(eventId16);
              		Synth.noteOffByEventId(eventId17);
              		Synth.noteOffByEventId(eventId18);
              		
              		Engine.setKeyColour(chord2[0] + 72 + Octave2 + Chord2Choice - 1, NoKeyColour);
              		Engine.setKeyColour(chord2[1] + 72 + Octave2 + Chord2Choice - 1, NoKeyColour);
              		Engine.setKeyColour(chord2[2] + 72 + Octave2 + Chord2Choice - 1, NoKeyColour);
              		Engine.setKeyColour(chord2[3] + 72 + Octave2 + Chord2Choice - 1, NoKeyColour);
              		Engine.setKeyColour(chord2[4] + 72 + Octave2 + Chord2Choice - 1, NoKeyColour);
              		Engine.setKeyColour(chord2[5] + 72 + Octave2 + Chord2Choice - 1, NoKeyColour);
              		Engine.setKeyColour(chord2[6] + 72 + Octave2 + Chord2Choice - 1, NoKeyColour);
              	}
              
              };
              
              Content.getComponent("Button2").setControlCallback(onButton2Control);
              

              ...12 Buttons mapped over 1 octave.

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

                @Chazrox You need to trigger the button in the note off callback in addition to note on

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                ChazroxC 1 Reply Last reply Reply Quote 0
                • ChazroxC
                  Chazrox @d.healey
                  last edited by Chazrox

                  @d-healey I must have wrote a funky code because I tried some stuff on onNoteOff but it was not off'ing. lol. Can you give me an example of that line please?

                  and theres a weird 'Blip' sound upon triggering my chords now.

                  can I pm you this snippet? 🙏

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

                    @Chazrox just the same as you have in the note on yes.

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    ChazroxC 1 Reply Last reply Reply Quote 1
                    • ChazroxC
                      Chazrox @d.healey
                      last edited by

                      @d-healey Sorry I made a mess in your inbox.

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

                        @Chazrox You filthy bugger :p

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

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

                        19

                        Online

                        1.7k

                        Users

                        11.9k

                        Topics

                        103.7k

                        Posts