Home > Articles

This chapter is from the book

Controlling Quality and File Size

Now that you know how to incorporate sound in your movie, it's time to talk about optimizing it for export. A direct relationship exists between quality and file size. If you want the best quality sound, the file size will grow. Conversely, small file size means lower sound quality. This is just a fact. You ultimately need to make a decision as to how you balance this tradeoff. Is a high-quality sound important enough to make your audience sit through an extended download time? Is a speedy download enough to make your audience ignore a low-quality sound? You should be very deliberate in your decision-making process to end up with the best compromise possible.

While exploring this topic further, we'll first cover some digital audio fundamentals and then you'll learn how to apply this knowledge to Flash's compression settings.

Digital Audio Fundamentals

Digital sounds on the computer are not continuous. Similar to how a fluorescent light or your computer monitor flickers, digital audio is a series of discrete bursts called samples. The frequency that these samples occur is so fast that you think you're hearing a continuous sound.

Exactly how fast the samples are occurring is called the frequency rate (also sometimes called sampling rate). Naturally, a higher frequency rate (many bursts per second) sounds better than a low rate. The frequency rate of all audio CDs, for example, is 44,100 hertz, commonly referred to as 44 kilohertz (KHz). Sound-editing software can convert a song to a lower rate but it won't sound as good. Why not always use the highest frequency rate possible? Simple. Each sample takes up disk space and adds to the file size. A sound with a frequency rate of 22,050Hz, for example, is half the size of one at 44,100Hz and may still sound good.

In addition to frequency rate, another important factor is bit depth. Similar to how each pixel on your computer monitor can be one of 256 colors (when the color depth is 8 bit) or one of 16.7 million colors (when the color depth is 32 bit), each sample in an audio track can be one of many sound levels (think of these sound levels as "shades of sound"). A sound with an 8-bit depth means that for every sample, the sound can be one of 256 different levels. A 16-bit sound has the potential of being one of 65,536 different levels. The higher the bit depth, the better the sound quality. (By the way, audio CDs have 16-bit depth.)

Frequency rate and bit depth are independent. One sound could have a high frequency rate (such as 44,100) but a low bit depth (maybe 8 bit). When you increase either factor (to improve quality), file size grows. To make matters worse, a stereo sound is always twice as large as the same sound in mono (because it contains information in two channels). Finally, the length of the sound affects file size directly—a longer sound is larger.

There are ways to calculate the exact size impact of frequency rate and bit depth. The bottom line, however, is that audio takes up a lot of disk space. One minute of CD- quality sound, for example, takes about 9 megabytes! The fact that pure CD-quality sound takes up so much space is why you want to find a better way.

One solution is compression. MP3 compression, for example, analyzes the sound file and finds ways to reduce the file size with minimal sacrifice to quality. Using MP3 compression, that same 9 megabytes of CD quality sound might get reduced to about 1 megabyte! Just like how JPG compression reduces the file size by removing parts of the image you don't notice, MP3 uses a technique to remove the parts of a sound that you're not likely to miss. Exactly how it does this, I don't know. It's magic, I guess. However, Flash can perform MP3 compression based on the level to which you would like your sounds brought down (namely, the bit rate). The best quality MP3 that Flash 5 supports is 160Kbps. A lower number means lower quality (but also means the amount of data per second is lower). One last note: When MP3 reaches 160Kbps (or whatever level you specify), it makes its own decisions regarding the balance between frequency rate and bit depth.

Export Settings

All this theory is interesting, but how do you apply it to your sounds? You have two places in Flash where you can specify quality settings: the Sound Properties dialog box, unique to each imported sound, and the Flash tab of the Publish Settings dialog box.

Global Publish Settings

To set the default sound format for every sound in a Flash movie, select File, Publish Settings.... Make sure under the Formats tab that you've checked Flash (.swf), and then click the Flash tab (see Figure 10.10). You'll see two different sound settings in this dialog box: Audio Stream and Audio Event. Audio Stream affects sound instances using the Stream sync setting, whereas Audio Event affects sounds using the Event sync setting (it also affects sounds set to Start, although it doesn't say so). If you click the Set button, you can see all the options available, as shown in Figure 10.11. The following list provides a description of each option:

Figure 10.10 The Flash tab of the Publish Settings dialog box provides you with a way to set the default sound settings globally for the entire file.

Figure 10.11 You can set the type of compression for all sounds in your movie from Publish Settings.

There's a Set button next to both Stream and Event so you can set the compression for sounds used each way separately. There are five choices for sound compression. With the exception of "Raw" (which is really no compression), you'll need to specify additional options for the compression you choose. For example, you can't just say "compress using MP3"—you have to specify how much MP3 compression. As each option has its own unique characteristics, let's look at each in detail:

  • Disable is pretty simple: It tells Flash not to export any sounds. When you select Disable from the drop-down list, there are no other options to set.

  • ADPCM is almost the same as Raw (below), except it performs a little bit of compression. The options for Sample Rate and Convert Stereo to Mono have the same effects as discussed earlier, but the ADPCM bits specify the level of compression. A higher number means better quality but not as small a file. Pretty much the only reason to use this option rather than MP3 is when you have to deliver your movie to the Flash 3 player (which more people have).

  • MP3 provides great compression. When exporting, always use the Quality setting "Best" because it won't affect the file size but will improve quality. However, while working, you might consider temporarily changing this to "Fast," because every time you test a movie (using Test Movie), it will go quicker. The bit rate is simply how much data per second you're letting the MP3 file take. The higher the number, the better. In theory, a bit rate of 56Kbps will be maintainable on a 56K modem, although reality is sometimes different from theory because other factors can slow the download performance. We'll explore more issues related to downloading in Hour 20, "Optimizing Your Flash Site." You really just have to test this out and keep lowering the bit rate until just before the sound becomes unacceptable. You can judge the result by testing the movie or (as you'll see later in "Individual Export Settings") you can test each sound individually.

  • Speech is a new Flash MX compression setting (which, by the way, requires that your users have the Flash 6 player). This compression setting is optimized for the human voice. In practice, however, you should always compare the quality/filesize effects of Speech compression to MP3 because you'll find the best choice varies case by case.

  • Raw leaves your sounds intact, although you do need to specify a sample rate (frequency rate). Also, if you select Convert Stereo to Mono, any stereo sounds will become half their original size.

