Scrubbing video with Microphone input


#1

Hello!

I’m trying to create an animation that goes from very little complexity to very great complexity based on the volume level in a room.

I started with the processing.sound library and this basic tutorial for mic input: http://learningprocessing.com/examples/chp20/example-20-09-mic-input

I’m wondering if I could just create a video in After Effects, and then scrub the video with the mic input? Is this a possibility or should I just try to get the same effect with code?

Thanks!
Nick


#3

Depending on your animation, the video scrubbing approach is actually harder (and more computationally intensive / slower) than just rendering complexity based on volume level. Processing is made for that in a way that movie files are not.

First: Start by measuring the volume level using the Sound library or Minim library and drawing a small rectangle or circle for low volume, large for high volume.

Second: what kind of animation, what kind of “complexity”? Now that you have your input affecting your drawing, you can connect those two things.

float input;
void draw(){
  input = height/2 * (1 + sin(frameCount/20.0));
  background(0);
  ellipse(width/2, height/2, input, input);
}

#4

Another simple trick to generate complexity based on an input level is to draw a number of obejcts based on your input level – for example, a bunch of points in a random line, or a bunch of randomly placed circles, although the output needn’t be random, it could be geometric or fractal etc.

If you want the output to use random number but be stable (not jump around), call randomSeed() at the beginning of the frame. The result is a stable list of things that increase / decrease with your input level.

/**
 * RandomSeed Drawing
 * discourse.processing.org/t/scrubbing-video-with-microphone-input/8060/4
 */

float input;
int seed;

void setup(){
  size(300,300);
  noFill();
  seed = (int)(random(1024));
}

void draw(){
  background(192);
  randomSeed(seed);
  input = height/2 * (1 + sin(frameCount/50.0));
  beginShape();
  for(int i=0; i<int(input); i++){
    float x = random(width);
    float y = random(height);
    vertex(x, y);
    ellipse(x, y, input/3, input/3);
  }
  endShape();
}