Problem releasing notes

I am using a variation of the @David-san “!Time Lapse to catch chords by David San.Rackspace”, I am trying to change and/or augment the chords being played. Obviously, I am having a difficult time understanding the role of the NoteTracker and its functions in my Scriptlet. I am trying to release all the notes that have been played and/or held but they are hanging on and I don’t know how to release them. I would appreciate advice on how to correct my problem and also a better understanding of NoteTracker (as I was not able to find a blog on NoteTracker). :slight_smile:

Phils Chord Expandsion.rackspace (27.1 KB)

Did I really do that? :thinking: Then, could you please post a valid link to this Rackspace.

I worked on Scriptlets with such mechanisms, but I only released the Secret Keys Switches which uses this kind of mechanism.

If you have a precise question about it, I will try to answer it. But, I won’t be able to explain everything about everything. :wink:

1 Like

Sure. Here is your original Rackspace:

David Sans - !Time Lapse to catch chords.rackspace (13.7 KB)

So, to be more specific with my question: I modified your original Rackspace Scriplet by Adding “SendNow(WithTranspose(m, -7))” in the NoteEvent callback. … and now I can’t turn the extra notes off? Here is my variation of your Rackspace:
!Time Lapse to catch chords by David - MODIFIED By Phil San.rackspace (25.5 KB)

Sorry, but where did you find this original rackspace? :thinking:

I am pretty sure you sent it to me … a long time ago when you were trying to help me solve the puzzle of detecting chords based on time lapse.

Really? Well, if you post the code in clear text we can have a look on it without being next to a GP computer, which is often my situation…

Sure. :slight_smile: Here is my Scriplet:

Var

  nt            : NoteTracker;
  notifyChord   : Boolean = false;
  
  timelapse     : double = TimeSinceStartup();

  // adjust this delay if necessary
  analysisDelay : double = 10.0;
  
Initialization
  SetTimersRunning(true);
End


Function DS_NoteTracker_GetStringOfNotes(nt : NoteTracker) Returns string
Var
  i            : Integer;
  nt_heldNotes : Integer Array = nt.NoteTracker_GetHeldNotes();
  stringOfNotes : string = "";
  
  For i=0; i<nt_heldNotes.Size(); i=i+1 Do
    stringOfNotes = stringOfNotes+NoteNumberToNoteName(nt_heldNotes[i])+"("+nt.NoteTracker_GetSpecificNoteOnCount(nt_heldNotes[i])+") - ";
  End

  result = stringOfNotes;

End

On NoteEvent(m : NoteMessage)

  SendNow(m);

  nt.NoteTracker_GotNote(m);

  Print("Number of different notes played : "+nt.NoteTracker_NoteOnCount() );
  Print(nt.DS_NoteTracker_GetStringOfNotes());
  Print("");    
  
  If nt.NoteTracker_NoteOnCount() >= 3
  Then 

/************************************************ I added the following line of code and now I can't release the note ************************/  
    SendNow(WithTranspose(m, -7)) // Also send a transposed note

    timelapse = TimeSinceStartup()+analysisDelay;
    notifyChord = true;
  Else
    notifyChord = false;
  End    
End

On TimerTick(ms : double)

 If notifyChord && nt.NoteTracker_NoteOnCount() >= 3 && ms > timelapse
 Then
   Print("");
   Print("*** "+nt.NoteTracker_NoteOnCount()+"-notes chord playing ***");
   Print("");
   notifyChord = false;
 End

End

Please bracket your scripts with triple backquotes so that they are displayed with formatting and proper indentation.

  1. Less than: <
  2. Back quote: `

Or you could edit your previous post with the script to see what I did to it :slight_smile:

A NoteTracker is a kind of array where you can keep a track of some notes to remember them.

I understand why you have stuck notes. You don’t have a GPScript issue, but an algorithmic issue. The only advice I can give you in this area is not to get into GPScript whose algorithmic complexity is beyond your control. Try to think more simply about what you would like to do. :wink:

1 Like

You are right, the situation was out of my control. So, I wrote the code from scratch without using NoteTracker and now it works great.

1 Like