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 & HelpSound,  Music Libraries › making drum machine w ess: tips to improve timing
Page Index Toggle Pages: 1
making drum machine w ess: tips to improve timing? (Read 418 times)
making drum machine w ess: tips to improve timing?
Aug 20th, 2008, 8:58am
 
It's pretty simple -- there's a 2d array to record the pattern
and a sample bank preloaded with sounds using ESS.
It checks the time elapsed for stepping.
It seems to work OK but flakes out at 180 bpm or so.
Any tips for improving the timing?
Thanks!
code section follows (this is inside draw())
---------------------------------------
  if (n >= last_clock + 60 * 1000 / (2 * bpm)) {
     cursor += 1;
     last_clock = n;
     for (int i = 0; i < sample_bank.length; i += 1) {
       if (grid[cursor % num_cols][i] == 1) {
         sample_bank[i].stop();
         sample_bank[i].play();
       }
     }
Page Index Toggle Pages: 1