Digital Signal Processing 2024W1 PDF
Document Details
Uploaded by EventfulOrbit
UBC
2024
Jahurul Islam
Tags
Summary
These slides are lecture notes for a university course on digital signal processing, specifically LING 313: Introduction to Linguistic Phonetics and Speech Science, at UBC. The slides cover topics such as analog signals, digitization, sampling, quantization, and the Fourier Transform.
Full Transcript
Analog signals Digitization Sampling Quantization Fourier transform Sine function Digital signal processing Jahurul Islam...
Analog signals Digitization Sampling Quantization Fourier transform Sine function Digital signal processing Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Term: 2024W1 1/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Overview Analog signals Digitization Sampling Quantization Fourier transform Sine function 2/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog signals 3/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog signals 4/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog signals A temperature graph: 5/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog signals Challenges: ▶ analog signals are continuous ▶ a value is possible for every possible time point ▶ in fact, it can offer you values precise to infinite decimal points ▶ this makes it difficult to store, access, and analyze the data ▶ analyzing analog data can be painfully slow ▶ to take the advantage of modern computing systems, we must digitize them 6/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog signals 7/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Poll question Which one does not involve analog signals? A. light B. your position (when moving between places) C. photo captured on your phone D. pressure 8/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Digitization 9/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog-to-Digital conversion ▶ The process of transforming analog data into the digital format is called analog-to-digital conversion ▶ The process involves "sampling"; it keeps some values and dumps the rest 10/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog-to-Digital conversion 11/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog-to-Digital conversion ▶ In the context of sounds, let’s talk about digitizing one sine wave 12/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Analog-to-Digital conversion ▶ After sampling, we now have a table of values ▶ These "discrete" values are stored on the computer 13/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sampling 14/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sampling rate/frequency ▶ We decide which values are kept and which are dumped (forever) ▶ Sampling rate sets this rule: it determines how many values (samples) are kept per second interval ▶ If we pick 100 samples from a one-second long interval, our sampling rate is 100 Hz 15/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Nyquist’s theorem ▶ "The Nyquist theorem specifies that a sinuisoidal function in time or distance can be regenerated with no loss of information as long as it is sampled at a frequency greater than or equal to twice per cycle."1 ▶ thus, the sampling rate must be the double than the frequency we want to capture ▶ i.e., two samples within one "period" of the wave ▶ if we want to record up to 4000 Hz waves, we must take 8000 or more samples per second ▶ here, the highest frequency being recorded is called the Nyquist Frequency or Nyquist limit 1 https://www.sciencedirect.com/topics/engineering/nyquist-theorem 16/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Think-pair-share ▶ Elephants are known to use frequencies as a low as 40 Hz for long-distance communication ▶ what sampling rate would you use to record these sounds ▶ what’d be your Nyquist frequency? ▶ Bats are known to use frequencies as a high as 150 kHz for echolocation ▶ say you want to eavesdrop on bats activity ▶ what sampling rate would you use to record these sounds ▶ what’d be your Nyquist frequency? 17/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Poll question Human speech are mostly distributed in frequencies under 10kHz. What sampling rate would you pick to capture frequencies up to this frequency? A. 5,000 Hz B. 10,000 Hz C. 15,000 Hz D. 20,000 Hz 18/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Poll question To sample this wave, what’s the minimum number of samples would you take? A. 5 B. 10 C. 20 19/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Think ▶ What if we sampled at a rate lower than the Nyquist frequency? ▶ What can go wrong? 20/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Aliasing 21/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Anti-aliasing filter ▶ When you record, you need to run an anti-aliasing filter ▶ In modern days, this is not a thing to worry b/c most digital recorders does this automatically for us 22/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Downsampling/Resampling ▶ Needs to run an anti-aliasing filter first ▶ Then we can run the low-pass filter ▶ While, again, Praat does this automatically for us, we need to remain aware of that ▶ https://www.fon.hum.uva.nl/praat/manual/Sound__Resample___.html 23/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Quantization 24/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Quantization/Sample size/Bit depth ▶ Another issue of digitization is Quantization ▶ How accurate should our Y-axis be? ▶ remember that analog signals have infinite values? ▶ again, we cannot allow infinite numbers 25/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Quantization/Sample size/Bit depth ▶ Say you have the following values from the analog signal ▶ 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0 ▶ And, say you can only use three levels 0, 2, 4 in your digital signal ▶ 0, 0, 2, 2, 4, 4, 4, 2, 2, 0, 0 ▶ 0, 2, 2, 4, 4, 4, 4, 4, 2, 2, 0 ▶ If you had six levels (0, 1, 2, 3, 4, 5), it would be more accurate representation of the analog signal being sampled 26/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Quantization/Sample size/Bit depth ▶ 27/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Quantization/Sample size/Bit depth ▶ So, what number should we pick here? ▶ the higher the sample size, the more faithful the signal is to the analog signal ▶ but, with higher accuracy demands more processing power ▶ 16-bit sample size is typically enough for acoustic analyses 28/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Quantization/Sample size/Bit depth ▶ No matter how many levels we use, there’ll always be some quantization noise. 29/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Fourier transform 30/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Fourier transform (FT) ▶ Named after Jean Baptiste Joseph Fourier, a French mathematician ▶ It is a mathematical analysis of a complex wave into its component frequencies (proposed around 1822). ▶ Modern computers perform Fast Fourier Transform (FFT) (it uses some shortcuts in its algorithm to make the process faster ) 31/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function 100 + 500 Hz 100 Hz 200 Hz 500 Hz 32/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sine function 33/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sine waves ▶ To understand sine waves, we’ll ride a ferris wheel. 34/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sine waves ▶ Now, let’s get a little serious! It’s all about right-angled triangles! ▶ As you move on the wheel, we can draw right-angled triangles for your position. 35/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sine waves ▶ We can then extract the length of the hypotenuse and the "opposite" side ▶ The sin of an angle is the ratio between the opposite and the hypotenuse 36/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sine waves ▶ As the angle changes, the ratio (the sine value) also changes 37/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sine waves ▶ Now, how does it relate to simple sine waves? ▶ "When the sine of an angle is plotted against that angle measure, the result is a classic "sine curve" shape." ▶ Let’s see a demo ▶ https://www.mathopenref.com/triggraphsine.html 38/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Sine waves ▶ Notice that the output of the sine function is always between −1 and +1. ▶ this would mean that our amplitude is always 1 ▶ In fact, different amplitude result from the size of the radius of the circle (hypotenuse of the triangle) ▶ the actual amplitude is the product of the sine value and the length of the radius 39/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing Analog signals Digitization Sampling Quantization Fourier transform Sine function Thank you 40/40 Jahurul Islam LING 313: Introduction to Linguistic Phonetics and Speech Science Digital signal processing