Basics of Sampling and Quality Flash

Before you begin integrating sound with your Flash project, it’s important to understand the basics of digital audio. To help you with this, we’ve dedicated this to an introduction to sampling, bit resolution, and file size and the relevance of these topics to sound in Flash 5.

What is sound?
Sound, or hearing, is one of our five principal sensations; it’s the sensation that’s produced when vibrations in the air strike the aural receptors located within our ears. When we hear a sound, the volume of the sound is determined by the intensity of the vibrations, or sound waves. The pitch that we hear meaning how high (treble) or low (bass) is determined by the frequency of those vibrations (waves). The frequency of sound is measured in hertz (which is abbreviated as Hz).

Theoretically, most humans have the ability to hear frequencies that range from 20 to 20,000 Hz. The frequency of the sound is a measure of the range of the sound from the highest high to the lowest low. It’s important to note here that, when starting to work with sound, the most common error is to confuse the frequency of the sound with the recording sample.

What you should know about sound for Flash
When integrating sound with Flash, a number of factors affect the final quality of the sound and the size of the sound file. The quality of the sound is important because it determines the aesthetic experience of the sound, while the file size is important because it determines how quickly (or not) the sound will arrive at the end user’s computer. The primary factors that determine the quality and size of a sound file are sample rate and bit resolution.

Sample rate
The sample rate, measured in hertz (Hz), describes the number of times an audio signal is sampled when it is recorded digitally. In the late 1940s, Harry Nyquist and Claude Shannon developed a theorem that determined that, for optimal sound quality, a sampling rate must be twice the value of the highest frequency of a signal. Thus, the higher the sample rate, the better the audio range. Generally, higher sample rates result in a richer, more complete sound. According to Nyquist and Shannon, in order for the audible range of 20 to 20,000 Hz to be sampled correctly, the audio source needs to be sampled at a frequency no lower than 40,000 Hz, or 40 kHz. This explains why CD audio which closely resembles the source sound is sampled at 44.1 kHz.

The less a sound is sampled, the further the recording will deviate from the original sound. However, this tendency toward loss of the original quality of the sound yields one advantage: When the sample rate of a sound file is decreased, the file size drops proportionately. For example, a 300KB, 44.1 kHz sound file would be 150KB when saved as a 22.05 kHz file. See Table below for more details on how sample rate affects quality.

Audio sample rates and quality

Audio sample rates and qualityAudio sample rates and quality

Because the native playback rate of all audio cards is 44.1 kHz, sound that is destined for playback on any computer should be a multiple of 44.1. Thus, we recommend sample rates of 44.1 kHz, 22.05 kHz, and 11.025 kHz for any use on computers. (Although sample rates that deviate from the rule of 44.1 may sound fine on your development platform, and may sound fine on many other computers, some may have problems.

This simple rule will go a long ways toward reducing complaints of popping and distorted sound.) This becomes more important with Flash. When Flash imports sounds that are not multiples of 11.025, the sound file is resampled, which causes the sound to play at a lower or higher pitch than the original recording. This same logic applies to sound export, which is discussed later. Finally, although Flash menus list sample rates as 11, 22, and 44, these are abbreviations for the truly precise sample rates of 11.025, 22.05, and 44.1 kHz.

Bit resolution
The second key factor that influences audio quality is bit resolution (or bit depth). Bit resolution describes the number of bits used to record each audio sample. Bit resolution is increased exponentially, meaning that an 8-bit sound sample has a range of 28, or 256, levels, while a 16-bit sound sample has a range of 216, or 65,536, levels. Thus, a 16-bit sound is recorded with far more information than an 8-bit sound of equal length. The result of this additional information in a 16-bit sound is that background hiss is minimized, while the sound itself is clearer. The same sound recorded at 8 bits will be noisy and washed out.

