![]() |
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
Source Code |
|||
| Basic single-character lip-sync animation using amplitude values (using sound on the root timeline). Source code includes full documentation. | |||
For external sounds (played with loadSound() or attachSound() ) you need to calculate the current frame within the sound using the position property of your Flash sound object. The following line of code calculates the current frame of the sound:
gFrame = Math.floor((theSound.position/1000)*fps);
Where theSound is your Flash sound object and fps is the frame rate of your Flash movie. Then gFrame is the index into the FlashAmp array:
ampValue = amplitude[gFrame];
See this spectrum example for Flash code that uses this method:
|
Source Code |
16-band stereo eq-type display created with spectrum values (using attachSound() ). Source code includes full documentation. | ||
Each of these methods (having the sound on the timeline, attachSound() and loadSound() ) have advantages and disadvantages. See the FlashAmp User Guide for more information.
The FlashAmp output format you choose really depends on the way you are using sound in Flash. As a general rule the #include format is by far the easiest to use. You just add an #include statement to your Flash file and put the #include file created by FlashAmp in the correct place and the code in the file will be available for use in your Flash movie. If your sound changes and you need to re-process it or you want to try a different option in FlashAmp (like switching Smoothing on for example) then you just replace the #include file and re-publish your Flash movie. It's that simple.
If the sounds that you are using are likely to change after you publish your Flash movie (say if you have built an MP3 player and you want to add more MP3 files) then using loadSound() may be a better option. You can add an updated or new sound along with it's corresponding text file generated by FlashAmp and your .swf file will use the new sound and FlashAmp data without the need for re-publishing your .swf. The only downside of this approach is that loadSound() can be a bit slow when dealing with large arrays (like sound spectrum data for long sound files), although this is less of an issue with Flash MX2004. See the following question for example Flash code.
When you load data into Flash using loadVariables() then all the information will be formatted as strings. To use the FlashAmp arrays effectively you need to convert these strings into Flash number arrays. The usual way of doing this is to use the Flash string function string.split().
See the following code for a complete working example:
|
Source Code |
|||
Stereo VU meters example using the FlashAmp loadVariables() file format and loadSound(). In this example the FlashAmp data and the mp3 file are external to the Flash file. |
|||
There are two common reasons for bad sync - either the sound is not set to stream in Flash or the frame rate used to process the sound in FlashAmp is less than the frame rate used in the Flash movie.
If you are sure that both of these things are correct and you're still having sync problems then please contact us.
The recommended technique is to create 10 vector mouth shapes ranging from closed to fully open (as far as talking is concerned) and place them in a separate movieClip with one shape in each frame starting with the mouth closed. Process the sound with FlashAmp to generate amplitude data with a scale of 9 (so the FlashAmp data will range from 0 to 9), with smoothing off. As the sound plays send the playback head in the mouth movieClip to the frame equal to the current amplitude value +1. The mouth will move in sync with the sound.
Note you can have more than 10 mouth shapes (avoid having less if possible). The scale used in FlashAmp should be the number of mouth shapes used -1.
The main factor in achieving realistic lip-sync with FlashAmp is to have variation in the mouth shapes beyond just making the mouth open progressively. The exact nature of the variation depends on the character so some experimentation may be required.
See the following working example (with Flash source code):
|
Source Code |
|||
| Basic single-character lip-sync animation using amplitude values. Source code includes full documentation. | |||
This is due to the fact that FlashAmp must fully decompress mp3 files in RAM in order to access the sample data in the file. The best workaround is to save the mp3 file in an uncompressed format (WAVE or AIFF) and process that file. The generated data will still be valid for use when you play the mp3 file.
When processing files for spectrum data be sure that you don't change the sample rate when you save the uncompressed file. The correct sample rate is important for FlashAmp Pro when it calculates the frequency band widths. This is generally good practice when working with amplitude data as well.
Turning smoothing on (setting it to a value greater than 0 in FlashAmp 3) will result in the amplitude output file having more gradual variations than it would with smoothing turned off. This can be useful for animations that need to change state smoothly but shouldn't be used where you are relying on a completely accurate representation of the sound, such as a waveform or lip-sync animation.
In FlashAmp 3, the degree of smoothing increases with the button number.
The Smoothing checkbox (buttons in FlashAmp 3) applies to amplitude data only, it has no effect on spectrum data.
See the FlashAmp User Guide for more information.
The dB scale option can be used in situations where you need the amplitude values to be more representative of human hearing than raw amplitude values, such as animating VU (Volume Unit) meters.
'dB' refers to 'decibel' which, in relation to sound, is a logarithmic scale where variations at the 'quieter' end of the volume range have more significance than the at 'louder' end.
The 'Return dB Scale' checkbox applies to amplitude data only, it has no effect on spectrum data (which uses a type of dB scale by default).
FlashAmp returns dB values for amplitude data as positive values (strictly speaking they should be negative but positive values are easier to code animations with) which range from 0 (the loudest sound encountered in the file processed) to infinity (where everything above 50 can be regarded as too quiet to hear) so your existing FlashAmp ActionScript code may need to be modified to use dB values.
See the FlashAmp User Guide for more information.
The scale value that you use should be based entirely upon the way you're using the values in Flash, regardless of whether you're using amplitude or spectrum values. The default is 100 which is the most useful if you want to control things like alpha channel data or anything else in Flash that ranges from 0..100.
See the FlashAmp User Guide for more information.
You should use the Stereo checkbox whenever you have an animation that relies on the left and right channels of a stereo sound. Such as a pair of VU meters (one for left and one for right) or something similar.
If the Stereo checkbox is unchecked (or the Mono button is on in FlashAmp 3) then FlashAmp will produce mono data whether the input sound is mono or stereo.
See the FlashAmp User Guide for more information.
Normalizing boosts the loudest part of the sound to the loudest possible level without clipping (digital distortion). This is a useful option for preparing lip-sync data to ensure you get the maximum possible range of amplitude values if you are processing a sound that is relatively quiet.
Note that the normalizing process will also boost the quietest part of the sound which can result in increased noise.
See the FlashAmp
User Guide for more information.
Yes. You can export Flash files that use FlashAmp data to QuickTime using Flash 8, MX2004 or MX. Here's how...
NOTE: if you are using QuickTime 7.1.3 or later then you need to launch the QuickTime Player and make sure that the 'Enable Flash' checkbox in the Advanced tab of the QuickTime Preferences window is switched on. This is switched off by default. After switching it on, you should then restart your computer to ensure that this setting is enabled. Re-starting QuickTime or the Finder may also work but restarting is recommended. If this is not done then you are likley to get an error regarding a 'missing QuickTime component' when you export QuickTime from Flash MX2004 or Flash 8.
This error is caused by attempting to process a file type that is not supported by FlashAmp. Even if the file extension for the sound is '.mp3', '.wav', '.aif' or '.swa' it's still possible that it has been encoded in an unsupported format. The best solution is to open the file in a sound editing application and save it out in a format supported by FlashAmp.
See also What's the best sound format to use with FlashAmp?
This error is caused when FlashAmp is unable to write an output file. Make sure the output destination is not Read-Only (such as a CD), and that you have the appropriate permissions to write to the output location.
The current version of FlashAmp does not support 'live' or direct sound input either from a microphone or line/soundcard input. We suggest that you investigate the microphone ActionScript object (in Flash MX or later) that allows you to get the current microphone input level in realtime.
We are looking at ways of incorporating this functionality into a future version of FlashAmp.
The current version of FlashAmp does not support command-line arguments.
If you would like to see this feature included in FlashAmp then please contact
us and tell us how you would like to use command-line arguments with
FlashAmp.
If the upper frequency bands of the FlashAmp output contain only zeros (0) then the most likely reason is that the sound has been down sampled at some point (that is, the sample rate has been reduced from the original value) and then it has been re-saved at a higher sample rate. Once a sound has been down sampled then the original high frequency data is lost and cannot be regained by increasing the sample rate. FlashAmp Pro uses the sample rate in the header of the sound file as a basis for the spectrum analysis but in this situation the upper frequency data that should be there have been removed by the previous down sampling operation on the file.
The other possible reason for all zeros in the upper bands is that the sound itself simply does not have high frequency content.
There are also situations where the values in the upper frequency bands are simply low (but not all zeros). This is usual for many sounds because most of the power in the sound spectrum is associated with fundamental frequencies which are concentrated in the lower frequency band. There are two basic ways to make the distribution appear more even:
If you are still having problems after trying these options then please contact us.
This is largely a matter that depends on the way you want to use the FlashAmp data. The only issue that you need to bear in mind is that the more data Flash has to handle per frame then the more processor power will be required when your Flash file plays. So just be sure to test your final file (which may contain additional animation as well as the FlashAmp animation) on all your target delivery systems.
Use this option when you want to get a more even distribution of values throughout the frequency range. Selecting this option causes FlashAmp Pro 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. The exact range of the bands will be included in the output data generated by FlashAmp Pro (and in the Preview window of FlashAmp 3).