Now you've learned how you can set the default sound settings for both Stream and Event sounds from the Publish Settings dialog box. Also note the Override Sound Settings check box. This will cause the settings you apply here to be imposed on all sounds in your movie, regardless of their individual export settings. You're about to see how to specify sound settings individually per sound. Override can be useful when you want to publish a single copy for a special purpose. Say you want a copy to demonstrate from your hard drive—download time isn't an issue, so you could make all the sounds play at their highest quality (Raw).

Individual Export Settings

In addition to a movie's globally specified sound settings, each sound item in the Library can have its own individual settings, which apply to every instance of that sound. Just double-click a sound in the Library (or from the Options menu, select Properties...), and you'll see the Sound Properties dialog box, as shown in Figure 10.12.

Figure 10.12 The Sound Properties dialog box provides individual control of exactly how a sound will be exported (regardless of the default publish settings).

This dialog box is similar to the Bitmap Properties dialog box you studied in Hour 3. In the same way that individual imported bitmaps can have their own set of compression settings, so, too, can imported audio. The choice of settings is practically identical to the settings under Publish Settings. However, in this dialog box, for each change you make, you're given details of the effect on file size and quality. Down at the bottom you'll see how much the file compresses for each change. If you click the Test button, not only will Flash perform the compression you specified, but the sound starts playing and you can hear how it sounds (similar to the Test button for bitmaps, although with bitmaps you judge the visual effect). This gives you all the information you need to decide what settings to use. You can listen to the sound while assessing the effect on file size.

The Sound Properties dialog box has a couple other items you should note. The Default option will use whatever settings you specify in the Publish Settings. Also, you have the same ability to replace sounds as you do for replacing bitmaps. For instance, if you've edited a sound in a sound editor and you want to import the replacement sound, just click the Update button (if the file has moved, you'll be asked to point to the new location). Additionally, if you want to replace a sound (without taking the trouble of reassigning every keyframe where you've already used the sound), just click Import and select the new file when prompted.

Tricks for Efficiency

Obviously the best way to reduce file size (in respect to audio) is to avoid using audio. Although this may sound facetious, it's worth consideration. You should force yourself to consider each sound you use, and if it's not adding something to your file, it's most certainly distracting because it's adding to the file size (and that's a distraction during download). Gratuitous sound effects are worse than gratuitous visual effects because sounds add significantly to the file size. Just be extra critical when asking yourself whether a particular sound is really necessary.

After you've decided that a sound is, indeed, necessary, you still have ways to reduce the sound's impact on the file size. The best way is to trim any "silence" at the beginning or end of the audio. Silence still adds to the file size. Ideally, you should do this before importing the audio into Flash, but you can also do it for each instance through the Edit Envelope dialog box shown earlier. Another great way to reduce file size is to use a short looping sound instead of a long linear sound. Of course, there's a possibility of selecting a loop that can become monotonous, but you might be surprised how much "mileage" you can get from one simple loop. Sprinkle a few incidental Event sounds independent of the loop, and it can often sound very interesting.

Probably the most subjective question is "Which level of compression is appropriate?" First of all, it makes the most sense to always start with the best quality sound possible and then selectively reduce the file size and quality as appropriate. (The only exception is an MP3 file that you believe already has the best possible compression—in which case you wouldn't want to recompress it.) If you start with a bad sound, it's never going to get any better. You always want to start with top-quality sounds.

Determining which level of compression is appropriate is really a subjective decision, but that doesn't mean I can't make a few suggestions. First of all, there's a common misconception that audio containing voice can withstand the most compression, whereas music can't. This is just plain false! A better generalization would be to say that sounds of natural items (acoustic instruments and voices, for example) are best kept at a high quality, whereas sounds of synthetic items (such as a distorted electric guitar and synthesized keyboards) will likely be perfectly acceptable at a lower quality. This is true because any sound on the computer is fake—you're trying to make the user believe the sound is one thing or another when, in fact, it's just electronic data. When you attempt to simulate something natural, such as a voice or acoustic instrument, your audience has a good recollection of what that sound is supposed to sound like, and they'll notice if it doesn't sound right. On the other hand, sounds from an electric guitar, for example, can be distorted and still sound perfect. Ultimately, you'll still need to test each compression setting to hear how it sounds, but just remember it's easier to notice that something's wrong when a natural sound gets distorted.

One other fact: If everything else is kept equal, a mono sound will appear "cleaner" than a stereo sound. This doesn't mean that you shouldn't use stereo. Instead, simply realize that in order to maintain quality in a stereo sound, you usually can't compress as much (and add to this the fact that stereo sounds are twice as big as mono sounds). Therefore, just be absolutely sure you need stereo sound (and remember you can still pan the left and right channels without a stereo sound).

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020