HISE Logo Forum
    • Categories
    • Register
    • Login

    Play only the lowest note of a chord

    Scheduled Pinned Locked Moved Scripting
    8 Posts 3 Posters 169 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.
    • Oli UllmannO
      Oli Ullmann
      last edited by

      Hello all! :-)

      I have the following goal:

      When I play a chord, only the lowest note of the pressed chord should play. Even if I change notes in the chord, only the lowest note of the pressed chord should continue to play.

      The reason: I only want to trigger the arpeggiator with the lowest pressed note.

      I've already tried a few things, but I can't get anywhere. I can ignore the notes above the lowest note played. However, if I hold a note and then play a lower note, the previously held note continues to play. How can I change this?

      Here is my approach so far as a snippet:

      Thank you very much! :-)

      HiseSnippet 1084.3oc2W81aaTCF2WSODWFfXnJDufWXj3EIRSUIvXfTEr1ljNEsk0nltARSUSt28bIV0w9vmuxhP86HeT12.3w1IM20lN5hXHFQpUwO+wO+7ye9YmgZULjmqzjfnimkAjfOJbzLoYRmILtjzuKI3KC2SmQ6BPFjanOUY.5w1usOsUax9yxX44PBIHn1irdDDsIw840ObelfIigkhHjmq3wvS3S4lkRGt6i4BwArD3X9zRVe+c6GqjcTBUAhtZgsHYr3yXigmxrlsQHI3C5kvMJ8HCy.4jfM2WkLazD0uI81+bdN+TAXWzlLB2Hu3CThDKhsRIclvEICWjExIjfvgKyI074jsBGvS3WJeYt4ScJnK8nb9HXipvqVE30tL7ZUBdq.RAkfzldHc2vQwZdlYoFKdtSXeoAzoLLsWFJdaIarUsvNJzBoY6oryfCz3hK8nwCZ05dT7eM2odcWSv1IPJn6vDhSwTediTlHGrZ0vXpD6Dxo+H8EmriachuCYnfMCRrsIdwBVYYn8xBgXmzBYrgqjTkzJ9PYil0+85Qt87ECvCDVm2dLXrJeZwzSAcilmfNWRUuywiQ+jFHdhpGcsnaijc21NkKS5KSfW0XQPabNST.MoX.o3GMXJzRpSH8qlCv5QW32XdZia.Oze55m4l0iVXMerToAGJaXzEvka2UxHyiH5IhGqdepmm+XXVWrY4J12DMzYYj8Ous1C5goo6OaQNwmGq53IV.DcQcmiWqpbCmQadndDfkcO7dq76h5zqVmSSukEZeQn5NXac0JgvZicSthZK8wp0L2wFRW.tmuTeog3LU0A0vadPsLORreRpjgJYeI2bXFHuI1Ex7wO7aOqeWlgYmtmKCsKCzFtEBAcgyQpR+rdTXWH+LiJCIKuFQ.RAoRJDLSUdIKY7bEXNnBYfcfWlyMyJSV+OFY0sEh2MbH2DOY0XbiUfQLS8t.iyo3+3vdooPrYI.2L7fe4cCed4v+I9vemvQbI3llcA+ycqo+L6bf9HPBZax6Mcc6ebautM6Vec6gwFL7GqYx7LUdkMdDLkerRZyBKE9rb7BE3WOxVMKKuihoWopW+vCvC4J8YDC4jcsE6MUUHMUZCp8lt1u8Zds+l+m6Z+2CF1q7xjnEXbDeZl.5IOGDHilCieFRgkxJDlERq1KOPIUYSTRdb4B8QfQyGOFzkw9JOP6YL3CTVJYqcOBD.qbS6Wu6SvlMlFySvZlKZ+V+JsUVu9hPObo1AP56ujz09+MI8QpBCWNd.CaBeE9n.70IiPtwX.itThOIBkErgkeyutkcsmbTl3V7m3m4JaaWGLWY6EJ+WIFSYwZ0Ki8OAx1m9gNI34V59gTQgCrqosItmEUtVNEY4dYbb0s5ZN9Mqqie65538WWG+t00wGrtN98qqi+veui1Kg1qvnl5GMIjAC64dSYPPOIC6xcSDj+B7eNa9B
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Oli Ullmann
        last edited by

        @Oli-Ullmann I haven't looked at your snippet but this is my approach for such things.

        In on note on add the note number to an array, then sort the array ascending and only play the note in element 0.

        In on note off remove the note from the array.

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

        Oli UllmannO 1 Reply Last reply Reply Quote 0
        • Oli UllmannO
          Oli Ullmann @d.healey
          last edited by

          @d-healey Thank you for your answer! :-)

          Is that what you mean?

          // onInit
          Synth.deferCallbacks(false);
          
          reg notes = [];
          
          // onNoteOn
          	notes.push(Message.getNoteNumber());
          	
          	notes.sort();
          
          	Message.setNoteNumber(notes[0]);
          
          // onNoteoff
          	notes.remove(Message.getNoteNumber());
          
          

          Unfortunately, it still doesn't work for notes that are lower than the first note pressed. For example, if I play C3, hold the note down and then add G2, C3 will still be played.

          If I press a complete chord at the same time, this solution will also play all the notes.

          Or am I doing something wrong?

          Thank you very much
          Oli

          LindonL d.healeyD 2 Replies Last reply Reply Quote 0
          • LindonL
            Lindon @Oli Ullmann
            last edited by Lindon

            @Oli-Ullmann

            Synth.deferCallbacks(false);
            
            reg notes = [];
            
            // onNoteOn
            
                     // if this note is higher than the current playing note - ignore it...
            
            
            	notes.push(Message.getNoteNumber());
            	
            	notes.sort();
            
            	Message.setNoteNumber(notes[0]);
            
                   // turn off the currently playing note here.....
            
            // onNoteoff
            	notes.remove(Message.getNoteNumber());
                  //check to see if there is still anything to play, if so and we are not playing it then play the lowest note...
            

            HISE Development for hire.
            www.channelrobot.com

            1 Reply Last reply Reply Quote 1
            • d.healeyD
              d.healey @Oli Ullmann
              last edited by

              @Oli-Ullmann Here's a method that will work. I've put it in a separate MIDI processor because the UI script should be deferred. I'm using a const instead of a reg for the array.

              I'm also setting some values to -1 as you'll see to avoid hanging note issues. Synth.isArtificialEventActive() Should be able to be used instead but I find it's not reliable so I do it manually.

              HiseSnippet 1220.3oc6W01aZbDDdOvWUORSUSUTU+P+vUopHbkCBrcLNxxJFiwInZbPFhakhhhVe2bvJur608VnEUk+i8eP+Kj+AsydGvcDisoj9hTa3CV2N6L67rOyK631JoGDEIUDqBcGGBDqOwtyXgte89Tlfz7Hh0WYWSE5dD.gPj18ToFb6Z95P2xUHGNNjFEA9DKq7O0XgkyZj3eu8IGR4TgGjJhPNWx7fSXCX5TosO36Xb9wTenKaPFs29fldRQcIWNDQWd6xjPp2kzdvoTiZ4rIOiF0mX8s1k2tRPviqRq5Aatse0c1rJ3eArY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3DLwipPdBVQtnxxyE2T75KsSfqqoXz8+FM0y++yl5mIGpYhdsnXh5OiCZfCm0A6k5AHRDBfaF9vJmoeXx5xl0IMSE9wK9c72jMqXVaMYyJS27eDeLf5oju1KYrJSt7GGKAu2h3+UeG6Vl0tUHwiZkMFO.6J9ZOu4OpqX3lqpgaspFt8pZ3iVUC2YUMr5pZ3t2tglGspMTKGjTxRHsZ2HdNUKqFBJlwGWcP9CLtmnnE
              

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

              Oli UllmannO 1 Reply Last reply Reply Quote 0
              • Oli UllmannO
                Oli Ullmann @d.healey
                last edited by

                @d-healey Thank you for your approach. Unfortunately, it still doesn't work when I load an apeggiator.

                If I load the arpeggiator into the SineWave generator and press a chord, it stops immediately.

                If I load the arpeggiator into the main container, the note that was held first continues to play.

                However, I will try to find a solution based on your approach.

                Thank you very much! :-)

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

                  @Oli-Ullmann You might have to ignore the incoming note and play a new note instead - I'm not sure though as I haven't messed with the arp much.

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

                  Oli UllmannO 1 Reply Last reply Reply Quote 1
                  • Oli UllmannO
                    Oli Ullmann @d.healey
                    last edited by

                    @d-healey Yes, I will try that.

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

                    26

                    Online

                    1.7k

                    Users

                    11.8k

                    Topics

                    102.3k

                    Posts