Flash Voice Advanced: Nullsound Technology-1

Source: Internet
Author: User
Tags contains file size
Advanced Source: http://www.bluegelmedia.com
Original Author: Brett E. Yokom/killersound, Inc.
Translation: Jimbob

Summary

This book introduces the detailed description of the "Nullsound" stream technology. This technique can save 90% of the file size compared to the traditional sound stream technology and keep the sound and animation fully synchronized.

Preface

Let's start with the overview of Macromdeia Flash's original technology, followed by a description of how to implement it.

Now in the Internet, animated websites are growing rapidly. People are no longer content with fancy vector styling, beautiful colors and animations, and you have to create cool music and sound effects to attract visitors ' attention. The previous flash designers (1998/1999) used simple cyclic sound effects to break the silence of the Web world, and then the cycle sounds became more complex, resulting in larger file sizes and more time to download. At the same time, the market has created such a demand: some excellent animation (such as on TV ads), requires that the image must be fully synchronized with the music and sound effects. But the sound inside Flash, can meet these requirements at the same time: both small file volume, and image synchronization? The solution provided by Macromedia is to set the sound into stream mode.

This approach is useful for the following two reasons:

The 1.Flash player does not have to wait until all the sounds have been downloaded to resume playback, as long as you download a portion of the previously buffered sound, you can start playing immediately. This is somewhat similar to the streaming media technology used by real and Microsoft Media Player. The technology is doing well in broadband access to Internet users, however, for 56k and the following dial-up users, there is a problem: These users can start to watch when Flash is not fully downloaded, but it is possible to stop the animation because of insufficient bandwidth at any time, preferably when all the downloads are complete, and start playing it again.

2. Use the stream mode to maintain absolute playback frame rate. If you do not use the stream method, set the FPS frame rate of flash set to 25, then this does not mean that flash will always play at 25 frames/sec speed, the actual frame rate will depend on your cpu,cpu stronger, the actual playback frame rate is closer to the preset value. For example, the frame rate you play on the Pentium 166 machine is 8~9, while the frame rate played with Ben III-500 is 22. Theoretically, if you set the frame rate to 25, the CPU has only 1/25 seconds to calculate all the elements needed to play a frame. If the CPU speed is not up to this requirement, for example, it may take 1/5 seconds to calculate, then the actual FPS will be reduced to 5 fps, if your flash contains 100 frames, then theoretically play as long as 4 seconds, and the actual playback needs 20 seconds, flash playback slowed.

The solution is to use the stream mode of the sound! A sound that uses stream mode on the main timeline will tell the Flash Player: "You have to keep the sound playing speed, slow playback is not allowed!" "As a result, not only the sound but also the playback speed of the graphics are kept synchronized." So can a low speed CPU handle all the data with a 25 frame rate? The answer is: impossible. The speed of keeping is virtual, the CPU uses ignoring the unhandled frames to keep the frame rate stable, for example, as mentioned above, in which only 1/5 of the frames in Flash are displayed and others are ignored (so that in some cases it can cause a noticeable jump-frame phenomenon).

In this book, we do not want to specifically discuss how to use the sound of the event or stream mode, the introduction of such articles can be found in www.macromedia.com or www.flashmagazine.com and other places. What we are interested in is: How to apply this knowledge in a more in-depth way.

Method Description:

The main disadvantage of using sound stream is that it greatly increases file size. This is caused by the stream technology itself. If you use a 2-second sound and loop 100 times, the total length of the sound is 200 seconds, and we import the 200-second sound in stream mode. If the original size of the sound is 10k, then the output of the SWF file will include about 1M of sound, which is estimated, considering the sound quality and some other factors, its actual size should be 800~900k. If the average download speed of 56k dial-up Internet is considered 4.5k, the user needs about 200 seconds (more than 3 minutes) to download. If you consider a lower internet speed such as 2.5k, it will take about 5-6 minutes to download.

And it came to the conclusion that file size is a big problem.

An interesting phenomenon is that if we use a small voice to use the stream method, then the final output of the SWF file size will be much smaller. If the entire music is a technique used in the Killersound tutorial (www.killersound.com), then using a sound file (such as the smallest one) as a stream and other sound files using the event method is sufficient. After many tests, we get the following conclusion: Using layer to set one of the sound files to stream, other sound files are not set to Sream way, the effect is perfect. This also means that flash can be used as a mixer.

So how can we reduce the volume of the file at a deeper level? If we choose to compress the sound quality (e.g. ADPCM, 5 kHz, 4 bit) the results will not satisfy us. The file size is much smaller, but the sound effect is too bad! The solution is the following STR0 and STR00 technology, which is what we call "Nullsound streaming" technology.

Before we start talking about this technology, let's take a look at the results:

The most obvious example of applying this technique is the Killersound for virtual reality development. This title contains 1 minutes of complex music and sound effects. Using 5 sound files, each file has a different number of compressed digits to achieve the overall sound quality requirements. In this case, the background music only needs the 8kbit/s MP3 file (because it contains the main low-frequency part), the high frequency drums and other parts need 32kbit/s MP3 files. We also need to use a 0.1-second long "nullsound" file, depending on the technology we are going to describe later. Because we need to keep the animation and sound synchronized, the frame rate of the title must be constant, which means we have to adopt the Stream method.

In the traditional way, only one or all of the sounds are set to stream, so the bit rate of the stream sound itself must be set high to meet some sound requirements, which means we waste a lot of space. With the new Nullsound stream technology, we can set a different bit rate for each sound file, thus ensuring that the file becomes smaller.

The following table shows the size of the output file for the title under different technologies. STR1 and STR5 have adopted traditional approaches, and STR0 and STR00 have adopted new technologies. It should be mentioned that the file contains not only music, but also animation, so the file size is relatively large.

Str1:1 cycle sound is set to stream sound quality for MP3, kbit/s, MONO, other sound effects set to event quality for different sound effects according to different sets of optimization values
Result: Music size 595 KB (file size 1.25 MB)

Str5:5 sound effects are all set to stream quality for MP3, kbit/s, MONO
Results Music Size 594 KB (file size 1.24 MB)

STR0: "Nullsound" sound is set to streamed sound quality for MP3, 8 kbit/s, MONO, other sound effects are set to event sound to set different optimization values according to different sound effects
Result: Music size in kilobytes KB! (File size 847 KB)

STR00: "Nullsound" sound is set to streamed sound quality for MP3, 8 kbit/s, MONO, other sound effects are set to event sound to set different optimization values according to different sound effects
Result: Music size of KB!!! (File size 714 KB)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.