Final Sound Advice and Pointers


Here are a few final notes about sound and some pointers to more complex sound-related topics that may help you work with sound files in Flash 8.

VBR (Variable Bit Rate) MP3

Macromedia has licensed the Fraunhofer MP3 codec, which supports streaming MP3 with a constant bit rate. However, neither Flash 8 nor any Flash Player supports Variable Bit Rate (VBR), or VBR MP3, encoding for Stream sounds. VBR MP3 is a variant of MP3 that uses specialized algorithms to vary the bit rate according to the kind of sound that is being compressed. For example, a soprano solo would be accorded a higher bit rate than a crashing drum sequence, resulting in a superior ratio of quality to file size. There are a number of sound applications, such as Apple iTunes, Musicmatch Jukebox, and the MP3 creation packs available for Windows XP Media Player, that export VBR MP3. If you have access to a sound application that exports VBR MP3, you'll be happy to know that you can import your VBR MP3 sound files, which are (theoretically) optimized for file size and quality beyond the compression capabilities of Flash 8, and that you can maintain the compression of such files by doing the following:

  • In the Flash tab of the Publish Settings dialog box, leave the option to Override Sound Settings unchecked.

  • In the Sound Properties (or Export Settings) dialog box for each sound in the Library panel, choose Default for the Compression option in Export Settings.

  • The Sync option (located in the Property inspector) for the sound cannot be set to Stream.

If you choose to use VBR MP3 files in your Flash documents, you may need to test the following options of VBR compression in your MP3 creation software:

  • Bit rate: Test the minimum bit rate that VBR will use for the MP3 file. Regular MP3 files use CBR, or Constant Bit Rate, which keeps the sound's bit rate steady through the entire sound file. With VBR, the bit rate can vary in ranges that you specify. Some higher bit rates, such as 320 Kbps, may not import well into the Flash 8 authoring tool.

  • Quality: Most VBR-enabled MP3 software enables you to also pick an arbitrary quality setting for VBR MP3 files. Using terminology like Lowest, Medium Low, and High (and several in between), or percentages (1–100%), you can alter the quality of the bit rate. Note that this "quality" is not necessarily used in the same manner that Flash 8 refers to quality for MP3 compression.

You may find that Flash 8 will give you an import error for some VBR- (and CBR-) encoded MP3 files. If a particular setting creates an MP3 file that can't be imported into Flash 8, then try another bit rate and/or quality combination. However, we have found that Flash 8 has strange inconsistent behavior when it comes to importing MP3 files. For example, you may find that one VBR setting/combination does not work for a particular sound file, but that it works fine for others. Even more strangely, MP3 files that won't import into the Flash 8 authoring environment will load just fine into Flash Player 6 or higher at run time via ActionScript.

Cross-Reference 

You can find more information about VBR encoding at the following URL:

  • www.fezguys.com/columns/057.shtml

We also recommend reading the "null sound" Flash tutorial at

  • www.bluegelmedia.com/tutorials/av/null_sound_technique.htm

This tutorial shows you how to use a Stream sound to kick other Event sounds into streaming mode. Robert Reinhardt contributed a chapter to August de los Reye et al's Flash Design for Mobile Devices (Wiley, 2002) covering this technique.

Optimizing Sounds for Bandwidth Usage

It goes without saying that every Internet content creator strives to make every file and data transaction as small and efficient as possible to accommodate the majority of slow network connections in use today. As a Flash designer or developer incorporating sound into your projects, you'll want to properly plan sound usage in an effort to avoid 1MB .swf file downloads.

Table 15-4 explores many of the available network bandwidths that are in use on the Internet. However, as you've likely experienced, it's highly unusual to actually get the full download (or upload) speed out of your network connection. Variables such as network congestion, server load, and phone line conditions affect the quality of your network speed. Using the same "for-mula" that Macromedia uses to determine approximate download speeds in the Bandwidth Profiler (within Test Movie mode), we calculated estimated bandwidth speeds for the connection speeds shown in Table 15-4. Because Flash 8 displays compressed sound information in Kbps units, we converted these connection speeds into Kbps bit rates. More important, though, we also provided a 50-percent portion of this bit rate, as you'll likely need to save room for other Flash material, such as vector artwork, bitmap graphics, and animations.

Table 15-4: Bit Rates for Flash Movies

Hardware support

Theoretical bandwidth

Estimated bandwidth

Percent of theoretical

100% bit rate

50% bit rate

14.4 Kbps

1.8 KB/s

