PDA

View Full Version : playing video based on ambient mic levels


delusional
04-06-2005, 04:11 PM
Hi,

I'm trying to help a friend write what should be a fairly simple flash app for her degree. She needs an app that plays a video snippet from a limited selection depending on the volume levels of an ambient mike, however we can't seem to get it to react to the mic at all. Below is a section of the actionscript we're using, mostly pilfered from other projects:

stop();

this.createEmptyMovieClip("mikeInput", 1000);
mikeInput.attachAudio(Microphone.get());

// set microphone parameters

gameMike = Microphone.get();
gameMike.setRate(5);
gameMike.setUseEchoSuppression(1);
gameMike.setGain(85);

// if the mike activity level reaches maximum go to endFrame
this.onEnterFrame = function() {

vol = gameMike.activityLevel;

if (vol > 25) {

if (vol < 31) {

cantHear.gotoAndPlay(1);
} else {

shutUp.gotoAndPlay(1);
}

}
}

Any help/advice on how to get this to work appreciated.