Jump to content

How to play various notes at same time?


Recommended Posts

Hi guys!

 

I need to play a undefined number of notes when a determined parameter has changed.

 

The note pitches is storaged in a global array, from a if statemend inside a HandleMIDI function. When a determined parameter has changed, i tryed to create another array inside of ParameterChanged function that recieves the Note objects created in a loop from each pitch storage in the global array.

 

But this code not works. Occurs a infinite loop with a lot of messages with NoteOn objects with undefined pitch numbers.

 

For example:

 

var
 key = [],
 
 // ... a lot of code supressed ...
 
function HandleMIDI (e) {
 if (GetParameter("Learning") == 1) {
   e instanceof NoteOn ? key.push(e.pitch) : undefined;
   Trace(key);
 }
 
 // ... a lot of code supressed ...
 
}

function ParameterChanged () {
 if (GetParameter("Playing") == 1) {
   var voicings = [];
   for (i = 0; i = key.length; i++) {
     voicings[i] = new NoteOn();
     voicings[i].pitch = key[i];
     voicings[i].send();
   }
}

 

There are a way to:

1. to store pitch notes

2. to create various NoteOn to play from the pitch notes storaged (in 1)

3. to play the notes created (2)

 

That is my question.

 

Thanks for help guys!!

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...