Pulse Code Modulation (PCM ) We measure the amplitude of a signal at points in time and store them in an array. – Usually 2 bytes per sample big or little.

Slides:



Advertisements
Similar presentations
Design of Digital IIR Filter
Advertisements

| Page Angelo Farina UNIPR | All Rights Reserved | Confidential Digital sound processing Convolution Digital Filters FFT.
Physical Layer: Signals, Capacity, and Coding
Introduction to Speech Recognition
Analogue to Digital Conversion (PCM and DM)
EE513 Audio Signals and Systems Digital Signal Processing (Synthesis) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
Chapter-3-1CS331- Fakhry Khellah Term 081 Chapter 3 Data and Signals.
Windowing Purpose: process pieces of a signal and minimize impact to the frequency domain Using a window – First Create the window: Use the window formula.
Page 0 of 34 MBE Vocoder. Page 1 of 34 Outline Introduction to vocoders MBE vocoder –MBE Parameters –Parameter estimation –Analysis and synthesis algorithm.
Filtering Filtering is one of the most widely used complex signal processing operations The system implementing this operation is called a filter A filter.
So far We have introduced the Z transform
Ideal Filters One of the reasons why we design a filter is to remove disturbances Filter SIGNAL NOISE We discriminate between signal and noise in terms.
Properties of continuous Fourier Transforms
Chapter 3 Data and Signals
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F(  ) is the spectrum of the function.
Digital Image Processing Chapter 5: Image Restoration.
Image Enhancement.
William Stallings Data and Computer Communications 7th Edition (Selected slides used for lectures at Bina Nusantara University) Data, Signal.
Voice Transformations Challenges: Signal processing techniques have advanced faster than our understanding of the physics Examples: – Rate of articulation.
FILTERING GG313 Lecture 27 December 1, A FILTER is a device or function that allows certain material to pass through it while not others. In electronics.
Chapter 4 Digital Transmission
CELLULAR COMMUNICATIONS DSP Intro. Signals: quantization and sampling.
AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters.
EEE422 Signals and Systems Laboratory Filters (FIR) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
Representing Acoustic Information
Digital Signals and Systems
DSP. What is DSP? DSP: Digital Signal Processing---Using a digital process (e.g., a program running on a microprocessor) to modify a digital representation.
LE 460 L Acoustics and Experimental Phonetics L-13
Lecture 1 Signals in the Time and Frequency Domains
Announcements Assignment 5 due tomorrow (or now)
GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions.
Time-Domain Methods for Speech Processing 虞台文. Contents Introduction Time-Dependent Processing of Speech Short-Time Energy and Average Magnitude Short-Time.
1 CS 551/651: Structure of Spoken Language Lecture 8: Mathematical Descriptions of the Speech Signal John-Paul Hosom Fall 2008.
15.1 Properties of Sound  If you could see atoms, the difference between high and low pressure is not as great.  The image below is exaggerated to show.
Signal Filters Purposes Separate Signals Eliminate interference distortions Remove unwanted data Restore to its original form (after transmission) Model.
Digital Image Processing Chapter # 4 Image Enhancement in Frequency Domain Digital Image Processing Chapter # 4 Image Enhancement in Frequency Domain.
Comparing Audio Signals Phase misalignment Deeper peaks and valleys Pitch misalignment Energy misalignment Embedded noise Length of vowels Phoneme variance.
EE Audio Signals and Systems Digital Signal Processing (Synthesis) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
1 BIEN425 – Lecture 10 By the end of the lecture, you should be able to: –Describe the reason and remedy of DFT leakage –Design and implement FIR filters.
Basics of Neural Networks Neural Network Topologies.
The Physical Layer Lowest layer in Network Hierarchy. Physical transmission of data. –Various flavors Copper wire, fiber optic, etc... –Physical limits.
Authors: Sriram Ganapathy, Samuel Thomas, and Hynek Hermansky Temporal envelope compensation for robust phoneme recognition using modulation spectrum.
Prof. Brian L. Evans Dept. of Electrical and Computer Engineering The University of Texas at Austin Lecture 4 EE 345S Real-Time.
Extends Euclidean space algebra to higher dimensions
11/22/20151 Digital Filters. 11/22/20152 Time domain to Frequency Domain and vice versa Filter Characteristics.
Original signal Median of seven Moving average Non-Linear Filter Median of five or seven.
Chapter 7 Finite Impulse Response(FIR) Filter Design
Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.
2D Sampling Goal: Represent a 2D function by a finite set of points.
Lecture 3: The Sampling Process and Aliasing 1. Introduction A digital or sampled-data control system operates on discrete- time rather than continuous-time.
By Sarita Jondhale 1 Signal preprocessor: “conditions” the speech signal s(n) to new form which is more suitable for the analysis Postprocessor: operate.
Computer Graphics & Image Processing Chapter # 4 Image Enhancement in Frequency Domain 2/26/20161.
DISP 2003 Lecture 5 – Part 1 Digital Filters 1 Frequency Response Difference Equations FIR versus IIR FIR Filters Properties and Design Philippe Baudrenghien,
Professor A G Constantinides 1 Digital Filter Specifications We discuss in this course only the magnitude approximation problem There are four basic types.
Prof. Brian L. Evans Dept. of Electrical and Computer Engineering The University of Texas at Austin EE445S Real-Time Digital Signal Processing Lab Spring.
Speech Enhancement Summer 2009
Linear Filters and Edges Chapters 7 and 8
CS 591 S1 – Computational Audio
EEE422 Signals and Systems Laboratory
Adaptive Filters Common filter design methods assume that the characteristics of the signal remain constant in time. However, when the signal characteristics.
Topics discussed in this section:
4.1 Chapter 4 Digital Transmission Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Sampling rate conversion by a rational factor
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F() is the spectrum of the function.
Fourier Transform.
Ideal Filters One of the reasons why we design a filter is to remove disturbances Filter SIGNAL NOISE We discriminate between signal and noise in terms.
CSCE 643 Computer Vision: Image Sampling and Filtering
Chapter 7 Finite Impulse Response(FIR) Filter Design
8.6 Autocorrelation instrument, mathematical definition, and properties autocorrelation and Fourier transforms cosine and sine waves sum of cosines Johnson.
Chapter 7 Finite Impulse Response(FIR) Filter Design
Presentation transcript:

