![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Version 3.1Contents
|
The Setup window is divided into three tabs; Preferences, Registration and About. You can drag the Setup window using the title bar at the top. The Preferences tab contains settings for:
|
![]() |
The Registration tab allows you to enter your user name and serial number in order to register FlashAmp. Be sure to enter this information exactly as shown in your registration email – the safest way is to copy and paste each one. Click the Register button once you have entered the information. If the details are correct then you will see a confirmation alert and the About tab of the Setup window will automatically be displayed. The Registration tab is disabled when FlashAmp has been registered. Your registration details will be displayed in the About tab shown to the right. Click the OK button at the bottom of the window to close the Setup window and save any changes to the Preferences, or click the Cancel button to discard any changes. [Contents] |
Use the Select File button to choose a single sound file to process. The name of the file will appear in the text area next to the button. The location of the input file will be the default location of the output file produced by FlashAmp Pro but you can also set a different output directory in the Output panel.
Select the Batch button to choose the root folder for a batch process operation. Sub-folders will also be scanned for files to be processed. The complete list of files that will be processed can be viewed by selecting the View List button.
FlashAmp Pro will attempt to apply the current settings to all the files in a batch process operation. If any settings can not be applied to an individual file in the batch (if, for example, Stereo is selected in the Common panel and a mono file is encountered) then the default setting will be used and an error will be listed in a file called 'FlashAmp Error_log.txt' which will be created in the root folder selected for the batch process by default, or the chosen output folder if it has been selected in the Output panel. Any other errors will also be written to this file. If any errors occur then you will get an alert at the end of the batch operation.
Each output file in a batch operation will be created in the same folder as the input file unless an output folder is selected in the Output panel, in which case all output files (including the error log file) will be created in the selected output folder.
[Contents]
The common panel contains settings that are 'common' to all FlashAmp operations.
Frame Rate – if your sound is on the root timeline of your Flash movie then enter the frame rate of your Flash file into this field in order for synchronization between the sound and the arrays produced by FlashAmp Pro to be maintained during playback. If you are using the Flash sound object then you can set the frame rate to any value you want but it should be at least the same value as your Flash frame rate if you want to get a true representation of the sound's characteristics in Flash.
The Frame rate value determines the size of the "slices" that FlashAmp uses to scan the sound file so you can also think of it as setting the 'resolution' of the FlashAmp output data. The default value is 15fps.
The maximum possible Frame rate value depends on whether you are processing amplitude or spectrum data. For amplitude data the maximum frame rate is 100fps. For spectrum data the maximum frame rate depends on the sample rate of the sound being processed because FlashAmp Pro needs at least 1024 samples per frame to perform the spectrum analysis. The maximum spectrum frame rates for sample rates supported by FlashAmp Pro are shown in the table below.
Sample rate |
Maximum frame rate |
48000Hz |
46fps |
44100Hz |
43fps |
22050Hz |
21fps |
11025Hz |
10fps |
If you want a high frame rate in Flash then bear in mind that you can process the sound with a high sample rate in FlashAmp Pro and then use the same sound with a lower sample rate in Flash to reduce file size and download time.
Scale – enter the scale for the amplitude and spectrum values that FlashAmp Pro will produce, the default is 100. The maximum possible Scale value depends on whether you are processing amplitude or spectrum data. For amplitude data using 16bit sounds the possible range is 1 to 32767 and for 8bit sounds the range is 1 to 128. For spectrum data the maximum scale value is 32767. Generally, it usually makes sense to to get FlashAmp to scale the data to a value such as 100 so you can easily control animations in Flash.
Unless you have the DB Scale button switched on in the Amplitude panel then the values in the output data will be scaled from 0 (silence) to the set Scale value. The Scale entry field is disabled if the DB Scale button is on.
Mono/Stereo – FlashAmp Pro produces mono amplitude and spectrum arrays by default. If you are processing a stereo sound then the Stereo button will be enabled and selecting it will produce separate arrays for the left and right channels for both amplitude and spectrum data. If you select Mono when processing a stereo sound, then FlashAmp Pro will produce summed mono arrays for both amplitude and spectrum data. The Stereo button is also enabled for batch process operations, if it's on then stereo arrays will be generated for any stereo sound files and mono arrays will be generated for any mono sound files.
Normalize – switch this button on if you want FlashAmp Pro to normalize the sample values of the sound before processing the sound. Normalizing boosts the level of the sound so the loudest part is as loud as possible without clipping. So this option can be useful for sound files that are relatively quiet and it can result in a slightly larger dynamic range that will be reflected in the output values. Note that normalizing will result in increased processing time for FlashAmp Pro. The sound file is not updated with the normalized sample data.
[Contents]
This
panel holds all the settings for generating amplitude data.
Generate List – Switch this button on to tell FlashAmp Pro to create an amplitude array.
Smoothing – this 'smoothes out' the values in the amplitude array created by FlashAmp Pro. This creates a less jagged amplitude curve so you will get smaller steps in the amplitude values between frames in your Flash movie. Selecting 0 disables smoothing. Selecting 3, 5 or 7 instructs FlashAmp Pro to execute a 3, 5 or 7-point smoothing calculation on the amplitude curve. The higher the number, the greater the degree of smoothing. The effect of each setting is usually clear in the full waveform display in the Preview window.
DB Scaling – more correctly written as 'dB' scaling, this setting instructs FlashAmp Pro to use the decibel scale for amplitude values. This is a logarithmic scale that's a better representation of the way that humans perceive loudness than the default linear scale. It's typically used to implement VU meters. When using this option the amplitude values use a scale where 0 is loudest and anything above 50 can be regarded as very quiet.
Zero Ending – this setting effectively fades out the last 5 values in the the amplitude array to zero. This is handy for Flash lip-sync applications when you want to be sure that the character's mouth is shut when the sound finishes.
[Contents]
This panel holds all the settings for generating spectrum data.
Generate List – Switch this button on to tell FlashAmp Pro to create a spectrum array.
Bands – select the number of frequency bands that you want FlashAmp Pro to process. The available range is 2 - 16 bands, the default is 8. Unless the Log Bands button is switched on, or you have set custom band widths, then each band has an equal frequency range with all the bands spread over the total frequency range set by the Low and High frequency values in the entry fields below. The actual frequency ranges used in the spectrum calculation are shown in the Preview window and in the output data produced by FlashAmp Pro (see the Output Format section for more information).
Custom – this button opens the Preview window showing the custom band settings. See the Preview window entry for information on how to set custom band widths. Generally you will get good results using the default equally-spaced or logarithmic band widths in combination with the Low and High frequency range settings, so you won't need to use custom band widths unless you want to tweak the spectrum output or you need to use different band widths to the defaults. To the right of the Custom button is the Custom Status button which is a simple on/off toggle button. The Custom Status button is automatically switched on if you set custom band widths. You can toggle it off or on to tell FlashAmp Pro to ignore or use the current custom settings. If the Custom Status button is on then the Log Bands button is disabled.
Note that changes to any of the following settings will clear the current custom band widths:
Low frequency – this entry field holds the lowest frequency that will be used in the spectrum calculation. The minimum possible value is 20 Hz (this is also the default) and the maximum possible value is the value in the High frequency field minus the current frequency resolution (which is equal to the sound sample rate/1024). You should usually leave this value at the default of 20Hz in order to get all the lower frequencies included in the spectrum data generated by FlashAmp Pro.
High frequency – this entry field holds the highest frequency that will be used in the spectrum calculation. The maximum possible value is half the sound sample rate and the minimum possible value is equal to the Low frequency field plus the current frequency resolution (which is equal to the sound sample rate/1024). If you find that the upper frequency bands do not contain much activity then you can lower this value to exclude the higher frequencies from the spectrum data. Use the Preview window to help you find the upper limit that you want to use.
Log Bands – select this button to distribute the frequency ranges of the spectrum bands logarithmically rather than evenly. The lowest band will have a narrower frequency range than the next band with each band becoming progressively wider. This option can be useful for 'hifi' type eq displays.
Scale All – select this button to tell FlashAmp Pro to scale each band to the largest power value found in each band. This button is off by default, in which case the bands are scaled to the highest value found over all the bands. This relates to another important fact - that spectrum values generated by FlashAmp Pro do not reflect volume; they purely reflect relative frequency power. So if you process a quiet sound for spectrum values you will still get values that range up to the Scale value entered in the Common panel. This is true whether the Scale All button is on or off. In the vast majority of cases this is a good thing for Flash animations because it ensures that you will get the maximum possible variation in the spectrum output regardless of the volume level of the input sound.
The Scale All button should be used with caution because it results in data that does not accurately reflect the relative power of the spectrum bands but it can be useful for spectrum visualizations in some cases.
[Contents]
Switch on the Generate List button to tell FlashAmp Pro to create a cue points array. The input sound file must be either WAVE or AIFF format with cue points embedded within it. Note that some sound editors use the term 'Markers' instead of cue points. Cue points are useful if you want to trigger events within Flash at specific times during a sound such as switching between animated characters when using amplitude data for lip sync.
When the Fill Frames button is on then the array elements ('frames') between adjacent cue point names will be filled with the first cue point name. So, for example, with Fill Frames switched off a cue point array may look like:
["", "", "", "CuePoint_1", "", "", "", "CuePoint_2", "", "", "", "", "CuePoint_3", "", ""]
With Fill Frames on it will look like this:
["", "", "", "CuePoint_1", "CuePoint_1", "CuePoint_1", "CuePoint_1", "CuePoint_2", "CuePoint_2", "CuePoint_2", "CuePoint_2", "CuePoint_2", "CuePoint_3", "CuePoint_3", "CuePoint_3"]
This avoids the possibility of missing a cue point due to dropped frames as your Flash file is playing.
See the Cue Points section for more information.
[Contents]
This panel controls how the output file(s) are handled.
Create File – switch this on to generate output data files. If it's switched off then you can still access the output data using the View Data button in the Control panel below.
Format: #include/loadVars() – these buttons switch between the two output file types. See the Output formats section for more information about each format.
Select Folder – this allows you to set a specific folder as the destination for all output files. By default the output file is created in the same folder as the input sound file. When an output folder has been selected then a red dot will appear at the right end of the output path text area:
[Contents]
Process – this button will process the input sound file or batch using the current settings. The Progress bar will update. If the sound has been previewed and no settings have been changed then the output file will be created without the sound being re-processed.
Preview – opens the Preview window, processes the sound using the current settings and displays the results which will animate in sync with the sound as it plays. The Preview button is disabled during a batch operation. See the Preview window section for more information.
View Data – this button becomes active when a single input file has been processed. Selecting it will open the Output window which displays the data in a single text field. The data can be copied to the clipboard using Control-C on Windows or Command-C on Macintosh.
[Contents]
The Preview window displays the amplitude and spectrum results for the current settings as the input sound plays. This allows you to immediately check the output from FlashAmp Pro without having to load the data into Flash and publish. When the Preview window is open you cannot change any settings in the main FlashAmp Pro window.
If you are processing both amplitude and spectrum data then the Preview window will initially process and display the spectrum results as shown below.
![]() |
Title bar – click and drag to move the Preview window. |
![]() |
Display tabs – select a tab to switch between the Spectrum and Amplitude views. |
![]() |
Frequency range scale – displays the total frequency range used in the spectrum calculation set by the Low and High frequency fields in the Spectrum panel of the main FlashAmp Pro window. |
![]() |
Display area – the relative power of each band is shown as a blue bar inside the vertical red lines indicating the limits of each band. |
![]() |
Bandwidth frequencies – shown in Hz. The value indicates the starting frequency of each band. In this case, the first band occupies 20-1267Hz, the second band occupies 1268-2515Hz, and so on. If the display of frequencies causes the frequency labels to overlap then some frequencies may be shown as an 'x', in which case the frequency value will be displayed when you roll the mouse over the corresponding red band limit line. |
![]() |
Play/Stop button – switches playback of the input sound on or off. |
![]() |
Bands buttons - switches between the Default (even or log distribution as set in the Spectrum panel of the main FlashAmp Pro window) and Custom band widths. The display area will update to show the relevant data. |
![]() |
Scale buttons – switches between Linear and Log scaling of the Frequency Range. Note that this only affects the displayed scale – not the data. The log scale is an alternative representation of the distribution of frequencies over the entire range that reflects the doubling of frequencies with each octave. |
![]() |
Done button – closes the Preview window. |
Selecting the Custom button updates the display area of the Preview window
as shown below.
The main visual difference when viewing custom bands is that the vertical band limit lines are colored yellow. You can adjust the bands by dragging any limit line left or right. The current frequency is displayed as you move the band.
You can also manually enter a specific value by clicking the frequency text (double-clicking selects the entire value), entering a new frequency and hitting the Enter key.
Notice that there is a minimum possible bandwidth; this is equal to the current 'frequency resolution' of the spectrum data, which is equal to the sound sample rate / 1024. You will get a warning if you attempt to create a bandwidth which is less than this amount.
Click the Play button to re-process and display the spectrum data using the new band widths.
The Amplitude preview display is shown below.
Use the Waveform buttons to view the Moving waveform (in sync with the input sound) or the Complete waveform with a moving line indicating the current playback position within the sound as it plays. The level 'meter' at the bottom of the display area also updates in sync with the sound. Note that this meter does not use dB scaling unless DB Scale is switched on in the Amplitude panel of the main FlashAmp Pro window.
The two short gray lines on the left and right edge of the display area indicate the maximum possible amplitude limit.
[Contents]
FlashAmp Pro creates two different output file formats: #include and loadVars() as set in the Output panel. This section provides specific details for both of these formats.
This format allows the output file to be used directly
in Flash via an #include
statement when authoring your Flash
movie. FlashAmp Pro formats
the output file as ActionScript statements which means you don't need
to copy and paste the data produced by FlashAmp Pro into your Flash movie.
It also makes it easy to update the data – just replace the #include
file and re-publish. To make use of this format, make sure the output
file is located in the same
folder
as your
Flash
movie
then
use
an #include
statement
as shown in the following example:
onClipEvent(load) { // load array(s) and variables for this sound #include "my_sound.txt" }
When the movie clip loads and this handler is executed then all the data in the the file produced by FlashAmp Pro will be available for immediate use in your movie with no further processing. This is by far the simplest way to make use of the data produced by FlashAmp Pro.
The content of an Authoring #include file depends upon the options selected in FlashAmp Pro. For mono amplitude data the format of the output file is as follows:
faFile="my_sound.aif";
fps=15;
scale=100;
smoothing=1;
dBValues=0;
stereo=0;
amplitude=[a1, a2, a3, a4, ...];
The first lines of the output detail
the settings used to process the file: faFile
is the name
of the input sound file, fps
is the Frame Rate
setting used,
scale
is the Scale setting used, smoothing
is
the Smoothing setting used (> 0 if switched on), dBValues
is
the dB Scale setting used (1 if switched on) and stereo
is
the Stereo setting used (1 if switched on and the processed sound file
was stereo). This is followed by the amplitude array where a1, a2 etc.
represent amplitude
values.
For mono spectrum data the format of the #include file is:
faFile="my_sound.aif";
fps=15;
scale=100;
stereo=0;
lowLimit=20;
highLimit=10000;
bands=[[20, 915], [916, 2334], [2335, 4125], ...];
numBands=8;
scaleAllBands=0;
spectrum=[[b1, b2, b3, ...], [b1, b2, b3, ...], ...];
Again, the first
part of the output shows the settings used: faFile
is the
name of the input sound file, fps
is the Frame Rate setting
used,
scale
is the Scale
setting used, smoothing
is the Smoothing setting used (> 0 if
switched on), dBValues
is the dB Scale setting used, stereo
is
the Stereo setting used (1 if switched on and the processed sound file was stereo), lowLimit
is
the low range of the frequencies analyzed (in Hz),
highLimit
is the high range of the frequencies analyzed (in Hz), bands
is
a 2-dimensional array
holding the frequency range of each band in Hz, numBands
is the
number
of bands used in the spectrum calculation, scaleAllBands
is the
Scale
All
setting
used
(1
if switched on)
and stereo
is
the
Stereo
setting
used
(1 if switched on and the processed sound file was stereo). This is followed
by
the
spectrum
array where
b1, b2 etc. are the spectrum values for band 1, band 2, etc.
If you have chosen to output stereo data then the file will contain 2 arrays, one for each channel, and the stereo variable will be set to 1. In an #include file, stereo amplitude arrays are output as:
amplitudeLeft=[a1, a2,
a3, a4, ...];
amplitudeRight=[a1, a2, a3, a4, ...];
Stereo spectrum arrays are output as:
spectrumLeft=[[b1, b2, b3, ...], [b1, b2, b3, ...], ...];
spectrumRight=[[b1, b2, b3, ...], [b1, b2, b3, ...], ...];
If you are processing amplitude and spectrum data in the same operation, then the #include output file will contain all the amplitude and spectrum variables at the top of the file followed by the amplitude and spectrum arrays.
If you additionally select to generate a cue point array then this will appear as the last array in the #include file, for example mono amplitude data with cue points will be output as:
faFile="my_sound.aif";
fps=15;
scale=100;
smoothing=1;
dBValues=0;
stereo=0;
amplitude=[a1, a2, a3, a4, ...];
cuePoints=[cp1, cp2, cp3, ...];
where cp1, cp2
etc. are cue point names
or empty strings (""), unless the Fill Frames option is switched
on. See the Cue Points section for more information.
This format allows the data in the FlashAmp Pro output
file to be loaded when your published Flash movie (.swf) file plays.
This is accomplished
by using the Flash loadVariables()
handler, or equivalent.
The content of an loadVars() file depends upon the options selected in FlashAmp Pro. For mono amplitude data the format of the output file is as follows:
&faFile=player1.aif&fps=15&scale=100&smoothing=0&dBValues=0&stereo=0&litude=(a1,
a2,a3,..)&Done=1
The first part of the output file details the settings
used to process the input sound file: faFile
is the name
of the input sound file, fps
is the Frame Rate setting
used, scale
is the Scale setting used, smoothing
is
the Smoothing setting used (1 if switched on), dBValues
is the dB Scale setting used (1 if switched
on) and stereo
is the Stereo setting
used (1 if switched on and the processed sound file was stereo) .
This is followed
by the amplitude data where a1, a2
etc. are amplitude values.
At the end of the output is the string "&Done=1
" to
facilitate the reading of the file if required. Simply declare ampDone
as
a variable with an initial value of 0 and when this variable has a value
of 1 then the file data
has been successfully read.
Note: the variables and array(s) will be strings when
read by Flash using loadVariables()
or similar. This means
that the string holding the data array(s) will have to
be converted to a numerical array by Flash using the string.split()
function,
or an
equivalent ActionScript function,
before the data can be used by Flash.
For mono spectrum data the format is:
&faFile=player1.aif&fps=15&scale=100&lowLimit=20&highLimit=10000&bands=[[20,
1267], [1268, 2515], [2516, 3763], [3764, 5011], [5012, 6259], [6260,
7507], [7508, 8755], [8756, 10000]]&numBands=8&scaleAllBands=0&stereo=0&spectrum=((b1,
b2, b3,...),(b1, b2, b3,...),...)&Done=1
Again, the first part
of the output lists the settings used: faFile
is the name
of the input sound file, fps
is the Frame Rate setting
used,
scale
is the Scale
setting used, lowLimit
is the low range of the frequencies
analyzed (in Hz), highLimit
is the high range of the frequencies
analyzed (in Hz),
bands
is
a 2-dimensional array holding the frequency range of each band in Hz, numBands
is the number of bands used, scaleAllBands
is
the Scale All setting used and stereo
is the Stereo setting
used. This is followed by the spectrum
data
where b1, b2
etc. are the spectrum values for band 1, band
2, etc.
If you have chosen to output stereo arrays then the output will contain 2 data arrays, one for each channel.
Stereo amplitude arrays are output as:
amplitudeLeft=(a1, a2,a3,..)&litudeRight=(a1, a2,a3,..)&Done=1
Stereo spectrum arrays are output as:
spectrumLeft=((b1, b2, b3,...),(b1, b2,
b3,...),...)&spectrumRight=((b1,
b2, b3,...),(b1, b2, b3,...),...)&Done=1
If you additionally select to generate a cue point array then this will appear as the last array in the output, for example a mono amplitude array with cue points will be output as:
&faFile="my_sound.aif"&fps=15&scale=100&smoothing=1&dBValues=0&litude=(a1,
a2,a3,..)&cuePoints(cp1, cp2, cp3,...)&Done=1
where cp1,
cp2
etc. are cue point names or empty strings (""), unless Fill
Frames is switched on. See the Cue Points section for more information.
[Contents]
FlashAmp Pro can output cue point names from AIFF and WAVE files in a format that can be used in Flash. Cue points are useful for triggering events at a specific point as a sound plays. If you choose to output cue point data then FlashAmp Pro will produce an array based on the Frame Rate setting in the Common panel. So, if you are processing amplitude data and cue points (with Fill Frames switched off) then the arrays are arranged as follows (using example data):
Array
element |
Amplitude
List |
Cue
Point List |
0 |
5 |
"" |
1 |
10 |
"" |
2 |
13 |
"" |
3 |
18 |
"itchy" |
4 |
23 |
"" |
5 |
44 |
"" |
. |
. |
. |
. |
. |
. |
x |
86 |
"scratchy" |
. |
. |
. |
. |
. |
. |
. |
. |
. |
So, for each element in the amplitude array there is a corresponding element in the cue point array.
If Fill Frames had been switched on then frames 4 to 'x' of the cue point array would be filled with the "itchy" string and frames x+1 onwards would be filled with the "scratchy" string.
Note: if FlashAmp Pro finds more then one cue point in a frame of the sound, then only the last cue point in the frame will be stored in the cue point array.
[Contents]
Using FlashAmp data in Flash requires some basic ActionScript coding. This section explains some basic ActionScript code for both amplitude and spectrum data.
Complete example Flash source files and an ActionScript 2 class library for use with FlashAmp, can be found on the Marmalade website at,
http://www.marmalademedia.com.au/flashamp/examples.html
FlashAmp Pro will produce an array of amplitude values that looks like this (only the first few values are shown here; "..." is an abbreviation for the remaining values):
amplitude=[32, 64, 51, 33,
32, 36, 36, 55, 76, 58, ...];
One way to get the list into Flash is to copy it from the FlashAmp Pro Output window or the output file and paste it directly into a frame script in your Flash movie. Here's an example script that scales a graphic object ("ball") so that it pulsates in sync with the sound:
var gFrame: Number = 0
var gAmp: Number = 0
var amplitude:Array = new Array(32, 64, 51, 33, 32, 36, 36, 55, 76, 58, ...
)
function onEnterFrame() {
this.gFrame = _root._currentframe; // get the current frame
this.gAmp = this.amplitude
[this.gFrame-1]; // get the current amplitude value
_root.ball._xscale = 100 + this.gAmp;
_root.ball._yscale = 100 + this.gAmp;
}
It's simple but the code above is all that's required to make the animation stay in sync with the sound.
This example assumes that the sound is on the _root timeline starting on frame 1. The line,
this.gAmp = this.amplitude[this.gFrame-1];
references the array using gFrame-1
to take account of
the fact that Flash arrays are 0
-indexed so frame 1 should
reference amplitude[0]
.
There are a few limitations to putting the sound on the timeline in
Flash – for example, you can't control the volume and pan of the
sound. Generally, you get much more control creating a sound object and
using
attachSound()
or loadSound().
But in that case
you can't find the current index in the FlashAmp data arrays using the _currentFrame
property.
Instead you need to calculate the current index using the .position
property
of the sound object and this is simple, reliable and accurate. The code
above can be re-written to use a sound object like this:
// include the FlashAmp data...
#include "my_sound.as"
var gFrame: Number = 0
var gAmp: Number = 0
var faTrack: Sound
function init() {
this.faTrack = new Sound(); // create a new sound object
this.faTrack.attachSound(this.faFile); // attach the sound from the library
this.faTrack.start(); // start the sound
}
function onEnterFrame () {
// get the current frame...
this.gFrame = Math.floor((this.faTrack.position/1000)*this.fps);
this.gAmp = amplitude
[this.gFrame]; // get the current amplitude value
_root.ball._xscale = 100 + this.gAmp;
_root.ball._yscale = 100 + this.gAmp;
}
init()
Note that the variables faFile
and fps
come from
the FlashAmp #include file, and that there is no need to offset the gFrame
value
using this method.
Both methods will reliably sync animation to sound, even if the sound is streaming and drops in and out. This example is scaling a vector graphic but the data could just as easily be used to draw the sound waveform or lip sync animated characters.
In terms of ActionScript, the only difference between spectrum and amplitude data is that each frame has an array of values rather than a single value. The size of this array is determined by the number of bands selected in FlashAmp Pro.
FlashAmp Pro will produce an array of spectrum values that looks like this (only the first few values are shown here; "..." is an abbreviation for the remaining values):
spectrum=[[73, 85, 81, 43, 20], [71, 103, 101,
77, 48], [68, 80, 73, 36, 8], ...];
Here's an example script that scales a number of rectangles to the appropriate spectrum value, like a graphical eq display. The rectangles are named 'bar0', 'bar1', 'bar2', etc:
// include the FlashAmp data...
#include "my_sound.as"
var gFrame: Number = 0
var faTrack: Sound
function init() {
this.faTrack = new Sound(); // create a new sound object
this.faTrack.attachSound(this.faFile); // attach the sound from the library
this.faTrack.start(); // start the sound
}
function onEnterFrame() {
// get the current frame...
this.gFrame = Math.floor((this.faTrack.position/1000)*this.fps);
for(var i=0; i < 5; i++) {
setProperty("_root.bar" + i, _height, ampList[this.gFrame][i]);
}
}
This works in fundamentally the same way as the amplitude data
code above, with the exception of the way the data array is handled.
In
this code
the array is
2-dimensional - it is an array of arrays. The for()
loop
in the onEnterFrame()
function loops through the spectrum array
for the current frame defined by gFrame
and scales the
_height
property of each rectangle to the appropriate
value in the spectrum array referenced
through ampList[gFrame][i].
Because we are dealing
with an array per frame rather than a single amplitude value,
we don't need the gAmp
global variable.
Again, note that that the variables faFile
and fps
come
from the FlashAmp #include file.
[Contents]
FlashAmp Pro can process any of the following formats,
FlashAmp Pro supports all standard sample rates as well as 16 and 8 bit sounds. MP3 and SWA files will take longer to process than AIFF or WAVE files of the same duration because of the additional time it takes to decompress these files.
Also see the Technical specifications and Hints and tips sections.
[Contents]
Adobe Flash™ compatibility
Supported sound formats
Supported sample rates
Supported bit depths
Settings
Maximum frame rate: Amplitude=100, Spectrum=46@48kHz sample rate
Maximum scale: Amplitude 16bit = 32767, Amplitude 8bit = 128, Spectrum
= 32767
Spectrum range, minimum low frequency: 20Hz
Spectrum range, maximum high frequency: (sound sample rate)/2
Minimum system requirements
Windows | Macintosh |
Windows 2000, Pentium III, 512MB RAM, 10MB of available hard disk space Windows XP, Pentium III, 512MB RAM, 10MB of available hard disk space |
Power Macintosh G4 running OS 10.2.6, 512 MB RAM, 10MB of available hard disk space |
[Contents]
There are two basic things that will help you get the best possible results with FlashAmp Pro,
Both of these points says the same thing in different ways; 16bit sounds can hold a wider range of amplitude values (in other words, a larger dynamic range - the difference between loud and soft parts of the sound) than 8bit sound in exactly the same way that 16bit images can display many more colors than 8bit images. The larger the dynamic range, the more effective your animations will be in conveying the details of the sound.
But even if a particular sound does not have a large dynamic range it's often possible to customize the animation (or whatever other function you're using the amplitude values for) by looking at the amplitude values to determine the range of values that does change most frequently and work from that.
The sample rate of a sound has much less effect on the dynamic range than the bit depth. The de-facto minimum spec for uncompressed sound in multimedia products is mono, 22050Hz at 16bit which is perfectly adequate as far as the performance of FlashAmp Pro is concerned.
There are three different ways you can use FlashAmp with sounds in Flash. Each of them have advantages and disadvantages which mainly relate to the way that Flash handles sound - FlashAmp works basically the same way in each case.
1) Putting the sound on the timeline
If you put the sound on the timeline then you must set it to stream in order to maintain sync with the FlashAmp array(s). You should put the sound on the root timeline. This means that it will actually play as it streams off the server. If you place it inside a movie clip then the whole clip has to download before the sound starts to play even if it is set to stream.
Using this option you can of course stop
and start the sound and jump to any place in the sound by merely controlling
the main timeline e.g., use code such as stop();
, play();
, gotoAndPlay(100);,
etc.
The advantage of this method is that it’s very simple; your .swf file will stream off the server and you can start and stop sounds without losing sync. The disadvantage is that you cannot load and play a different sound at runtime or use any sound object properties such as volume and pan.
2) Attaching a sound from the Library
To use this method, import the sound into Flash and select it in the Library. From the Library pop up menu choose Linkage… and select ‘Export for ActionScript’ and ‘Export in First Frame’. Flash will automatically set the identifier name for you. Then use code equivalent to the following in your sound function:
soundObject.attachSound("mySound.mp3");
The downside of using attachSound is that the whole sound will load in the first frame of your movie before anything else happens. The upside is that you will have full control to stop, pause and play because Flash can track the position of the sound correctly. You can also use sound object properties like volume and pan.
3) Loading an external .mp3 file at runtime
This option may seem to be the most attractive and mostly it is, however there are some downsides.
To use this option use code equivalent to the following in your sound function:
soundObject.loadSound("mySound.mp3",
true);
Note that the second parameter is setting streaming to true.
You do not need to import the sound file into Flash. You just have to make sure that the .mp3 file is in the same directory as the .swf file.
One benefit of this method is that the .mp3 starts to stream when
the loadSound()
function executes. It also
plays as it streams although there will be a slight delay as
it buffers (Flash will maintain the correct .position
value
so you won't lose sync with the FlashAmp arrays).
While you can use sound object properties like volume and pan with this method, the downside is that Flash has issues tracking the sound position if you stop the sound and play it again. This is because the sound is not inside the .swf file. Sync will be maintained if the sound is simply played from beginning to end but if the sound is stopped and started again from the beginning then Flash will not automatically reset the soundObject.position value so you will not be able to keep the sound in sync with the array. The workaround is to clear the sound object when the sound is stopped and create a new one when sound is started again.
Processor load is not as much of an issue as it used to be. The performance of the Flash player (especially version 8) has improved a great deal and the average spec of end-users computers has improved as well. But performance is still something that you should not take for granted, so if you're using FlashAmp data then we strongly recommend thorough testing on all your target systems.
[Contents]
Registered users can receive technical support via email. When reporting an error please supply the full text of the error message and details of your hardware and operating system as well as the sound being processed.
Copyright ©2000-2007 Marmalade Multimedia
Last updated: 1 June, 2007
'Flash' is a trademark or registered trademark of Adobe, Inc