Page 1 of 1

Microphone Use within FLASH

Posted: Tue Jan 12, 2010 11:41 am
by hungryhounduk
Hi All

Here is a cool Tutorial on using your Microphone in Flash



1.Open up Flash and create a new file.

2. Set the width and height to 300 x 200

3. Draw a medium-sized circle using the circle tool from your toolbox

Image

*Once you have drawn your circle, you will need to make the circle a movie clip.

4. Select your circle and press F8 or go to Modify | Convert to Symbol. From the dialog box that appears, select Movie clip and press OK.

5. We will need to now give our movie clip an instance name. Select your circle again, look in the bottom-left hand side of your screen where the Properties panel lives, and enter circle as the < Instance Name >.

6. Now, on the first frame of your movie, we can now add some ActionScript. Select the first frame in your timeline and press F9

Enter the following code:
Code: Select all
m = Microphone.get(); 
attachAudio(m); 
m.setUseEchoSuppression(false); 
onEnterFrame = function () { 
circle._xscale = circle._yscale = m.activityLevel+50; 
}; 
Test your movie by previewing this page in your browser. Go to File | Publish Preview | HTML.

Image

*Is that COOL or What cooll;

Code Explanation

I will explain what the function of each line in the tutorial is:

m = Microphone.get();

This tells flash to start taking input from the microphone connected to the computer.

_root.attachAudio(m);

This line attaches the audio to the _root, so that every object can access it with the object 'm'.

m.setUseEchoSuppression(false);

This prevents that awful echo from happening, and it is also accessible in the flash movie properties and settings.


onEnterFrame = function () {
circle._xscale = circle._yscale = m.activityLevel+50;
};

This section of code scales our circle movie clip based on the activity (noise) level of our microphone. The activityLevel command returns a value between 0 and 100, depending on the microphone input. In order to get an activity level of 0, your microphone should be really REALLY good!

*SWF File Attachment Below and the Flash 8 Source File

Enjoy cooll;

Chris

Re: Microphone Use within FLASH

Posted: Mon Jan 24, 2011 9:21 am
by Proprogrammer
thanks for the tut!

Re: Microphone Use within FLASH

Posted: Mon Jan 24, 2011 11:09 am
by Usman55
Check the date dude! This is the second time you did this today. First spamming, and now bumping.