We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello.
I have a few months of experience with Processing, but I guess that this is an algorithm related question.
So, I have a processing project that plays sounds when the user press some PAD on MIDI or even KEYBOARD and I want to try to play a beap continuously according to BPM.
What I have tried:
import processing.sound.*;
SoundFile beap;
int bpm = 95;
int secs = 1;
void setup() {
frameRate(60);
fullScreen();
beap = new SoundFile(this, "sounds/bip.mp3");
}
void draw(){
secs++;
beap.play();
}
But, this of course plays beap continuously. Anybody can help me?
NOTE: changing frameRate();
does not help because it'll mess with rendering graphics.
Thanks
Answers
Do you need a timer?
https://www.google.com.br/search?client=safari&rls=en&q=timer+site:processing.org&ie=UTF-8&oe=UTF-8&gfe_rd=cr&ei=8vuaVsOWMomq8weMhbCADw
Yes, I actually need a timer, thanks. But, what I am searching for is a way to do something like this: 80BPM or this
something like this, but I think this is not very precise.
How would you adapt the above code to add a slider enabling the user to change the BPM?
Have the slider change the bpm value, then recalculate interval. How will you create the slider? There are some GUI libraries that allow you to easily implement sliders.