1.2 KB/s

67

9.6 Kbps

4.8 Kbps

19.2 Kbps

2.4 KB/s

1.6 KB/s

67

12.8 Kbps

6.4 Kbps

28.8 Kbps

3.6 KB/s

2.3 KB/s

64

18.4 Kbps

9.2 Kbps

33.6 Kbps

4.2 KB/s

2.8 KB/s

67

22.5 Kbps

11.2 Kbps

56 Kbps

7 KB/s

4.7 KB/s

67

37.6 Kbps

18.8 Kbps

64 Kbps

8 KB/s

5.4 KB/s

67

43.2 Kbps

21.6 Kbps

128 Kbps

16 KB/s

10.7 KB/s

67

85.6 Kbps

42.8 Kbps

256 Kbps

32 KB/s

21 KB/s

67

168 Kbps

84 Kbps

384 Kbps

48 KB/s

32 KB/s

67

256 Kbps

128 Kbps

768 Kbps

96 KB/s

64 KB/s

67

512 Kbps

256 Kbps

1.5 Mbps

192 KB/s

129 KB/s

67

1,032 Kbps

516 Kbps

11 Mbps

1,408 KB/s

943 KB/s

67

7,544 Kbps

3,772 Kbps

Using Table 15-4 as a guide, try to plan your Flash project for your target audience. Actually, you may have more than one target audience. As such, you may need to develop several versions of your sound assets, with each version targeted to a specific connection speed.

Once you've decided your target audience(s), you can determine the maximum Kbps that your sound files should use. Table 15-5 shows you the bit rates of Raw, Speech, and ADPCM mono sounds. We don't include MP3 bit rates here because they're already calculated (and available) in the Compression menu of the Sound Properties dialog box: 8, 16, 20, 24, 32, 48, 56, 64, 80, 112, 128, and 160 Kbps. In Table 15-5, we show bit rates that are suitable for analog modem connections (14.4, 28.8, 33.6, and 56 Kbps) in bold.

Table 15-5: Mono Bit Rates for Streaming Sound

Sampling rate

Raw

Speech

ADPCM 2-bit

ADPCM 3-bit

ADPCM 4-bit

ADPCM 5-bit

5 kHz

80 Kbps

10 Kbps

10 Kbps

15 Kbps

20 Kbps

25 Kbps

11 kHz

176 Kbps

22 Kbps

22 Kbps

33 Kbps

44 Kbps

55 Kbps

22 kHz

352 Kbps

44 Kbps

44 Kbps

66 Kbps

88 Kbps

110 Kbps

44 kHz

704 Kbps

88 Kbps

88 Kbps

132 Kbps

176 Kbps

220 Kbps

Note 

If you'd like to see the actual sample rate used by Flash 8's MP3 compression options, see Table 15-7.

In Tables 15-6 and 15-7, we calculate the file sizes that one second of mono (one-channel) sound occupies in a Flash movie file (.swf). Use the values in these tables as multipliers for your sound file's actual length. For example, if you know that you have a 30-second soundtrack file, the final Flash movie file size (containing just the audio) would be about 60K with ADPCM 3-bit, 5 kHz compression. Regardless of the actual content of the digital audio, these encodings will produce consistent file sizes based on length and resolution.

Table 15-6: File Sizes in Bytes (KB) for One Second of Mono Audio

Sample rate

Raw

Speech

ADPCM 2-bit

ADPCM 3-bit

ADPCM 4-bit

ADPCM 5-bit

5 kHz

11,037

1,421

1,397

2,085

2,774

3,463

(10.8)

(1.4)

(1.4)

(2.0)

(2.7)

(3.4)

11 kHz

22,061

2,829

2,777

4,115

5,532

6,910

(21.5)

(2.8)

(2.7)

(4.0)

(5.4)

(6.8)

22 kHz

44,109

5,581

5,541

8,296

11,051

13,806

(43.1)

(5.5)

(5.5)

(8.1)

(10.8)

(13.5)

44 kHz

88,205

11,085

11,065

16,576

22,086

27,597

(86.1)

(10.8)

(10.8)

(16.2)

(21.6)

(27.0)

Table 15-7: File Sizes in Bytes (KB) for One Second of Mono MP3 Audio

Bit rate

Size

Output sample rate

Bit rate

Size

Output sample rate

8 Kbps

1,263

11 kHz

56 Kbps

5,605

22 kHz

(1.2)

(5.5)

16 Kbps

2,511

11 kHz

64 Kbps

8,543

44 kHz

