Forum
    • Categories
    • Register
    • Login

    Creating a MIDI copier/transposer in HISE

    Scheduled Pinned Locked Moved Scripting
    11 Posts 3 Posters 89 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.
    • David HealeyD
      David Healey @flameshower
      last edited by

      @flameshower said in Creating a MIDI copier/transposer in HISE:

      and places the note at the same position in the track.

      This part you can't do. It's not possible to write to a DAW's MIDI tracks from a plugin.

      Free HISE Bootcamp Full Course for beginners.
      YouTube Channel - Public HISE tutorials
      My Patreon - HISE tutorials

      F 1 Reply Last reply Reply Quote 1
      • F
        flameshower @David Healey
        last edited by

        @David-Healey Got it. Would it be possible to play the note in the track, plus the 2nd harmonic at the same time?

        Like, it would play the note's 2nd harmonic at the same time without writing it to the track?

        David HealeyD 1 Reply Last reply Reply Quote 0
        • David HealeyD
          David Healey @flameshower
          last edited by

          @flameshower Yes you can do that. Synth.playNote() is probably what you need there.

          Free HISE Bootcamp Full Course for beginners.
          YouTube Channel - Public HISE tutorials
          My Patreon - HISE tutorials

          F 2 Replies Last reply Reply Quote 1
          • F
            flameshower @David Healey
            last edited by

            @David-Healey Ok, so

                if(note.isNoteOn()) {
            	    
                
            	    Console.print(note.dump());
                	Console.print("Before: " + note.getNoteNumber()); 
               
                	//note.setNoteNumber(note.getNoteNumber() + 12);
                	Synth.playNote(note.getNoteNumber(), note.getVelocity());
                	Synth.playNote(note.getNoteNumber()+12, note.getVelocity());
                	Synth.playNote(note.getNoteNumber()-12, note.getVelocity());	    				      
            
            
            	    Console.print("After: " + note.getNoteNumber()); 
            	     
                } 
            

            The issue now is whenever I click Compile, it always hangs on the first note, never going to the second. I have to turn off the synth module to get it to stop. What's the fix? I'm a beginner here, so I'm in need of help with this lol

            David HealeyD 1 Reply Last reply Reply Quote 0
            • David HealeyD
              David Healey @flameshower
              last edited by

              @flameshower said in Creating a MIDI copier/transposer in HISE:

              if(note.isNoteOn()) {
              

              What is note?

              Free HISE Bootcamp Full Course for beginners.
              YouTube Channel - Public HISE tutorials
              My Patreon - HISE tutorials

              F 1 Reply Last reply Reply Quote 0
              • F
                flameshower @David Healey
                last edited by

                @David-Healey

                Content.makeFrontInterface(600, 600);
                const lookAndFeel = Engine.createGlobalScriptLookAndFeel();
                const var MIDIPlayer1 = Synth.getMidiPlayer("MIDI Player1");
                const var track = MIDIPlayer1.getEventList(); // The notes to be transposed up 1 octave
                
                
                /* Grab note, create second harmonic of note
                playing at same time of it
                O(n) complexity
                */
                Console.print("-------------------------------------");
                for(note in track)
                {
                    if(note.isNoteOn()) {
                	    
                    
                	    Console.print(note.dump());
                    	Console.print("Before: " + note.getNoteNumber()); 
                   
                    	//note.setNoteNumber(note.getNoteNumber() + 12);
                    	Synth.playNote(note.getNoteNumber(), note.getVelocity());
                    	Synth.playNote(note.getNoteNumber()+12, note.getVelocity());
                    	Synth.playNote(note.getNoteNumber()-12, note.getVelocity());	    				      
                
                
                	    Console.print("After: " + note.getNoteNumber()); 
                	     
                    }  
                }
                // 3. Flush the processed list back to the MIDI file
                MIDIPlayer1.flushMessageList(track);
                
                David HealeyD 1 Reply Last reply Reply Quote 0
                • David HealeyD
                  David Healey @flameshower
                  last edited by David Healey

                  @flameshower Oh you're using the MIDI player, when you said track I assumed you were referring to a DAW track. In that case what you originally wanted might be possible.

                  You've put it all in on init though, so that will only run when the plugin is first loaded (or you click compile).

                  Free HISE Bootcamp Full Course for beginners.
                  YouTube Channel - Public HISE tutorials
                  My Patreon - HISE tutorials

                  F 1 Reply Last reply Reply Quote 0
                  • F
                    flameshower @David Healey
                    last edited by flameshower

                    @David-Healey

                    As an aside: I plan on exporting this to Ableton, so eventually the plugin will load MIDIs from DAW tracks.

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

                      @flameshower here you go - you should be able to work it out from this:

                      HiseSnippet 1053.3oc4W0sahaDEdLfWUXaW0sZUUuzWz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AZzX7y.9uI3HO0MZy2jORvEAyzWzjsC3bpRxlNkJyh8BSnCUJ3EioZdwAmS8n3rcye4Am.cgXITmnaXs3e9SwJ775KLSfqkdxz5+FL7k++IC+4hHEiOcDFZT+U3+G.OBxAHVIT.IbN0C1HSiRZxwD4VZ4DlUtarveAeVZzVKarzn8MF+frG9XhT7FRx6sz8xeTrFHu4w+Erpv+EDjsrQwuAK6YrOvJ9FBI+Rcu.auoA1YSCb6MMvc1z.2cSCbuMMvtqNP8kVGFoD9IirHznw8iezpgQeNF53imNP+M.Icpm3
                      

                      HISE Development for hire.
                      www.channelrobot.com

                      1 Reply Last reply Reply Quote 0
                      • F
                        flameshower @David Healey
                        last edited by

                        @David-Healey An issue I run into now is when

                        
                        function onNoteOn()
                        {
                        	
                        for (note in track) {
                        	if (note.isNoteOn()) {
                        		Console.print(note.dump());
                        	    Console.print("Note: " + note.getNoteNumber()); 	
                        	    //Synth.playNote(note.getNoteNumber(), note.getVelocity()+1);
                        	    //Synth.playNote(note.getNoteNumber()+12, note.getVelocity()+1);
                        	    //Synth.playNote(note.getNoteNumber()-12, note.getVelocity()+1);
                        	}	    				      
                        		//Synth.noteOffByEventId(note.getEventId());
                        	}    	
                        }
                        
                        function getNoteOn(list, noteOn)
                        {
                            for(note in track)
                            {
                                if(note.isNoteOn() && note.getEventId() == noteOn.getEventId())
                                    return note;
                            }
                        }
                        MIDIPlayer1.flushMessageList(track); 
                        

                        I uncomment any of the synth.playNote function calls, it plays very distorted, notes playing for far longer than they are supposed to, like I mentioned earlier.

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

                        22

                        Online

                        2.1k

                        Users

                        13.0k

                        Topics

                        113.0k

                        Posts