Pulse Code Modulation (PCM ) We measure the amplitude of a signal at points in time and store them in an array. – Usually 2 bytes per sample big or little endian Ulaw and Alaw takes advantage of human perception which is logarithmic – One byte per sample containing logarithmic values To accurately represent a frequency, f, we need 2f measurements per second to prevent aliases (Nyquest). Compression algorithms code speech differently, but we decode to PCM for analysis.

Amplitude Linear Measurement (P) – Air pressure (Watts / meter 2 ) scaled to integer values Logarithmic Measurement (decibels) – 10 log (P/TOH) – TOH = approximate threshold of hearing ( W/m 2 at 1k Hz) – Power (SPL) = 10 log (P/TOH) 2 = 20 log (P/TOH)

Decibels SounddB TOH0 Whisper10 Quiet Room20 Office50 Normal conversation 60 Busy street70 Heavy truck traffic90 Power tools110 Pain threshold120 Sonic boom140 Permanent damage 150 Jet engine160 Cannon muzzle220

Speech Frames For analysis we breakup signal into overlapping windows Why? – Speech is quasi-periodic, not periodic – Vocal musculature is always changing – Within a small window of time, we assume constancy Typical Characteristics ms length 1/3 overlap

Popular Window Types Perfect Frequency Filter (window-sync): sin( 2 π f i) / (πi) – Must be infinitely long – Can truncate, but resulting filter has lots of ripple and overshoots Rectangular: w k = 1 where k = 0 … M – Advantage: Easy to calculate, array elements unchanged – Disadvantage: Messes up the frequency domain Hamming: w k = 0.54 – 0.46 cos(2kπ/M) – Advantage: Fast roll-off in frequency domain – Disadvantage: worse attenuation Blackman: w k = 0.42 – 0.5 cos(2kπ/M) cos(4kπ/M) – Advantage: better attenuation – Disadvantage: slower roll-off Multiply the window, point by point, to the audio signal

Rectangular Window Frequency Response Time Domain Filter

Blackman & Hamming Frequency Response

Signal Filters Purposes Separate Signals Eliminate interference distortions Remove unwanted data Restore to its original form (after transmission) Model a physical system (stock market behavior) Enhance desired components (speech recognition ) Examples Breathing interference on heartbeat sound Poor quality recordings Background Noise Categories Analog: electronic circuits with resistors and capacitors Digital: Numerical calculations on signal samples

Filter Characteristics

Filter Jargon Rise time: Time for step response to go from 10% to 90% Linear phase: Rising edges match falling edges Overshoot: amount amplitude exceeds the desired value Ripple: pass band oscillations Ringing: decreasing oscillations Pass band: the allowed frequencies Stop band: the blocked frequencies Transition band: frequencies between pass or stop bands Cutoff frequency: point between pass and transition bands Roll off: transition sharpness between pass and stop bands Stop band attenuation: reduced amplitude in the stop band

Filter Performance

