I see this code in another post about methods to improve midi timing. I need an app for a specific role that can't be done with my other programs like Logic. The goal is the have a 2 track sequence plus a metronome player, so 3 tracks playing at once. Using thread1 for metronome and thread2 for playing back chords is not usable. After hours of reading everything I can find I see some examples using an external app to do some work which claims better timing. This example does not allow for testing my own midi notes. Question: Is there a way to pass a helper app an array(ie sequence(0)) as taking time to save an array( midi track), BPM, plus start time to disk would produce unwanted additional latency. Second: Can a helper app be stopped by the main app. In their example they just have the help app die when it's done.
Ideally I want to send an array for midi playback, and give it a start time of currentTime + offset so that it gives the helper time to start and wait for a time ie 200ms in the future. Then the main app can allow recording midi on top of the other track and both be in sync against a known clock time. Likewise, send the helper app a start time, BPM, and have it play a metronome sound until the helper is told to quit. If there is no way to communicate from Main>helper to tell it to stop, and give it BPM, StartTime, anArray, then this wont work. Any suggestion welcome.
Load this example in a windowless app, call the app from main via this method:
Sub Thread1Run(Sender as Thread) dim s as new shell dim f as FolderItem = GetFolderItem("").child("notes.app") s.Execute("open "+f.ShellPath) End Sub
Noteplayer1 = New NotePlayer NotePlayer1.Instrument = 1 // Notes for Do Re Mi Fa So La Ti Do // see http://en.wikipedia.org/wiki/Do-Re-Mi from The Sound of Music http://en.wikipedia.org/wiki/The_Sound_of_Music // (C, D, E, F, G, A, B, C) Dim doReMi(7) As Integer doReMi = Array(60, 62, 64, 65, 67, 69, 71, 60) For Each note As Integer In doReMi NotePlayer1.PlayNote(note, 100) // Pause to let note play App.SleepCurrentThread(500) Next quit