• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2026 Replies
  • 331 Replies
    1928 Replies

Microphone Use within FLASH

User avatar
hungryhounduk
VIP - Site Partner
Posts: 2870

Microphone Use within FLASH

Tue Jan 12, 2010 12:41 pm

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
Posts: 415

Re: Microphone Use within FLASH

Mon Jan 24, 2011 10:21 am

thanks for the tut!
------------------------------------------------------------------------------
Proprogrammer, not just a Programmer.

User avatar
Usman55
VIP - Site Partner
Posts: 2821

Re: Microphone Use within FLASH

Mon Jan 24, 2011 12:09 pm

Check the date dude! This is the second time you did this today. First spamming, and now bumping.
Image

Post Reply

Return to “Tutorials”