We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone,
At the moment I have a word that reacts to sound input from an external mic. The title really explains what I'm looking to do. I've been looking at 'delay()' as a a possible way to change the word every 10 seconds, but I honestly don't know where to start. I've looked at tutorials and other threads to no avail.
I'm thinking I create a string of words I want the sketch to cycle through, but as to how I link that to time I don't know. Or is it a case of creating separate classes?
Thanks for any help or pointers to tutorials that could help me!
Here's what I've done so far:
import ddf.minim.*;
import ddf.minim.analysis.*;
Minim minim; 
BeatDetect beat;
AudioInput in;
FFT fft;
float angle = 0;
PFont font1;
PFont font2;
PFont font3;
void setup()
{
  noCursor();
  fullScreen();
  smooth();
  minim = new Minim(this);
  in = minim.getLineIn();
  fft = new FFT(in.bufferSize(), in.sampleRate());
  frameRate(60);
  beat = new BeatDetect();
   beat.setSensitivity(100);
  font1=loadFont("Simplon.vlw");
  font2=loadFont("Simplon 50.vlw");
  font3=loadFont("Simplon 80.vlw");
}
void draw()
{
  noFill();
  background(255);
  fft.forward(in.mix);
  for (int i = 0; i < in.mix.size() - 1; i++) {
    angle = radians(i);
     textFont(font3);
    textSize(80);
    textAlign(CENTER, CENTER);
    fill(0);
    text("John", 
    width/2 +1000 *cos(angle)*(10*in.mix.get(i)), 
    height/2 -1000 *sin(angle)*(10*in.mix.get(i)));
  }
}
void keyPressed() {
  if (key == 's') {
    saveFrame("wallpapers/wallpaper-####.tif");
  }
}
            
Answers
@TypeCoding -- Don't use delay() -- that freezes your sketch.. Use a timer that checks millis() or frameCount().
For example:
Or: