Lecture 11 Sound Notes
Lecture 11 Sound Notes
Summary: Sources:
Basic concepts My research notes
underlying sound Dr. Ze-Nian Li’s course
Facts about human material at:
perception of sound
http://www.cs.sfu.ca/CourseCentral/365/li/
Computer
representation of
sound (Audio)
A brief introduction to
MIDI
1
Sound Facts
Sound is a continuous wave
that travels through the
air
The wave is made up of
pressure differences.
Sound is detected by
measuring the pressure The human Ear detecting Sound
level at a location
Sound waves have normal
wave properties
(reflection, refraction,
diffraction etc.)
2
Sound Facts
Wave Characteristics
Frequency: Represents the
number of periods in a
second and is measured in
hertz (Hz) or cycles per
Air Pressure
Amplitude
second.
Human hearing frequency Time
3
Principles of Digitization
Why Digitize?
Microphones, video
cameras produce analog
signals (continuous-
valued voltages)
To store audio or video Time
4
Principles of Digitization
Sampling: Divide the horizontal axis (time) into discrete
pieces
Quantization: Divide the vertical axis (signal strength -
voltage) into pieces. For example, 8-bit quantization
divides the vertical axis into 256 levels. 16 bit gives you
65536 levels. Lower the quantization, lower the quality of
the sound
Linear vs. Non-Linear quantization:
• If the scale used for the vertical axis is linear we say its linear
quantization;
• If its logarithmic then we call it non-linear (-law or A-law in
Europe). The non-linear scale is used because small amplitude
signals are more likely to occur than large amplitude signals, and
they are less likely to mask any noise.
5
Sampling and Quantization
Sample
Sample
Time Time
6
Nyquist Theorem
8
Quantization (Quality ->SNR)
In any analog system, Signal to Quantization
some of the voltage is Noise Ratio (SQNR)
what you want to The quantization error
measure (signal), and (or quantization noise)
some of it is random is the difference
fluctuations (noise). between the actual
value of the analog
SNR: Signal to Noise signal at the sampling
ratio captures the time and the nearest
quality of a signal (dB) quantization interval
value.
V2signal Vsignal
SNR = 10 log = 20 log The largest (worst)
V2noise Vnoise quantization error is
half of the interval?
9
SQNR Calculation (WC)
If we use N bits per sample, the range of
the digital signal is: -2N-1 to 2N-1
The worst-case signal to quantization noise
ratio is given by:
Vsignal 2N-1
SQNR = 20 log = 20 log = N x 20 log 2 = 6.02N (dB)
Vquant - noise 1/2
10
Miscellaneous Audio Facts
Typical Audio Formats
Popular audio file formats include .au
(Unix), .aiff (MAC, SGI), .wav (PC, DEC)
A simple and widely used audio
compression method is Adaptive Delta
Pulse Code Modulation (ADPCM). Based on
past samples, it predicts the next sample
and encodes the difference between the
actual value and the predicted value.
11
Audio Quality vs. Data Rate
Quality Sample Rate Bits per Mono/ Data Rate Frequency
(kHz) Sample Stereo (kBytes/sec) Band
(uncompressed)
12
MIDI
Musical Instrument Digital Interface
a protocol that enables computer, synthesizers, keyboards,
and other musical devices to communicate with each
other. Setup:
MIDI OUT of synthesizer is
connected to MIDI IN of sequencer.
THRU IN OUT IN OUT MIDI OUT of sequencer is connected
to MIDI IN of synthesizer and
Synthesizer/Keyboard MIDI Interface/Sound Card "through" to each of the additional
(Sequencer) sound modules.
IN THRU Working:
During recording, the keyboard-
MIDI Module A
equipped synthesizer is used to send
IN THRU MIDI message to the sequencer,
MIDI Module B which records them.
During play back, messages are sent
Etc.
out from the sequencer to the sound
Typical Sequencer setup modules and the synthesizer which will
play back the music.
13
MIDI: Data Format
Information traveling through the hardware is encoded in
MIDI data format.
The encoding includes note information like beginning of
note, frequency and sound volume; upto 128 notes
The MIDI data format is digital
The data are grouped into MIDI messages
Each MIDI message communicates one musical event
between machines. An event might be pressing keys, moving
slider controls, setting switches and adjusting foot pedals.
10 mins of music encoded in MIDI data format is about 200
Kbytes of data. (compare against CD-audio!)
14