HISE Logo Forum
    • Categories
    • Register
    • Login

    Chord Player Inversions || Help with Indexing!

    Scheduled Pinned Locked Moved Solved Scripting
    8 Posts 4 Posters 70 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
      last edited by Chazrox

      I built a one note chord generator. I've worked out Root position and 1st Inversion. The problem is, when I script for 2nd inversion, something goes wacky.... the way I have it scripted here seems to increment the inverted note every time the key is pressed in succession.

      Can you spot what could be the cause? See my 'else if (inv1NOW ==3)' statement.
      This is script for Button1 for example..

      // onNoteOn
      
      	if (nn == 60) // TRIGGER CHORD 1
      	{	
      		local inv1NOW = cmbInversion1.getValue(); // GRAB COMBOBOX INVERSION VALUE 1 = ROOT, 2 = 1ST inversion, 3 = 2ND inversion and so on...
      		
      		if (inv1NOW == 1) // ROOT POSITION
      		{
      			chord1[0] = 0; 
      		}
      		else if (inv1NOW == 2) // FIRST INVERSION
      		{
      			chord1[0] = 0 + 12; 
      		}
      		else if (inv1NOW == 3) // SECOND INVERSION // HERE'S WHERE IT GETS WEIRD....
      		{
      			chord1[0] = 0 + 12; // <------------------------------------------------------------<
      			chord1[1] = chord1[1] + 12; // Why does it incriment everytime here but not up there ^
      		}
      
      		Button1.setValue(1); //  VISUAL FEEDBACK
      		
      		for (c1 = 0; c1 < chord1.length; c1++) // PLAYING NOTES HAPPENS HERE
      		{							
      			noteEventIds[nn].push(Synth.playNote(chord1[c1] + offset + Octave1 + Chord1Choice - 1, velocity));
      		}	
      								
      	}
      

      I've tried to set the 'cmbInversion1 combobox getValue' as a const var in onInit thinking that the increment is happening every time (n == 60) because its in onNoteOn and within that code block....but calculating that value outside of onNoteOn doesn't change anything for me.

      ustkU d.healeyD 2 Replies Last reply Reply Quote 0
      • ChazroxC Chazrox marked this topic as a question
      • ChazroxC Chazrox referenced this topic
      • ChazroxC
        Chazrox
        last edited by Chazrox

        @d-healey I had the statement written that way you suggested but why does one increment on every button press and the other one doesnt?

        1 Reply Last reply Reply Quote 0
        • ChazroxC
          Chazrox
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • ustkU
            ustk @Chazrox
            last edited by

            @Chazrox because in the first line you explicitly force it to be 12, so in the end it never changes
            and in the second line it's the old value + 12. So next time the old value will be the new one, +12… this is an incrementation.

            Can't help pressing F5 in the forum...

            ChazroxC 1 Reply Last reply Reply Quote 0
            • ChazroxC
              Chazrox @ustk
              last edited by

              @ustk How would you recommend going about this?

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

                I don't see any incrementing going on.

                    if (inv1NOW == 1) // ROOT POSITION
                    {
                        chord1[0] = 0; // 0
                    }
                    else if (inv1NOW == 2)
                    {
                        chord1[0] = 0 + 12; // 12
                    }
                    else if (inv1NOW == 3)
                    {
                        chord1[0] = 0 + 12; // 12
                    }
                

                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 Thats what I was thinking....I ended up just scripting '-12' on all the corresponding onNoteOffs. Probably added another 50 lines of code but it works! Just finished up scripting all my functions now. I got all my chord options up to 3rd Inversions as of now. Thank You! 🙏

                  Figuring this thing out was a doozy!
                  Screenshot 2025-06-16 at 5.19.52 AM.png

                  I also got midi out to DAW working as CHORDS or ARP mode! yee!

                  Thank Yous!
                  @ustk
                  @ulrik
                  🙏

                  dannytaurusD 1 Reply Last reply Reply Quote 0
                  • ChazroxC Chazrox has marked this topic as solved
                  • dannytaurusD
                    dannytaurus @Chazrox
                    last edited by

                    @Chazrox said in Chord Player Inversions || Help with Indexing!:

                    I also got midi out to DAW working as CHORDS or ARP mode! yee!

                    Looks cool! 👏

                    Since compiling as MIDI FX is currently not working (as I understand it), are you planning on releasing this as an instrument instead?

                    Trying to understand how that would work in various DAWs. I'm assuming you're taking a MIDI input from the DAW (either from a connected controller or a MIDI clip in the DAW), then outputting MIDI from your instrument plugin that is meant to play another instrument plugin?

                    Routing like that is easy in Reaper but other DAWs seem less flexible (I'm looking at you, Logic).

                    Meat Beats: https://meatbeats.com
                    Klippr Video: https://klippr.video

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

                    20

                    Online

                    1.8k

                    Users

                    11.9k

                    Topics

                    104.0k

                    Posts