HISE Logo Forum
    • Categories
    • Register
    • Login

    Drum Mapping- user defined

    Scheduled Pinned Locked Moved General Questions
    drum mapping
    40 Posts 5 Posters 2.6k 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.
    • d.healeyD
      d.healey
      last edited by d.healey

      @jssrecording When you say print note 48 - what do you mean? The only reference I see to note 48 is in your button callback which isn't linked to onNoteOn as far as I can tell.

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

      jssrecordingJ 1 Reply Last reply Reply Quote 0
      • jssrecordingJ
        jssrecording @d.healey
        last edited by

        @d-healey This is the section that multiplies the * 12 from note 36 to = 48. It's in the onNoteOn section.
        But what I mean by print is record a midi note on 48. It currently records note to 36. Which I know is obvious because I'm hitting the note 36 C1 on the keyboard. But I want is it to record note 48 C2.

        Synth.playNote((Message.getNoteNumber() + (currentSelectRow * 12)), 127);
        
        d.healeyD 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @jssrecording
          last edited by

          @jssrecording There is no MIDI out from HISE, only audio. So you'll only record in your DAW the key that you press.

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

          jssrecordingJ 1 Reply Last reply Reply Quote 0
          • jssrecordingJ
            jssrecording @d.healey
            last edited by

            @d-healey Okay thanks David! Will probably do some refactoring with my sample structure layout.

            1 Reply Last reply Reply Quote 0
            • Dan KorneffD
              Dan Korneff
              last edited by

              Here was my solution to custom midi mapping

              HiseSnippet 1836.3oc4X0sSabDEdWLaRX.GkzzH0dS0VSu.ZAhW9IglnnXv1PoI.VwDZkpqRW1cLdD6Ni0tiIPiPpR8cnW1mkbQe.5iPeDxaP6Yl8e7ZhcRHsREYALmYNy7c9Nyb9wM7XVXeelmh5D6cZWrh5TZMOkx6TsiIgprUME0qqssoOG6oGHZ8S6Z56isUTUKro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J6keBssEi0i+RcEbCz8F44VVBxddCEk70XwQVikFYMVdj0XkQVi6NxZbuQViUu.MDoNWqGm4F7zCDzntrVDU03uGG0BJ+il.K1k
              

              Dan Korneff - Producer / Mixer / Audio Nerd

              1 Reply Last reply Reply Quote 1
              • gorangroovesG
                gorangrooves
                last edited by gorangrooves

                @d-healey Hey David. I was wondering if you could please give me nudge here. I managed to get your basic code going (by removing "Ignore events" line from OnNoteOn).
                What I am trying to accomplish is to have a note transposed to a user-defined note. I added a Combobox with ID ComboBoxKickMidi. The combobox contains a list of notes that can be selected (C0, C#0...).

                This is the jambalaya code I came up with which, to my surprise, is not working 😂

                OnInit

                const var map = Engine.createMidiList();
                
                //Add another line for each note you want to remap
                
                map.setValue(KickNumber, 36); //Set kick value
                
                const var KickNote = Content.getComponent("ComboBoxKickMidi"); // Declare combobox
                

                OnNoteOn

                function onNoteOn()
                {
                   
                   local KickNumber = Message.getNoteNumber() + 1;
                    
                	if(KickNumber == KickNote.getValue())
                    {
                        Message.setNoteNumber(map.getValue(Message.getNoteNumber()));
                    }
                }
                

                The error message I get with regards to map.SetValue line:

                Interface:! Line 1217, column 13: API call with undefined parameter 0
                

                What do I need to change to get this going?

                Thank you!

                Goran Rista
                https://gorangrooves.com

                Handy Drums and Handy Grooves
                https://library.gorangrooves.com

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

                  @gorangrooves

                  Line 1217, column 13:

                  This implies you haven't posted all of the code... I have no idea what that error is referring to because I don't know what's on Line 1217.

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

                  1 Reply Last reply Reply Quote 0
                  • gorangroovesG
                    gorangrooves
                    last edited by

                    @d-healey The line in question is this one:

                    map.setValue(KickNumber, 36); //Set kick value
                    

                    When removed, all other lines compile OK.

                    Goran Rista
                    https://gorangrooves.com

                    Handy Drums and Handy Grooves
                    https://library.gorangrooves.com

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

                      @gorangrooves What is KickNumber?

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

                      gorangroovesG 1 Reply Last reply Reply Quote 0
                      • gorangroovesG
                        gorangrooves @d.healey
                        last edited by

                        @d-healey If you look at the OnNoteOn section, I introduced it there. It is supposed to be a numerical value that is calculated from a note that user selects (ex. User selects C0, it gets turned into midi note 36).

                        Goran Rista
                        https://gorangrooves.com

                        Handy Drums and Handy Grooves
                        https://library.gorangrooves.com

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

                          @gorangrooves said in Drum Mapping- user defined:

                          local KickNumber = Message.getNoteNumber() + 1;

                          I'm currently making a video on this exact subject!

                          A local variable only exists between the {} where it's declared. It is local to the code block. So you can't access that variable anywhere else. You need to declare your script-wide variables in on init.

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

                          1 Reply Last reply Reply Quote 0
                          • gorangroovesG
                            gorangrooves
                            last edited by

                            @d-healey I understand. Thank you. So, I would use this in OnInit?

                            var KickNumber = Message.getNoteNumber() + 1;
                            

                            Goran Rista
                            https://gorangrooves.com

                            Handy Drums and Handy Grooves
                            https://library.gorangrooves.com

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

                              @gorangrooves Message.getNoteNumber(); only works in on note on and on note off.

                              You need to create a variable in on init. Something like this

                              reg kickNumber

                              You should use a reg variable because it is more efficient for variables that will be accessed in real-time callbacks such as on note.

                              Then inside on note you will save the note number in that variable.

                              function onNoteOn()
                              {
                                  kickNumber = Message.getNoteNumber() + 1;
                              }
                              

                              This - map.setValue(KickNumber, 36); - won't work in on init though because kickNumber will be undefined.
                              So you'd probably need to set it in on note. But if you're doing that then there's probably no point in using the map variable at all. You might as well just use Message.setNoteNumber(36); I would think.

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

                              gorangroovesG 1 Reply Last reply Reply Quote 0
                              • gorangroovesG
                                gorangrooves @d.healey
                                last edited by

                                @d-healey Thank you for the explanation. I will play with and report back.

                                Goran Rista
                                https://gorangrooves.com

                                Handy Drums and Handy Grooves
                                https://library.gorangrooves.com

                                1 Reply Last reply Reply Quote 1
                                • gorangroovesG
                                  gorangrooves
                                  last edited by

                                  @d-healey So, I managed to get this working, to my great surprise :) It is all thanks to you! I have another challenge to solve with this.

                                  Here is the code I currently have:

                                  OnInit

                                  const var map = Engine.createMidiList();
                                  reg KickNumber;
                                  const var KickKey = Content.getComponent("ComboBoxKickMidi"); // Declare combobox
                                  
                                  reg SnareNumber;
                                  const var SnareKey = Content.getComponent("ComboBoxSnareMidi"); // Declare combobox
                                  

                                  OnNoteOn

                                  function onNoteOn()
                                  {
                                     //----kick mapping----------
                                     KickNumber = Message.getNoteNumber() + 1;
                                      
                                  	if(KickNumber == KickKey.getValue())
                                      {
                                          Message.setNoteNumber(36);
                                      }
                                      
                                      //----snare mapping----------
                                     SnareNumber = Message.getNoteNumber() + 1;
                                      
                                  	if(SnareNumber == SnareKey.getValue())
                                      {
                                          Message.setNoteNumber(38);
                                      }
                                  }
                                  

                                  Here is what is happening now...
                                  By default, the Kick is C1 and snare D1. If I set the Kick to B0, the kick will sound when pressing either B0 or C1.
                                  However, if I now set the snare to C1 (kick's default note), then all 3 notes (B0, C1, D1) will now trigger the snare!

                                  The ideal scenario would be that once a note is set for an instrument, it would only play on that set note and the default note would now be freely available for another instrument to use. In the above example, B0 should trigger kick, C1 should trigger snare and no note will sound on D1.

                                  Is this achievable and if so, any idea of how I would go about it?

                                  Thank you!

                                  Goran Rista
                                  https://gorangrooves.com

                                  Handy Drums and Handy Grooves
                                  https://library.gorangrooves.com

                                  LindonL 1 Reply Last reply Reply Quote 0
                                  • LindonL
                                    Lindon @gorangrooves
                                    last edited by

                                    @gorangrooves this is pretty simple isnt it?

                                    on init:

                                    reg KickLocation = 36;  //where the kick actually is
                                    reg KickTrigger = 54;   //the note that triggers a kick
                                    
                                    reg SnareLocation = 38;  //where the snare actually is
                                    reg SnareTrigger = 56;   // the note that triggers a snare
                                    

                                    on note on:

                                    	if (Message.getNoteNumber() == KickTrigger)
                                              {
                                    	      Message.setNoteNumber(KickLocation);  
                                    	  };
                                    	
                                    	
                                    	if (Message.getNoteNumber() == SnareTrigger)
                                               {
                                    	      Message.setNoteNumber(SnareLocation);  
                                    	   };
                                    

                                    Or did I mis-understand your requirement?

                                    HISE Development for hire.
                                    www.channelrobot.com

                                    gorangroovesG 1 Reply Last reply Reply Quote 0
                                    • gorangroovesG
                                      gorangrooves @Lindon
                                      last edited by

                                      @Lindon Thanks. I think your solution will achieve the same result that I currently have, but without the ability for a user to pick a note. What I am trying to do is use a combobox within the interface to pick a note that should trigger a particular instrument (kick, snare etc.). I got the basic function for that working.

                                      The challenge now is to refine it to do this:

                                      By default, the Kick is C1 and snare D1. If I set the Kick to B0, the kick will sound when pressing either B0 or C1.
                                      However, if I now set the snare to C1 (kick's default note), then all 3 notes (B0, C1, D1) will now trigger the snare!

                                      The ideal scenario would be that once a note is set for an instrument, it would only play on that set note and the default note would now be freely available for another instrument to use. In the above example, B0 should trigger kick, C1 should trigger snare and no note will sound on D1.

                                      Goran Rista
                                      https://gorangrooves.com

                                      Handy Drums and Handy Grooves
                                      https://library.gorangrooves.com

                                      LindonL 1 Reply Last reply Reply Quote 0
                                      • LindonL
                                        Lindon @gorangrooves
                                        last edited by

                                        @gorangrooves then just add a call back for the combobox that sets the trigger value..

                                        inline function onmyKickComboBoxControl(component, value)
                                        {
                                        	KickTrigger = value;
                                        };
                                        
                                        Content.getComponent("myKickComboBox").setControlCallback(onmyKickComboBoxControl);
                                        

                                        HISE Development for hire.
                                        www.channelrobot.com

                                        gorangroovesG 1 Reply Last reply Reply Quote 0
                                        • gorangroovesG
                                          gorangrooves @Lindon
                                          last edited by

                                          @Lindon Thank you!

                                          I tried it, but unfortunately, it still produces exactly the same results. The issue still remains that a user-selected note is in addition to the default note for a particular instrument. So, if default note for kick is C1 and user select E0, now we have the kick sounding when pressing either E0 or C1. It doesn't free up the original kick default note to used by another instrument.

                                          The issue gets more complicated when we introduce a second note. Lets say we have the snare by default at D1. If a user selects snare note now to be C1 (default note of the kick), now there is no kick sound! Snare is heard when pressing either E0, C1 or D1.

                                          How do we go about having a user select a note for each instrument and that note being the sole note which triggers a particular instrument?

                                          Goran Rista
                                          https://gorangrooves.com

                                          Handy Drums and Handy Grooves
                                          https://library.gorangrooves.com

                                          1 Reply Last reply Reply Quote 0
                                          • gorangroovesG
                                            gorangrooves
                                            last edited by

                                            Updated code:

                                            On Init

                                            Engine.createMidiList();
                                            
                                            //kick    
                                            inline function onComboBoxKickMidiControl(component, value)
                                            {
                                            	reg KickTrigger = value;
                                            };
                                            
                                            Content.getComponent("ComboBoxKickMidi").setControlCallback(onComboBoxKickMidiControl);
                                            
                                            //snare
                                            
                                            inline function onComboBoxSnareMidiControl(component, value)
                                            {
                                            	reg SnareTrigger = value;
                                            };
                                            
                                            Content.getComponent("ComboBoxSnareMidi").setControlCallback(onComboBoxSnareMidiControl);
                                            

                                            On Note On

                                            //----kick mapping----------
                                               if (Message.getNoteNumber() +1 == KickTrigger)
                                                      {
                                            	      Message.setNoteNumber(36);  
                                            	  };
                                                
                                                //----snare mapping----------
                                                if (Message.getNoteNumber() +1 == SnareTrigger)
                                                {
                                                    Message.setNoteNumber(38);
                                                }
                                            

                                            Goran Rista
                                            https://gorangrooves.com

                                            Handy Drums and Handy Grooves
                                            https://library.gorangrooves.com

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

                                            56

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.7k

                                            Posts