Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Turning on (& off) a webcam reacting to sound

$
0
0
Hello guys,
I am trying to build a sketch where a webcam can be triggered on by using the audio: If the webcam records a audio volume of 'x' the webcam turns on. When it reaches this level again it will go off. 
I've already made such a sketch in Max MSP but I want to figure out how to make it in Processing, never worked with the program before so I am a complete stranger.

The code i've found was one which turned a webcam off after a mouseclick;
  1. import processing.video.*; 
  2. Capture cam; 
  3.  
  4. void setup() { 
  5.   size(640, 480); 
  6.   cam = new Capture(this);
  7.   cam.start(); 
  8.  
  9. void draw() { 
  10.   if (cam.available()) { 
  11.     // Reads the new frame
  12.     cam.read(); 
  13.   } 
  14.   image(cam, 0, 0); 

  15. void mousePressed() {
  16.   cam.stop();
  17. }

Viewing all articles
Browse latest Browse all 1768

Trending Articles