Time Domain Filters Finite Impulse Response – Filter only affects the data samples, hence the filter only effects a fixed number of data point – y[n] = b 0 s n + b 1 s n-1 + …+ b M-1 s n-M+1 =∑ k=0,M-1 b k s n-k Infinite Impulse Response (also called recursive) – Filter affects the data samples and previous filtered output, hence the effect can be infinite – t[n] = ∑ k=0,M-1 b k s n-k + ∑ k=0,M-1 a k t n-k If a signal was linear, so is the filtered signal – Why? We summed samples multiplied by constants, we didn’t multiply or raise samples to a power

Convolution /** Convolve an audio signal &param signal array of time domain samples &param filter filter kernel array to convolute &return modified signal */ int[] convolve(int[] signal, int[] filter) {int[] y = new int[signal.length + filter.length-1]; for (int i=0; i<y.length; i++) for (int j=0; j<filter.length; j++) if ((i-j)>=0 && (i-j)<=signal.length) y[i] += signal[i-j]*filter[j]; return y; } The algorithm used for creating Time Domain filters

The Convolution Machine (cont.)

Convolution Examples

Convolution Properties Distributive CommutativeAssociative

Convolution Calculation x = [ 0, -1, -1.2, 2, 1.4, 1.4, 0.8, 0, -0.6 ] h = [ 1, -1/2, -1/4, -1/8] Sample calculation when k=4 y[4] = x[4]*h[0] + x[3]*h[1] + x[2]*h[2] + x[1]*h[0] = 1.4 * * (-1/2) + (-1.2) * (- 1/4) + (-1) * (-1/8) = 1.4 – = 0.825

Delta Function Delta function (δ[n]) [also called Unit Impulse] –If n=0, δ[n] = 1 –If n≠0, δ[n] = 0 impulse response (h(n)) –The output generated from a delta function input –Useful to analyze filters: δ in and observe response

Analyzing a filter Impulse response: Feed a delta function and see what comes out. Reverse engineer what the filter does. (δ(t) = 1 if t = 0; 0 otherwise) Step response: Feed in a step function and see what comes out. Good for determining change points in the signal. (µ(t) = { 1 if t>=0; 0 otherwise}) Frequency response: Perform a spectral analysis. Separate a signal into its component sinusoids. Example: separate light frequencies in a signal.

Example Consider the signal x[n] = {3,2,4} x[k] = x[k] * δ[n-k] Notation: δ[n-k] represents the delta function shifted right k times Consider the signal a[n] – Sample 8 = -3, All other samples = 0 – Then a[n] = -3 * δ [n-8] Question: What happens if we apply a[n] to a signal x? – Assume the impulse response h[n] = 3 – Apply a[n]. The output y[n+8] = 3 * (-3) = -9 – Why? Output shifted by 8 and scaled by a factor of -3. All signals can be decomposed to shifted and scaled delta functions

Amplify Top Figure (original signal) Bottom Figure – The signal’s amplitude is multiplied by 1.6 – Attenuation can occur by picking a magnitude that is less than one y[n] = k δ[n]

Difference and Sum Top Figure (FIR) – Difference – y[n] = x[n]-x[n-1] Bottom Figure (IIR) – Running Sum – y[n] = x[n]+y[n-1] – Impulse response is infinitely long