Reducing file size
Another point to remember is that the 16-bit sound file is twice the size of the same file saved at 8-bit quality. This is due to the increase in the amount of information taken to record the higher quality file. So, if your sound is too big, what can you do?

Well, a sound that’s been recorded at a higher bit resolution can be converted to a lower bit resolution, and a sound with a high sample rate can be converted to a lower sample rate. Although a professional studio might perform such conversions with hardware, either of these conversions can also be done with software.Below lists the various bit depths of sound along with their quality level and possible uses.

Audio bit resolution and quality

Audio bit resolution and quality

Refer to below for a comparison of the differences between sounds at different sample rates and bit depths. Both figures show a wave form derived from the same original sound file, differing only in their sample rates and bit depths. The waveform of the 16-bit 44.1 kHz sound has twice as many “points” or samples of information as the 8-bit 11.025 kHz sound. Because the 16-bit 44.1 kHz sound has more samples, the gap between each sample isn’t as large as the gaps of the 8-bit 11.025 kHz sound. More samples result in a much smoother, cleaner sound.

This is a waveform of a sound sampled at 44.100 kHz with a 16-bit resolution, as displayed in a high-end sound application.

This is a waveform of a sound sampled at 44.100 kHz with a 16-bit resolution, as displayed in a high-end sound application.

Here’s the same sound as shown above, but down sampled to 11.025 kHz with an 8-bit resolution.

Here’s the same sound as shown above, but down sampled to 11.025 kHz with an 8-bit resolution.

Audio files are either mono (single channel) or stereo (dual channel: left and right). Stereo files are twice the size of mono files because they have twice the information. Most audio-editing applications offer the option to mix the two stereo channels together and either save or export a stereo sound to a one channel mono sound. Most audio applications also have the ability to save the right or left channel of a stereo sound separately as a .WAV or .AIF file.

With the more robust, multitrack-editing applications, such as Deck II, ProTools, or AudioLogic, it’s not unusual to work with eight or more audio tracks limited only by your system configuration. As you might imagine, these applications give the sound artist greater control over the final sound mix. For use in Flash, these multitrack audio project files need to be “bounced” or mixed down to a stereo or mono file in order to be saved as WAV or AIF files.

File size
You should be concerned about the file size of your audio clips for a several reasons.

  • Sound files require a large amount of drive space.
  • Managing large sound files, and importing them into Flash can be cumbersome and slow.
  • Download times for large, elaborate sound clips (even when heavily compressed upon export from Flash) can be detrimental to the appreciation of your Flash project, even if you have what might be considered a high speed Internet connection.

Production tips
When working with audio clips, it’s important to create the shortest audio clips possible. That means trimming off any excess sound that you don’t need, especially any blank lead-in or lead-out handles (also called in and out points) at the either the beginning or the end of a clip. This procedure is discussed briefly later. If you plan to have a background music track in your Flash project, it’s a good idea to use a small audio clip that can be looped.

Here is a simple formula to determine the file size, in bytes of a given audio clip:

Thus, a 20-second stereo audio loop at 8 bits, 11 kHz would be calculated like this:

20 sec×11,025 Hz×2 channels×(8 bits ÷ 8 bits/byte) = 441,000 bytes = 430 KB

There are two schools of thought regarding the ideal quality of sound files for import into Flash. These schools are pretty much divided into those who have high-end sound-editing tools and those who don’t. In an effort to delineate the best path for each group, we’ve noted the following: (a) If you don’t have high-end sound tools available, then you may be among those who always prefer to start with audio source files of the highest possible quality (16 bit, 44.1 kHz is ideal), and then use the Flash sound settings to obtain optimal compression upon export. (b) If you do have high-end sound tools available, then you may prefer to compose most of your clients’ music from scratch and that you very rarely work with the MP3 format before importing into Flash. You may also disagree with those who advise that one should bring their sound into Flash at the highest quality before optimizing. This workflow difference may be attributable to the plethora of options that are available to those with high-end sound tools.

Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Flash Topics