Ben Osterhouse
Active Member
Hi!
I am working on a script which plays back the notes in a midi file. If you play a note, it will start playing back the midi file, at whatever pitch you played.
If notes overlap, it will continue in the midi file, not starting from the beginning again.
I'm doing this in the note callback by the way.
This example midi file has a note on every quarter note:
Here are some overlapping quarter notes going in, to trigger that midi file:
Here is the result:
Inconsistent! Huh...
What's happening is, sometimes the second note in the midi file is happening before the second played note.
It's happening 23 microseconds too early, so the pattern gets broken.
I know that wait and wait_ticks aren't super accurate. Certainly not this accurate, so it makes sense that you'd get this problem.
However, I was just realizing that the factory polystep script does a very similar thing to what I'm trying to do.
Does it have the same problem? No! Very interesting... So after a bunch of comparison, I realized, the only difference was that the polystep script uses the normal wait, instead of wait_ticks.
If I make the polystep script do wait_ticks, I get the exact same result as in my script!
And, I can fix my script by just using the normal wait
This is weird though... doing some tests to compare wait and wait_ticks, it looks like they basically have the same amount of precision. Looking at other threads on the forum, I'm seeing posts about wait_ticks, and it sounds like wait_ticks should be fine.
It broke the factory script though, so I don't know.
Are there issues with wait_ticks after all?
-Ben
I am working on a script which plays back the notes in a midi file. If you play a note, it will start playing back the midi file, at whatever pitch you played.
If notes overlap, it will continue in the midi file, not starting from the beginning again.
I'm doing this in the note callback by the way.
This example midi file has a note on every quarter note:
Here are some overlapping quarter notes going in, to trigger that midi file:
Here is the result:
Inconsistent! Huh...
What's happening is, sometimes the second note in the midi file is happening before the second played note.
It's happening 23 microseconds too early, so the pattern gets broken.
I know that wait and wait_ticks aren't super accurate. Certainly not this accurate, so it makes sense that you'd get this problem.
However, I was just realizing that the factory polystep script does a very similar thing to what I'm trying to do.
Does it have the same problem? No! Very interesting... So after a bunch of comparison, I realized, the only difference was that the polystep script uses the normal wait, instead of wait_ticks.
If I make the polystep script do wait_ticks, I get the exact same result as in my script!
And, I can fix my script by just using the normal wait
This is weird though... doing some tests to compare wait and wait_ticks, it looks like they basically have the same amount of precision. Looking at other threads on the forum, I'm seeing posts about wait_ticks, and it sounds like wait_ticks should be fine.
It broke the factory script though, so I don't know.
Are there issues with wait_ticks after all?
-Ben