Moving Average FIR Filter int[] average(int x[]) { int[] y[x.length]; for (int i=50; i<x.length-50; i++) { for (int j=-50; j<=50; j++) { y[i] += x[i + j]; } y[i] /= 101; } Convolution using a simple filter kernel Formula: Example Point: Example Point (Centered):

IIR (Recursive) Moving Average Example: y[50] = x[47]+x[48]+x[49]+x[50]+x[51]+x[52]+x[53] y[51] = x[48]+x[49]+x[50]+x[51]+x[52]+x[53]+x[54] = y[50] + (x[54] – x[47])/7 The general case y[i] = y[i-1] + (x[i+M/2] - x[i-(M+1)/2])/M Two additions per point no matter the length of the filter Note: Integers work best with this approach to avoid round off drift

Optimizations Pass the signal through the filter more than once to improve stop band attenuation Convolving the steps provides a one step filter Disadvantages – Longer filter kernel – Slower roll off – Slow execution time if the filters are long

Characteristics of Moving Average Filters Longer filters gets rid of more noise Long filters lose edge sharpness Not a good frequency separator Very fast to apply to a signal Frequency response is the sync function (sin(x)/x) –A degrading sine wave

Multiple Pass Moving Average Pass the signal through the filter more than once. The diagrams show the filter kernel and responses for a one, two and four pass moving average filter

Characteristics of Recursive Filters Advantages – Many filter types with very few parameters – Executes very fast Example 1: a 0 =.15 and b 1 =.85 Example 1: a 0 = 0.93 a 1 = b 1 = 0.86 Input Signal Example 1 output Example 2 output

Pre-emphasis Human Audio – There is an 6db/octave attenuation of the audio signal loudness as it travels along the cochlea – High frequencies have initially attenuated energy emphasizing higher frequencies compared to is closer to the way humans hear Solution – Pre-emphasis filter de-emphasizes lower frequencies – Formula: y[i] = x[i] - ( b x[i-1]); b is normally between – Smaller numbers means less emphasis Note: π represents the Nyquist frequency

Low and High Pass Recursive Filter Low Pass: a 0 = 1-x b 1 = x High Pass: a 0 = (1+x)/2, a 1 = -(1+x)/x, b 1 = x 0≤x≤1 is the rate of decay, higher x means slower decay

High Pass Spectral Inversion Filter First create a low pass filter Two step solution – Filter the signal – Subtract the low pass signal from the original One step solution – Requires: A point of symmetry output from low pass will have the same phase – Reverse the sign of every point in the filter and add one at the point of symmetry Why does it work? – δ[n] is the identity function (an all pass filter) – δ[n] + (- h[n]) removes the original signal – We combine parallel systems by adding the impulse responses

High Pass Filter Example Create low pass (sum of all points equals 1) – Otherwise we would amplify or attenuate Apply δ – low pass (allows everything else) Insert δ at zero sample of point of symmetry Sum of all points equal 0 Time Domain Low PassHigh Pass Frequency Domain

High Pass Spectral Reversal Filter Create a low pass filter Change the sign of every other sample. Why does it work? – Changing every other sample is the same as multiplying by a sine wave with the Nyquist frequency. – It shifts the frequencies where the top frequencies wrap around to the start creating a mirror image. – Example: suppose the Nyquist frequency is Frequency 0 becomes Frequency 50 becomes Frequency 6000 becomes ( )%8000.

Band Pass Filters 1.Create a low pass filter 2.Create a high pass filter 3.Convolve the filters together to get a band pass filter 4.Use spectral inversion or reversal for a band reject filter

Gaussian Filters Gaussian filters remove noise and detail g[x] = 1/(2πσ) ½ * e -z where – z = -x 2 /(2σ 2 ) – σ = standard deviation σ = 1 and mean =0 σ = 3 and mean =0

The Ideal Frequency Filter Inverse Fourier transform on a square wave: h[k] = sin(2f c π k) / kπ Convolving with this filter provides a perfect low pass filter Problems (requires infinite length, abrupt edge, excessive ripple

Performance of Truncated Window-sync

Windowed Window Sync Filter Window Sync Filter: Truncated ideal frequency filter (F[k] = sin(2f c π k) / kπ)

Custom Filters Create the desired frequency response Perform an inverse Fast Fourier Transform (FFT) – Can't use this because there usually are wild fluctuations in frequency between the points – For it to be perfect, the impulse response needs to be infinite Shift to center the result about t=0, truncate, and apply a window to the result Use that as your filter kernel Application: Remove known frequency patterns from a signal For any frequency response

Example of a Custom Filter

Temporal Features Advantages – Obtain directly from raw data, no transform needed – Minimal processing – Easy to understand Examples – Zero-crossing rate – Pitch periods (autocorrelation or difference function) – Loudness contour (energy) – Maximum and minimum distance between audio positive and negative amplitude (vowels longer) – Degree of voice in sounds (voicing quality)

Zero Crossings 1.Normalize a)There could be a DC component, meaning every measurement is offset by some value b)Average the absolute amplitudes ( 1/M ∑ 0,M-1 s k ) c)Subtract the average from each value 2.Count the number of times that the sign changes a)∑ 0,M-1 0.5|sign(s k )-sign(s k-1 )|; sign(x) = 1 if x≥0,-1 otherwise b)Note: |sign(s k )-sign(s k-1 )| equals 2 if it is a zero crossing

Signal Energy Apply window to the signal to minimize distortion of signal Calculate the short term energy (within the window) ∑ k=0,M (s k ) 2 where M is the size of the window Tradeoff – Window too small: too much variance – Window too big: encompasses both voiced and unvoiced speech Useful to determine if the window represents a voiced or unvoiced sound

Pitch Detection 1.Auto Correlation 1/M ∑ n=0,M-1 S n S n-k ;if n-k < 0 S n-k = 0 Find the k that maximizes the sum 2.Difference Function 1/M ∑ n=1,M-1 |(s n – s n-k )|; if n-k<0 s n-k = 0 Find the k that minimizes the sum 3.Considerations a.Difference approach is faster b.Both can get false positives c.Slower but more accurate approach is to use Cepstrals