Creating a MIDI copier/transposer in HISE

Given a MIDI track, I want to write a function such that it takes the note at a given position, creates its 2nd harmonic note at the same position, and places the note at the same position in the track.

How would I go about doing this?

Here’s a basic transposer I have written so far. It doesn’t copy the notes, it just moves them up an octave.

for(note in track)
{
    if(note.isNoteOn()) {
	    
    
	    Console.print(note.dump());
    	Console.print("Before: " + note.getNoteNumber()); 
   
    	note.setNoteNumber(note.getNoteNumber() + 12);	    				      


	    Console.print("After: " + note.getNoteNumber()); 
	     
    }  
}

Read more here: Source link