Sound Digitization
Analog-to-Digital (A/D) Conversion - Conversion of a continuous-time function to a discrete-time function
Digital-to-Analog (D/A) Conversion - Conversion of a discrete-time function to a continuous-time function
Analog to Digital Conversion [HANDOUT]
Digital to Analog Conversion [HANDOUT]
The Sine Function (in the time domain)
f(t) = A sin (2 pi f0 t + o)
A is the amplitude
f0 is the frequency (Hz)
t is the time (sec)
o is the phase angle offset (radians)
pi is 3.141592...
A| * | * * | * * --+-*-----------*---------------- t |* * * | * * | *
The Sine Function (in the frequency domain)
f(t) = A sin (2 pi f0 t + o)
A is the amplitude
f0 is the frequency (Hz)
t is the time (sec)
o is the phase angle offset (radians)
pi is 3.141592...
| * A | | * A/2 * | * A/2 | * * | * --+----|----------- f ---|----+----|---- f | f0 -f0 f0
Periodic Waveforms
All periodic waveforms can be constructed from the sum of harmonically related sinusoids.
In general, if f is a periodic function, then
f(t) = A0 + A1sin(2 pi f t + o1) + A2sin(2 pi 2 f t + o2) + A3sin(2 pi 3 f t + o3) + ...
About Periodic Waveforms
The frequency f is often called the fundamental frequency and denoted f0.
All sinusoidal components of a periodic waveform have a frequency which is an integral multiple of the fundamental frequency. There frequencies are said to be harmonically-related to f0.
Building a Sawtooth Wave [HANDOUT]
Building a Square Wave [HANDOUT]
Fourier Analysis
Algorithms used to convert the time-domain representation of a waveform to its equivalent frequency-domain representation
Discrete Fourier Transform (DFT)
Fast Fourier Transform (FFT)
Fourier Transforms
The DFT of one period of a periodic waveform gives the frequency spectrum of that waveform.
The IDFT of the frequency spectrum of a periodic waveform gives one period of a periodic waveform.
Discrete Fourier Transform (DFT)
Given N time samples of a digital signal x[n], n=0, 1, 2, ..., N-1, the DFT of x[n], denoted X[k] is
given by
X[k] = (1/N) SUMn=0,...,N-1(x[n] e-2 pi i k n/N) k = 0, 1, 2, ... , N-1
where i2 = -1 and e-2 pi i k n/N = cos (2 pi k n/N) - i sin (2 pi k n/N).
Example: Use the equation for a square wave approximated using the first three terms (k=1,3,5). Substitute t = n/N and f = 1 to form an equation for x[n] from f(t) and evaluate the equation for n=0,1,...,N-1 to generate N equally-spaced samples of one period of this waveform for the DFT.
Inverse Discrete Fourier Transform (IDFT)
Given N frequency samples of a digital signal X[k], k=0, 1, 2, ..., N-1, the IDFT of X[k], denoted x[n]
is given by
x[n] = SUMk=0,...,N-1(X[k] e2 pi i k n/N) n = 0, 1, 2, ... , N-1
where i2 = -1 and e2 pi i k n/N = cos (2 pi k n/N) + i sin (2 pi k n/N).
DFT vs. FFT
DFT - O(n2) algorithm
FFT - O(n lg n) algorithm
The Sampling Theorem
To represent a signal digitally that contains frequency components up to X Hz, it is necessary to use a sampling rate R of at least 2X samples/second.
Example: If an analog waveform has frequency components at 1000, 2000 and 5000 Hz, we must sample at a minimum rate of 10000 Hz.
Aliasing [HANDOUT]
Aliasing occurs when sampling is performed at a rate less than twice the maximum component frequency of the sound wave.
If the sampling rate is R, then a sine wave component at frequency f > R/2 will be mapped to a sine wave component at frequency R/2 - (f - R/2) = R - f.
Frequencies in the DFT
The frequency represented by frequency index k in the DFT X[k] is given by F = kR/N, where R is the sampling rate in samples/sec and N is the number of samples analyzed.
Example: For the square wave frequency spectrum, if the number of samples taken for one period is 16, and the sampling rate is 32000 samples/sec, the fundamental frequency (k=1) of the square wave is 2000 Hz. The third harmonic (k=3) is at 6000 Hz. (NOTE: The second harmonic is silent.) etc.
Computer Storage Requirements
Example: How many bytes of storage are required to sample a 120-second stereophonic audio wave that has frequencies up to 20 kHz with each sample quantized to 16 bits?
Answer: 19,200,000 bytes (nearly 20 megabytes!)
COURSE INFORMATION | HOMEWORK ASSIGNMENTS
COURSE PROJECT | CS240 HELP DESK