Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sampling Terminology f 0 is the fundamental frequency (Hz) of the signal –Speech: f 0 = vocal cord vibration frequency (>=80Hz) –Speech signals contain.

Similar presentations


Presentation on theme: "Sampling Terminology f 0 is the fundamental frequency (Hz) of the signal –Speech: f 0 = vocal cord vibration frequency (>=80Hz) –Speech signals contain."— Presentation transcript:

1 Sampling Terminology f 0 is the fundamental frequency (Hz) of the signal –Speech: f 0 = vocal cord vibration frequency (>=80Hz) –Speech signals contain harmonics of 5 KHz or less –The upper limit of human hearing is about 22 KHz f s = sampling frequency in measurements per second t s is the sampling period (t s = 1/f s ) x[n] x n = amplitude of the n th signal measurement (sample) X[f] or X f = amplitude of the f th frequency component (bin) X(f) or x(n) = continuous signal frequency and time domains

2 Quantization Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011.

3 Measurements Terminology –We normally measure continuous signals at discrete times –Quantization (bits) converts measurements to numeric values –Sample rate (samples per second) = time between measurements Measurement error (| measured value - true value| ) –Precision: quality of a single measurement Half of the least significant digit Random noise eliminated by averaging many measurements –Accuracy: quality of the result Repeat experiment and average the results Ex: Sample the ocean floor 1000 times to determine the depth. Poor accuracy indicates poor repeatability or bad calibration

4 Quantization Errors Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011.

5 Quantization errors effect on frequency domain Time domain quantization errors Frequency domain

6 Analog-to-digital Converters (A-D) The A-D Conversion process –Converts a stream of varying air pressure into voltages –The A-D converter samples the voltage at regular intervals –Convert each sample to an integer of a fixed bit size Insufficient Quantization (Not enough quantization bits) –Different perceived sounds convert to the same value Limits of quantization (Signal-to-noise ratio (SNR)) –If SNR is small, the lower bits simply measure noise Quantization types –Linear: output varies linearly with input –Non-linear: logarithmic conversion from input to output Quantize continuous signals to streams of discrete integers

7 Linear Encoding Example: Values 0..255 has an 8 bit resolution. –Measurement range: -64 to 63 decibels –Voltage resolution: (2 7 -0)/2 8 = ½ decibel The output values relates linearly to the input values Decibels  Amplitude 

8 Non-linear Encoding Algorithms Uses (ex: telephony – voice over distance) –Use limited bandwidth channels –Convert from 12 or 16 -> 8 bits –Logarithmic representation Formulae –Mu-law algorithm (North America, Japan) μ = 255, x normalized between [-1,1] -1<=x<=1; y=ln(1+μx) / ln(1+μ) –A-LAW algorithm (Europe, world wide) A = 87.6, x normalized between [-1,1] IF |x|<=1/A; y=Ax/(1+ln A) IF 1/A<=|x|<=1; y=(1+lnAx)/(1+lnA) Humans hear sounds up to 120db with a sensitivity of about 1db Therefore 8 bit samples should be sufficient

9 Fixed Point Representation Advantages –Very fast add, multiply, and subtract operation –Shift operations for extremely fast power of two operations Disadvantages –Division operations convert to use floating point circuitry –Cannot represent very large or very small numbers –Represents a fixed range of numbers –Loss of precision during division –Scaling between precisions is very cumbersome Example –Scale values 0 to 10.5 using 64 bit integers –The value zero maps to zero. –The value 10.5 maps to 2 64 -1 –The resolution is 10.5 / 2 65 The decimal point is at a fixed position

10 Floating Point Representation Represents numbers in scientific notation –Decimal: 987.654 = 9.87654 * 10 2 –Hexadecimal: 89a.bcd = 8.9abcd * 16 2 –Contains an exponent and a base (mantissa) Advantages –A sliding window of precision –Represents an extremely large range of numbers Disadvantages –Add, multiply, and subtract operations are slower –Shift operations cannot be used –Holes in the number line A sliding decimal point according to the size of the number

