You are on page 1of 42

MULTIMEDIA SYSTEM

Chapter Five : Basics of Digital Audio

1
Sound
You can use sound in a multimedia project in two
ways. In fact, all sounds fall into two broad categories:
Content sound
Ambient sound
Content Sound
Content sound provides information to audiences
Some examples of content sound used in multimedia are:
Narration: provides information about an animation that is
playing on the screen.
Testimonials: sound tracks in presentations or movies
Voice-overs: used for short instructions, for example, to
navigate the multimedia application.
Music: used to communicate (as in a song).

2
Ambient Sound
Ambient sound consists of an array of background and
sound effects. These include:
Message reinforcement: The background sounds you hear
in real life, such as the crowds at a ball game, can be used
to reinforce the message that you wish to communicate.
Background music: Set the mood for the audience to
receive and process information by starting and ending a
presentation with music.
Sound effects: Sound effects are used in presentations to
liven up the mood and add effects to your presentations,
such as sound attached to bulleted lists

3
Where can you get Sound?
Pre-Packaged
Create your own sound
Recording program with a computer's operating system
(such as Sound Recorder) and speak into a microphone
attached to the computer – quality will not be the best
Recording studio with equipment such as DAT (Digital
Audio Tape) devices that record sounds digitally. Produces
a high quality commercial product
Electronic instruments such as synthesizers can be used to
create music sound files. Connecting the instrument to a
computer allows the sounds to be captured in a MIDI
(Musical Instrument Digital Interface) format.

4
What is Sound?
Sounds are pressure waves of air
Visualize the sounds as a series of recurring waves called a waveform.
Question:
 Which part of the wave indicates the volume of the sound?
 Which part of the wave indicates the pitch or frequency?
Volume (Amplitude)- the higher the wave the louder the sound
Frequency – refers to the number of complete sound waves a given
sound has per second.
Pitch – is a letter name which is associated with sounds of a particular
frequency.
So, Pitch and Frequency are related in that all musical pitches have
some sort of frequency, but not all frequencies are necessarily
associated with a single pitch name.
Pitch or frequency - the closer together the waves the higher the pitch
5
Duration – length of time sound lasts.
How do computers represent sound?
Computer must somehow represent the wave.
Question: What two things does a computer always do
when it needs to represent something?
Sample
Quantize

Sampling
Suppose we are sampling a sine wave, How often do we
need to sample it to figure out its frequency?

If we sample at 1 time per cycle, we can think it’s a


constant
6
If we sample at 1.5 time per cycle, we can think it’s a
lower frequency sine wave

Now if we sample at twice the sample frequency, i.e Nyquist


Rate, we start to make some progress
An alternative way of viewing the waveform (re)generation is
to think of straight lines joining up the peaks of the samples.

7
In this case( at these sample points) we see we get a saw tooth
wave that begins to start crudely approximating a sine wave.

The Nyquist Theorem(Nyquist rate)

This rule says you MUST take at least 2 samples for every
cycle of the wave.
The Sampling frequency(rate) for a signal must be at least
twice the highest frequency component in the signal.
Indeed many times more the better
Question: Which of these sound waves has a higher
pitch?

8
 We MUST take 2 or more samples per wave
 Question:
 What is the advantage /disadvantage of taking lots of samples per wave?
 Number of samples per second is represented in Hertz (Hz)
 Humans can hear between 20Hz to 20KHz
 For CD quality we need 44,100 samples per second or 44,100Hz or 44.1KHz

Sample Rate
 Sample Rate  number of samples we take per second of audio

9
Sample Rate
Each dot represents a sample
The mass of numbers can then be accurately converted back to the original
analog signal

10
Typical Sample Rates
Voice Only (Telephone Quality) 8KHz
AM Radio Quality 11.025 KHz
FM Radio Quality 22 KHz
CD Quality Music  44.1KHz

Sample Rate Example


 Audio A was sampled at 8000Hz (8KHz) and B at 16000Hz (16KHz).
 Question: Which one should sound better?
11
Quantizing (sample Size)
 Now that we know how many samples we will have (likely one of
22KHz or 44.1KHz), how do we represent either sample?
 Question: What would 1 bit sound (remember 8 bit and 24 bit colour) look like?

0
1
0 0 0 0 1 0 1 0 1 0
How about 2 bit sampling? (this will only be 4 tones)

00
01
10
11
12
01 00 01 01 11 01 10 01 11 01
Sample Size
CDs use 16-bit rate (65,536 possible values could be given to each
sample)
Question: What is the advantage of having a higher bit rate for the
sample size?
Question: What is the disadvantage of having a higher bit rate for the
sample size?

13
How does the sound wave get converted to be stored on our computer?
Computers have a sound card which samples (sets the number
of sample and quantizes) the sound wave from a microphone.
Sound card has an Analog-to-Digital Converter (ADC) for
recording, and a Digital-to-Analog Converter (DAC) for
playing audio.
Operating system (Windows, Mac OS X, Linux, etc.) talks to
the sound card to actually handle the recording and playback

14
Sound Editing
Basic sound editing includes:
Rearrange the Waveform
Cut, copy, drag, trim parts of the waveform
Overlap two or more pieces of audio
Find words you want to edit out and cut
them from the wave form.
Modify the Volume
Use amplify, fade-in, fade-out, envelope,
normalize

15
Sound Editing
Noise Reduction
Hiss Reduction : noise within a given
frequency range
Noise Reduction/Removal: software
examines the audio and finds unusual
differences from waveform and removes
them.
Special Effects
Adding echo, changing the pitch of a
portion
Down sample and reduce the
bit depth
 compress, WHY COMPRESS?
