25
1

1. Digitization of Sound What is Sound? Sound is a wave phenomenon like light, but is macroscopic and involves molecules of air being compressed and expanded

Embed Size (px)

Citation preview

1

Digitization of Sound

What is Sound?• Sound is a wave phenomenon like light,

but is macroscopic and involves molecules of air being compressed and expanded under the action of some physical device.

• For example, a speaker in an audio system vibrates back and forth and produces a longitudinal pressure wave that we perceive as sound.

• Since sound is a pressure wave, it takes on continuous values, as opposed to digitized ones.

2

• Even though such pressure waves are longitudinal, they still have ordinary wave properties and behaviors, such as reflection (bouncing), refraction (change of angle when entering a medium with a different density) and diffraction (bending around an obstacle).

• If we wish to use a digital version of sound waves we must form digitized representations of audio information.

3

Digitization

Digitization means conversion to a stream of numbers, and preferably these numbers should be integers for efficiency.

4

Digital Signal

Use Pulse Code Modulation (PCM) to represent an audio signal by digital data.

5

Basic Digital Audio Concepts Sampling rate

Number of sample taken of a signal in a given time (usually one second)

Bit depth Describes the accuracy of the audio data

Channels E.g. Stereo has two channels

Bit rate Measured in kilobits per second (Kbps) is a

function of the bit depth and sampling rate

6

Sampling rate

The more sample taken per second, the higher the accuracy.

Typically measured in kilohertz (KHz). CD audio has 44,100 samples per

second (44.1KHz). 8 KHz produces lower quality radio

sound. Standard sampling rates include “8KHz”, “11.025KHz”, …

The high-end 96K is used in DVD, but is not applicable to the Web.

7

Sampling Rate

8

demo

Bit depth

• Also called “sampling resolution” or “word length”.

• The more bits, the better is the quality of the audio (and a larger file of course).

• Common bit depths are 8-bit (telephone like), 16-bit (CD quality), and 20, 24, 32, 48-bit depths.

• How many signal can a 8-bit and a 16-bit data represent?– 0000 0000 1111 1111– 0000 0000 0000 0000 1111 1111 1111 1111

9

Channels

Audio file can support one to six channels of audio formats.

Mono – one channel Stereo – two channels Some others – three, four channels. Six channels – 5.1-channel surround

sound. More multi-channel formats announce

in the coming years.

10

Channel Examples

11

Bit rate

Audio files are measured in terms of bit rate which is measured in kilobits per second (Kbps).

It can be calculated by dividing the file size by the time (in second) to play the audio clip. E.g. 3Mb file play in 30 seconds 3000k / 30 = 100kbps.

Quality at different compression rates

12

Optimizing for the Web

Length of the audio clip Keep the audio clip as short as possible. E.g. just keep the most sweetest part of

your greeting. Number of channels

A mono audio file is halved the space of a stereo file.

Depends on your actual needs.

13

Optimizing for the Web

Bit depth Audio file on the Web are usually 8-bits. Half the size of a 16-bit file.

Sampling rate Half the sampling rate will also halve the

space needed. Voice only audio file can be reduced to

8KHz. 22 KHz music clips are acceptable.

Putting all things together: Mono, 8-bit, 22KHz, MP3 compression.

14

Calculate audio size

Size = Bit Depth X Sample Rate X File Length X Channels

8-bit mono: seconds x KHz 16-bit mono: (seconds x KHz) x 2 8-bit stereo: (seconds x KHz) x 2 16-bit stereo: ([seconds x KHz] x 2)x2 E.g. the file size of 30 seconds of 16-

bit, 11KHz mono audio: (30 x 11) x 2 = 660K.

15

Streaming Audio

What is it? Play almost immediately after the request,

continues playing the transferring data. Advantages:

Address the problem of long download time. Control distribution and protect copyright,

because the user cannot get a copy of the file.

Disadvantages: Sound quality may be affected by low speed

or unstable Internet connection.

16

What is Streaming?

17

How does it work?Streaming audio

18

Web browser

Web server

RealAudioServer

Web browser requesta RealAudio fromthe web server

Packet are sent to a buffer on the receivingComputer, the RealPlayer will play the soundFile when buffer full

Web Audio Formats

WAV/AIFF (.wav/.aif/.aiff) The Waveform Audio File format (.wav)

was developed by Microsoft, supports arbitrary sampling rates and bit depths.

The Audio Interchange File format (.aif, .aiff) was developed for Macintosh platform.

They are less likely used on the Web, because people use “mp3” or “streaming”.

19

MP3 (.mp3)

Able to maintain excellent sound quality at very small file sizes.

The compression reduces an audio file to one-tenth of its original size. E.g. 40MB file 3.5MB

MP3 is actually MPEG-1 Layer-III Good for distribution of HQ audio. Demo: www.mp3.com

20

Apple QuickTime Audio (.mov) QuickTime is a well-known video

format, but it can create audio-only movies.

QuickTime is a container format, which is able to store still images, movie formats, … Excellent compression, true streaming

Netscape and IE have Plug-in now.

21

MIDI (.mid/.midi)

MIDI stands for “Musical Instrument Digital Interface” which is developed for electronic musical instruments.

MIDI files are very compact and very good for low-bandwidth delivery.

Instruments are “piano, drums, bass, orchestral strings, …”

It is very attractive for adding MIDI file to your website with very little download time.

22

RealMedia/RealAudio (.rm/.ra) RealAudio is a server-based streaming

audio format. The RealServer responses to the requests

and delivers the streaming packets, including the bandwidth negotiation.

A robust RealServer can support thousands of simultaneous listeners.

Good for continuous-playing audio and live broadcasts to a large group of people.

Example: RTHK Radio

23

Windows Media (.wma/.asf) Windows Media is a streaming

system. It wraps all media elements into a

Active Streaming File (.asf). Audio may be saved as non-

streaming Windows Media Audio format (.wma).

Good for continuous-play audio. The encoder and player is Free,

shipped with Windows OS.24

Choosing an audio format

25

Audio NeedsAudio Needs Suggested formatsSuggested formats

Short voice greetingsShort voice greetings WAV, AIFF, MP3WAV, AIFF, MP3

News broadcastsNews broadcasts Streaming solutions Streaming solutions (RealAudio, Windows Media)(RealAudio, Windows Media)

Background musicBackground music MIDI, WAVMIDI, WAV

Music samples for some Music samples for some audienceaudience

MP3 or QuickTimeMP3 or QuickTime

Radio-style or Live Radio-style or Live broadcastingbroadcasting

RealMedia SystemRealMedia System

Musical E-greeting cardMusical E-greeting card MIDI, WAVMIDI, WAV