It is also possible to access some information about microphone
input, although it is not possible to record without the use of a
remote server like the Flash Media Server, nor is it currently
possible to use
computeSpectrum() to analyze the waveform,
as demonstrated with MP3 source material. Instead, we can reflect
something akin to the amplitude of the sound, which, in the parlance
of the ActionScript 3.0
Microphone class, is called
Much of the code in this example will be familiar to you by now, so we'll jump right in to explain the microphone.fla source file. The first six lines of this script are important in that they initialize the microphone for use.
Line 1 creates an instance of the microphone using the
getMicrophone() method of the
order to work with the data of the microphone, you'll need to loop it
back into Flash, in line 2. When doing so, it is best to use echo
suppression, shown in line 3, to minimize feedback from your speakers
during recording. Finally, lines 4 through 6 initialize the gain
(amplitude of the recording), sample rate (11.050 kHz for basic voice
input), and silence level. The latter is a convenient filter, if you
will, to tell Flash what level of input, sustained for how many
milliseconds, should be ignored as inactivity. This helps reduce the
input of background noise.
1 var mic:Microphone = Microphone.getMicrophone(); 2 mic.setLoopBack(true); 3 mic.setUseEchoSuppression(true); ...