(2.5)

(8.3)

20 Kbps

3,135

11 kHz

80 Kbps

10,716

44 kHz

(3.1)

(10.5)

24 Kbps

3,369

22 kHz

112 Kbps

14,980

44 kHz

(3.3)

(14.6)

32 Kbps

4,487

22 kHz

128 Kbps

17,112

44 kHz

(4.4)

(16.7)

48 Kbps

5,605

22 kHz

160 Kbps

17,112

44 kHz

(5.5)

(16.7)

Note 

You may notice that some bit rate settings in Table 15-7 create the same file size for the MP3 compression. This is a known bug of Macromedia Flash 8. You may also find that the Convert Stereo to Mono option for MP3 compression does not affect the outcome of some settings.

Extracting a Sound from a Flash Document

Sometime you may be handed a Flash document file (.fla) that has sound embedded within it and be told that the original sounds have either been lost or are no longer available. Here's how to extract a sound from such a file:

  1. Back up the file.

    If the original file is named sound.fla, you might resave it as sound_extraction.fla. If you want to start with an exercise file, save a copy of the enhanced_view.fla file, located on the book's CD-ROM. You can skip Steps 2 through 7 if you are using this file.

  2. Add a new layer in the Timeline window, at the top of the layer stack.

  3. Label this layer sound extraction.

  4. With the first frame of this layer selected, open the Property inspector.

  5. In the Sound menu, specify the sound file from the Library that you wish to export.

  6. Add enough frames to the sound extraction layer so that you can see the entire waveform of the sound file.

  7. Delete all other layers.

  8. Open the Library panel and locate the sound that needs to be extracted from the file.

    In the example file, the sound is named atmospheres_1.wav. Note that any other assets within this file are irrelevant to this process. That's because Flash will use only Library items that have actually been used within the movie.

  9. Double-click the sound icon for atmospheres_1.wav in the Library panel to invoke the Sound Properties dialog box.

  10. Set the Compression to Raw.

    This ensures that the sound will be exported as uncompressed audio.

  11. Select a sample rate that matches the one listed to the right of the waveform display, near the top of the Sound Properties dialog box.

    If the sound is specified as a Stereo sound, make sure the Convert Stereo to Mono option is unchecked.

  12. Access the Flash tab of the Publish Settings dialog box, and make sure that the Override Sound Settings check box is not checked.

    Now you're ready to extract the sound file from the Flash document file (.fla). You've created a movie that will ignore all other assets in the library except this sound, and you've told Flash to export the sound with the original sample rate of the sound, as uncompressed (Raw) audio.

  13. Choose File ð Export Movie, and specify a file location, name, and file type.

    If you're using the Windows version of Flash 8, choose WAV Audio as the file type. If you're on a Mac, choose QuickTime Video.

  14. For Windows users, the Export Windows WAV dialog box appears with those sound specifications. In the Sound Format menu, make sure the audio specifications match those of your audio source in the Library panel; then click OK. For Mac users, the Export QuickTime Video dialog box appears. Ignore all of the options except Sound Format. In this menu, select the sound setting that matches the specifications of the sound file. For this example, this setting should be 44 kHz 16 Bit Stereo. Click OK.

  15. For Windows users, the process is complete. You now have a WAV copy of your Flash movie sound asset. For Mac users, you still have a couple of steps to complete:

    1. Open the exported QuickTime movie in the QuickTime Pro Player. You must have the Pro version installed.

    2. Choose File ð Export.

    3. Select Sound to AIFF in the Export menu.

    4. Click the Options button, and in the Sound Settings dialog box, set the Compressor to None and choose a sample rate, bit depth, and channel type that match the sound from the Flash document. For this example sound, this should be 44.1 kHz, 16 bit, and Stereo. Click OK.

      Note 

      If you're using Apple QuickTime Pro 7 or higher, choose Linear PCM in the Format menu and the sampling settings that match your source audio in the Flash movie.

    5. Finally, specify a filename and location for the exported file, and click Save.

Cross-Reference 

We defer several sound-related topics until after our discussion of Flash 8's ActionScripting capabilities. Work your way to Chapter 27, "Interacting with Movie Clips," and Chapter 28, "Sharing and Loading Assets."

Web Resource 

We'd like to know what you think about this chapter. Visit www.flashsupport.com/feedback to send us your comments.




Macromedia Flash 8 Bible
Macromedia Flash8 Bible
ISBN: 0471746762
EAN: 2147483647
Year: 2006
Pages: 395

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net