Hi,

On Wed, 17 Oct 2001, Alexander R Angas wrote:

> On another thing, somehow in my implementation I've remove the need for the
> 'last_played' variable which kept track of what time the last note was played. I
> don't think I need it any more but I just wanted to check - is this bad??!

Let's just say that it doesn't help with accuracy.

If you do something regularly, and wait n milliseconds in between, the
time in between the somethings will be >=n, usually > n. Let's say that
the time that really is in between is n', so you'll "loose" d=n'-n. After
m calls, you will have lost D ~= m*d if you just keep saying "wait n
milliseconds".
However, if you keep calculating the ideal target time and subtract the
time last_played from it (and use this for delaying), you will get
a wait time <= n that helps reduce n' to a point where D ~= d, i.e. a
constant value.
It's the difference between being off by O(n) and being off by O(1).

llap,
 Christoph


Reply via email to