11 Floating Point Formats Exa mple: Convert 329.390625 to 32 bit floating point 1.Convert to binary: 329 -> 101001001.011001 (256+64+8+1) Fractional portion: 011001 0.390626 * 2 = 0.78125 -> 0 0.78125 * 2 = 1.5625 -> 1 0.5625 * 2 = 1.125 -> 1 0.125 * 2 = 0.25 ->0 0.25 * 2 = 0.5 -> 0 0.5 * 2 = 1 -> 1 (no fraction left, so we are done) 2.Convert to binary scientific notation: 1.01001001011001 * 2 8 3.Add the exponent to the bias: 8 + 127 = 135 (10000111) 4.Answer: 0 10000111 01001001011001000000000 Special Values –Zero: Exponent = Fraction = 0 –± Infinity: sign * (Exponent all 1s, faction = 0) –NaN: Exponent all 1s and fraction ≠ 0 SignExponentFractionBias Single1[31]8[23->30]23[0-22]127 Double1[63]11[52-62]52[0-51]1023

12 Recommendations for Human Speech Processing Computers are not as good as the human ear Most humans cannot hear frequencies above 20 kHz. Human Hearing Sensitivity –Most speech is encoded in frequencies < 8kHZ –Maximum sensitivity is approximately 22kHZ –Hearing loss occurs at the high end of the range –We are more sensitive to frequencies at the low end of the range –Sensitivity follows a logarithmic curve Quantization –Linear: Bits per sample >=12 –Non-linear: Bits per sample = 8 Common audio CD formats: 44.1, 22.05, and 11.025 kHz

13 Aliasing When does this occur? – Frequencies (f >N ) present that are above Nyquist Frequency(f N ) – If f ∆ = f >N – f N, then f N +f ∆ is indistinguishable from f N -f ∆. What do we do about it? – Place an anti-aliasing filter to eliminate high frequencies – This CANNOT be done in software Example of aliasing - Take a picture of sun every 23 hours 24 x 23 = 552 hours between sunrises Sun appears to move from west to east Different frequencies become indistinguishable

14 Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011.

15 7khz appears as 1khz 4khz appears as -2khz, or 2khz 180 0 out of phase

16 Aliasing and Filtering Alias is out of phase in this example

17 Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011.

18 Low Pass Filtered Signal Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011.

19

20

21 Nyquist Theorem Nyquist Frequency (f N ) = highest detectible frequency Sampling Frequency (f s ) = samples per time period Maximum Signal Frequency of Interest (f max ) Theorem: f N = 2 * f max ; f s >= f N Inadequate Sampling Adequate Sampling How many cycles per second do we need?

22 Sampling formulae 0 th sample: x 0 = sin(2 πf X 0t s ) 1 st sample: x 1 = sin(2 πf x 1t s ) … n th sample: x n = sin(2 πf x nt s ) Note: Sinewave of (f x +kf s ) Hz aliases sinewaves of f 0 Hz sin( 2 πf x nt s ) = sin( 2 πf x nt s + 2 πm) ; where m is any positive or negative integer = sin( 2 πf x nt s + 2 πm(nt s )/(nt s )) ; multiply 2 nd term by one = sin( 2 πnt s (f x +m/(nt s )) ; we factor 2 πnt s from both terms = sin( 2 πnt s (f x +k/t s ) ; Let k = m/n ratio = sin( 2 πnt s (f x +kf s ) ; because f s = 1/t s A sinusoid cycle from 0 to 360 0 is equivalent to 2 π radians Note: f x is some frequency less than the sampling rate f s

23 Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011. Using Carrier Frequencies Goal: Choose optimal f s > 2B

24 Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011.

25 Choosing Sampling Frequencies Goal: Bring band of frequency between –f s and + f s Solution: Pick largest m such that f s >= 2*B Choosing f s that maintains the spectral direction m f s = 2 (f c – B/2) f s = (2 f c – B)/m Example: If f c =20000, B = 5 m=1,2,3,4 Then f s =35,17.5,11.25, 8.75 Choosing fs that reverses the spectral direction (m+1) f s = 2 (f c + B/2) f s = (2f c + B)/(m+1) Example: If f c =20000, B = 5 m=1,2,3 Then f s =22.5,15,7.5 Restore spectral direction x[n] = (-1) n * x[n]

26 Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011.

27 SNR Degradation


Download ppt "Sampling Terminology f 0 is the fundamental frequency (Hz) of the signal –Speech: f 0 = vocal cord vibration frequency (>=80Hz) –Speech signals contain."

Similar presentations


Ads by Google