16
17
Why compress sound?
An example of uncompressed sound with CD quality for 1
minute of audio:
1 minute of recording  60 seconds
60 * 44,100 samples/second  2,646,000 samples
2,646,000 samples * 16bits per sample  42,336,000 bits
42,336,000 bits * 2 (stereo, 2 channels)  84,672,000 bits
84,672,000 bits / (8bits per byte) 10,584,100 About 10 MB
(Megabytes)!!!
A typical CD can hold about 737MB (or 80 minutes of audio)

18
Sound Compression Strategies
Reduce the number of samples (sample rate)
Reduce the bit depth (sample size)
Reduce the channels
Compress using the appropriate codec

19
Reduce the Sample Rate
 Go from 44KHz to 22KHz (this will affect the quality)
 Note: halving the number of samples will approximately half the file size

Reduce the Sample Size


 Go from 16 bit to 8 bit (this will affect the quality)
 Note: halving the bit depth will approximately half the file size

Reduce the number of channels


 In mono there is one channel
 In stereo there is two channels
 Changing from stereo to mono will ½
the size of the file

20
Pick the appropriate codec
Codecs for audio can be either lossy or lossless.
 NOTE: almost all are lossy!
File Formats that use lossy codec:
Question: Does anyone know the most famous audio
file format that does lossy compression?
Hints:
 Start to become popular in the early 90s
 Can compress a song from a CD (songs on CDs are 44KHz,
16bit and uncompressed) to 1/11 of its size
 Based on the idea that some tones become unable to hear when
another tone is present

21
Audio Compression
File Formats that use lossless
codecs/compression:
There are a few but not very common
Common File Formats that are uncompressed:
.wav (very common, 44KHz, 16bit)
.aiff
.cdda
 standard for CDs, 44KHz, 16 bit per sample, 2 channels.
 Thus 1 second of music must be played at a bit rate of:
44100*16*2*1=1,411,200 bits per second = 1411.2Kbits per second
 Compare with: mp3 128Kbits per second is most common, makes
it good for the Internet!
22
Audio File Formats
Audio File Advantages Disadvantages
Format Extension
Advanced .aac •Good sound quality •Copy protected
Audio •Used on iTunes •Limited to approved devices
Coding
Audio .aif /.aiff •Excellent sound quality •Uncompressed so large files
Interchange •Supported without a plug-in
Format
MP3 .mp3 •Good sound quality even •Requires standalone player
though compressed or browser plug-in
•Can be streamed over the Web
Real Audio .ra, .rx •High Compression •Sound quality not great
•Very small files •Requires a player or plug-in
•Can be streamed over the web
Wave .wav •Good sound quality •Uncompressed, very large
•Supported without a plug-in files
Windows .wma •Good sound quality even •Files can be copy protected
Media Audio though compressed •Requires Windows Media
•Used on music download sites Player 9 or higher
23
MIDI Sound
There is another completely different way to make sound
(rather than manipulating the waves).
MIDI stands for Musical Instrument Digital Interface.
MIDI is a technical standard that describes a protocol,
digital interface and connectors and allows a wide variety
of electronic musical instruments, computers and other
related devices to connect and communicate with one
another.

24
MIDI carries event messages that specify notation, pitch
and velocity, control signals for parameters such as volume,
vibrato, audio panning, cues and clock signals that set and
synchronize tempo between multiple devices.

25
MIDI Music
MIDI deals with music and synthesized sound, it does not
handle voices or noise well.
There is no sampling or quantizing when storing MIDI files.
That is not digitized sound; it is a short hand representation
of music stored in numeric form.
MIDI data is device dependent; its playback depends on the
capabilities of the end user’s system.
MIDI works by recording the following:
Keys pressed
Time when the key was pressed
Duration for which the key was pressed
How hard the key was struck

26
MIDI Files
 A MIDI file is not a recording of actual music. Rather, it is a
spreadsheet-like set of instructions, and can use a thousand
times less disk space than the equivalent recorded audio.
 Software such as Cakewalk, Cubase and Finale can be used
to create and edit MIDI music.
 NOTE:
 3 minutes of MIDI file will be about 10KB
 3 minutes of uncompressed waveform will be about 15MB

27
Question: What are the advantages/disadvantages of
MIDI files?
The major drawback to this is the wide variation in
quality of users’ audio cards, and in the actual audio
contained as samples or synthesized sound in the card
that the MIDI data only refers to symbolically.
Even a sound card that contains high- quality sampled
sounds can have inconsistent quality from one
instrument to another. MIDI itself contains no sound,
and the quality of its playback depends entirely on the
quality of the sound-producing device(and sound
recording of samples in the device).

28
Sound on the Internet
Downloadable Audio Streamed Audio
Advantages Disadvantages Advantages Disadvantages
Once downloaded, Takes a long time Plays immediately Cant rewind, pause,
can be replayed, to download, etc.
edited over and especially for big
over (don’t need to files
wait again for
download)
Don’t need a Takes up disk space Consumes RAM Need a special
special streaming on the computer to only while being server to post it
web server to post store it played, then purged
the file after

29
Posting Sound on the Web
Can either:
Have a link to music that the user clicks on. Music will
never start playing on the web page until the user clicks
on link.
 <p>Download a <a href="dearmom.wav">sound file </a></p>
Have the music embedded in the web page. Music could
potentially start playing as soon as the user comes to the
web page.
 <embed src="dearmom.wav" autostart=“true" width="144"
height="50" loop="1">

30
31
Audio software

32
33
34
Sound Hardware

35
36
37
38
39
40
41
42

You might also like