Transcript week-3

Lecture Three
Digital & Analogue Sound
Overview
• By the end of this lecture you will be familiar with:
–
–
–
–
–
Theory behind sound
Analogue Vs Digital sound
Implications for multimedia
Sampling audio
Anatomy of sound cards
2
Sound theory
What is Sound?
• Frequency, e.g. Middle C: 256 Hz - High C: 512 Hz
4
What is Sound cont.?
• Amplitude - loudness (usually measured in dB)
• Pure sound -v- musical instruments
• Harmonics
5
Analogue Sound
• Continuously varying
waveform
• ‘Records’ & tape cassettes
are analogue media
• Voltages recorded and regenerated
• Still the preference of
purists
6
Digital Sound
• Sound recorded as 1’s and 0’s
(as usual)
• Compact discs and mini discs
are digital media
• Recording: analogue to digital
converter (ADC)
– changes voltages to digital
stream of 1’s and 0’s
• Playback: digital to analogue
converter (DAC)
– changes digital stream back to
voltages
• Limited in quality by sampling
settings
7
Implications
• Copying of analogue media - loss of quality
• Copying of digital media - perfect replication
• Concerns over copyright theft
• Digital is Robust
• Digital is Compact
• No ‘graceful degradation’ with digital
8
Quality of Digital Sound
Features of Sound Cards
9
Quality & Sampling Frequencies
• Nyquist Sampling Theorem
– faithful sampling requires a sampling frequency twice
that of the highest frequency in the signal
• Human ear: 20Hz to 20kHz (approximately)
• Audio CD sampled at 44.1kHz
• Two issues:
sampling frequency
number of bits per sample
10
Number of bits per sample
• Affects the quality of the digital sound
Dynamic Range
• 8 bits => range split into 256 steps
• Issue also of mono and stereo (2 tracks)
11
Example 1
• CD-quality sound recording
– 44.1kHz sampling frequency, 16-bits per sample,
stereo sound
1 second has 44,100 samples of 2 bytes each
=
88,200 bytes x 2 channels
=
176,400 bytes / second (or 172.3kB/s)
12
Example 2
• Telephone speech has a narrow bandwidth of
around 3.6kHz
1 second has 7200 samples at 8 bits mono
=
7200 bytes / second
=
7kB/s
(and could be much less if compression is used)
13
Example 3
• A CD-ROM can store 650MB of data or 74
minutes of stereo music at 44.1kHz.
What is the sample size?
650 / 74 = 8.78 MB / minute = 150kB/s =
150*1024*8 bits/s
88,200 samples per second
So , 150 * 1024 * 8 / 88200 = 14 bits per sample
14
Final Example
• One minute of sound must be recorded using a
maximum of 2.5MB of memory.
What are the sampling options?
Available for 1 second is 2.5*1024/60 = 42.67kB
OPTION 1: 8-bit & 42.67kHz rate, mono
OPTION 2: 16-bit & 21.33kHz rate, mono
OPTION 3: 8-bit & 21.33kHz rate, stereo
OPTION 4: 16-bit & 10.67kHz rate, stereo
15
Features of Sound Cards
Anatomy of a Sound Card
17
Digital Audio Replay & Recording
• Matched pair of D-to-A and A-to-D converters
• Programmable sample rate generator
– rates usually fractions of 44.1kHz
– latest cards are using fractions of 48kHz (DAT)
– best cards are using 96kHz (professional systems)
• Full-duplex operation only on better cards
– needs 2 DMA channels => complex installation
18
MIDI
• Musical Instrument Data Interface
• Records:
– which instrument, e.g. flute
– which note, e.g. middle C
– duration, tempo, attack/decay, volume
• Allows for 16 simultaneous ‘voices’
• Recorded from MIDI-compatible instruments
19
MIDI Synthesiser
• FM synthesis
– mathematical descriptions of the characteristics of
musical instruments
– get a facsimile of the instrument playing the note
• Wave-table synthesis
– much more realistic (c.f. a piano sound on each)
– uses samples of actual sounds made by real musical
instruments
20
Wave-tables
• One or more samples for each instrument.
• Sound cards vary in their polyphony, i.e. the
maximum number of notes which can be played
at once, e.g. 8 or 16.
• Wave-table can be held in ROM or RAM (the
latter allowing download from the host).
• DSP chip may offer other effects, e.g. reverb.
21
MOD files
• A de-facto standard in computer games industry
• File contains the sample data (c.f. MIDI) + song
• Song is specified as series of steps (16/bar)
– pitch of the note
– which sample is to be used
– modifications to the sample, e.g. vibrato
• Ability to loop sections, e.g. for rhythm
22
Questions?
23