robot music generator - keeps missing notes!

I'm having difficulties coding my program, I'd be grateful if someone could take a look for me.

There's a gremlin in the PlayPhrase() method - I think? What I'm trying to do is interlace 2 streams or phrases of notes - so my bot can play 2 notes at the same time.

I've been attempting to do this by using the millis() method to synchronize them - but I'm not too familiar with it.

Thanks code -> http://www.sonodrome.co.uk/log.pde

if (millis() - previousMillis == lengths[PlayNoteCounter] + gaps[PlayNoteCounter])

This is a problem. There is an assumption that millis will return consecutive values, thus an exact match will occur. But, millis does not return consecutive values.

That code should be written as:

if (millis() - previousMillis [glow]>[/glow]= lengths[PlayNoteCounter] + gaps[PlayNoteCounter])

Awesome, cheers - that looks a lot better!