We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › Sync digital switch with Timer/timed sequence
Page Index Toggle Pages: 1
Sync digital switch with Timer/timed sequence (Read 1364 times)
Sync digital switch with Timer/timed sequence
Nov 24th, 2008, 2:01am
 
Hi,

New to Processing...

I would like to use Processing to create a dance pad game... and would love some advice (free code?) on how to synch up a digital input against a timed piece of music.  

So when the digital switch is input at the right time in the music, I can program processing to draw stuff and provide visual feedback.

This is probably a simple couple of lines, but again I'm a newbie...

Any ideas?  THANKS!!!
Re: Sync digital switch with Timer/timed sequence
Reply #1 - Aug 28th, 2009, 4:26pm
 
Did you ever figure this out? I am interested in the same process....
Re: Sync digital switch with Timer/timed sequence
Reply #2 - Aug 28th, 2009, 5:21pm
 
if you know how many milliseconds == a beat in your music, you should be able to use millis() --

(if millis() - lastBeat >= beatTime){
   lastBeat = millis();
   dostuff();
}

but if you're talking about a beat detection library, I don't know whether that reports in milliseconds.

--Ben
Page Index Toggle Pages: 1