Microphone Use within FLASH

3 posts Page 1 of 1
Contributors
User avatar
hungryhounduk
VIP - Site Partner
VIP - Site Partner
Posts: 2870
Joined: Mon Jul 27, 2009 11:58 am

Microphone Use within FLASH
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
You do not have the required permissions to view the files attached to this post.
Image
User avatar
Proprogrammer
VIP - Donator
VIP - Donator
Posts: 415
Joined: Sun Oct 03, 2010 11:14 pm

thanks for the tut!
------------------------------------------------------------------------------
Proprogrammer, not just a Programmer.
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Microphone Use within FLASH
Usman55
Check the date dude! This is the second time you did this today. First spamming, and now bumping.
Image
3 posts Page 1 of 1
Return to “Tutorials”