Jump to content

arpeggio script with side chain


Recommended Posts

Hi,

Is there a midi script to get an arpeggio to run through its step with a trigger from another midi channel? eg play a chord with one hand on one zone of the keyboard and get it to arpeggiate in step with something played by the other hand. Thanks

Link to comment
Share on other sites

I've never scripted before but would like to give it a go if this one is not available. looking at the Simple Arpeggiator script, it looks like anything to do with timing would not be needed. 

I would need to define a note range from which any note pressed are added to array of notes to be arpeggiated. Another note range should be defined from which the note on and off would be assigned to the notes in the array. 

Any guidance or scripts that have some of these elements would be really welcome!

How would i restrict the array bit of the script (below) to a portion of the keyboard?

function HandleMIDI(event) {
    if (event instanceof NoteOn) {
        // add note to array
        activeNotes.push(event);
    }     
    else if (event instanceof NoteOff) {
        // remove note from array
        for (i=0; i < activeNotes.length; i++) {
            if (activeNotes.pitch == event.pitch) {
                activeNotes.splice(i, 1);
                break;
            }
        }
    }
    // pass non-note events through
    else event.send();
    
    // sort array of active notes
    activeNotes.sort(sortByPitchAscending);
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...