CS 591 S1 – Computational Audio – Spring 2017

Slides:



Advertisements
Similar presentations
Sine Waves & Phase.
Advertisements

Techniques in Signal and Data Processing CSC 508 Frequency Domain Analysis.
GG 313 Lecture 25 Transform Pairs and Convolution 11/22/05.
Fourier Transform – Chapter 13. Image space Cameras (regardless of wave lengths) create images in the spatial domain Pixels represent features (intensity,
CMP206 – Introduction to Data Communication & Networks Lecture 2 – Signals.
Chapter 2: Part 1 Phasors and Complex Numbers
TRANSMISSION FUNDAMENTALS Review
SIMS-201 Characteristics of Audio Signals Sampling of Audio Signals Introduction to Audio Information.
IT-101 Section 001 Lecture #8 Introduction to Information Technology.
Signals, Fourier Series
بسم الله الرحمن الرحيم Lecture (3) Frequency Domain Concepts Dr. Iman Abuel Maaly Lecture (3) Frequency Domain Concepts Dr. Iman Abuel Maaly University.
Transmitting Signals First Meeting. Signal Processing: Sinewaves Sinewave is a fundamental tool in many areas of science, engineering and mathematics.
Frequency Domain Representation of Sinusoids: Continuous Time Consider a sinusoid in continuous time: Frequency Domain Representation: magnitude phase.
EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
ELEC ENG 4035 Communications IV1 School of Electrical & Electronic Engineering 1 Section 2: Frequency Domain Analysis Contents 2.1 Fourier Series 2.2 Fourier.
1 Methods in Image Analysis – Lecture 3 Fourier U. Pitt Bioengineering 2630 CMU Robotics Institute Spring Term, 2006 George Stetten, M.D., Ph.D.
Computer Science 121 Scientific Computing Winter 2014 Chapter 13 Sounds and Signals.
Ni.com Data Analysis: Time and Frequency Domain. ni.com Typical Data Acquisition System.
Sine Waves. Notation s 0 … s n … s N or s(0), … s(n), … s(N) Sketch the following digital signals: δ (n) = 1, n = 0 = 0, otherwise u (n) = 1, n >= 0 =
Lab #8 Follow-Up: Sounds and Signals* * Figures from Kaplan, D. (2003) Introduction to Scientific Computation and Programming CLI Engineering.
GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions.
Motivation Music as a combination of sounds at different frequencies
Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.
COSC 1P02 Introduction to Computer Science 4.1 Cosc 1P02 Week 4 Lecture slides “Programs are meant to be read by humans and only incidentally for computers.
1 Fourier Representations of Signals & Linear Time-Invariant Systems Chapter 3.
Chapter 15 AC Fundamentals.
Fourier series: Eigenfunction Approach
1 Methods in Image Analysis – Lecture 3 Fourier CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2004 George Stetten, M.D., Ph.D.
Chapter 2 Trigonometric Functions of Real Numbers Section 2.3 Trigonometric Graphs.
 Wave energy depends on amplitude, the more amplitude it has, the more energy it has.
Fourier Analysis Patrice Koehl Department of Biological Sciences National University of Singapore
5.1 The Unit Circle.
Trigonometric Identities
CS 591 S1 – Computational Audio -- Spring, 2017
CS 591 S1 – Computational Audio -- Spring, 2017
Sinusoids.
Data analysis and modeling: the tools of the trade
Sinusoidal Excitation of Circuits
CS 591 S1 – Computational Audio
CS 591 S1 – Computational Audio
COMPUTER NETWORKS and INTERNETS
COMPLEX NUMBERS and PHASORS
CS 591 S1 – Computational Audio -- Spring, 2017
Addition and Subtraction Formulas
MECH 373 Instrumentation and Measurements
ALTERNATING CURRENT AND VOLTAGE
SAMPLING & ALIASING.
CS 591 S1 – Computational Audio -- Spring, 2017
Lecture Signals with limited frequency range
CHAPTER 3 DATA AND SIGNAL
Sinusoidal Waveform Phasor Method.
Trigonometric Identities
Warm Up Evaluate Find the measure of the reference angle for each given angle that would be on the unit circle ° 5.
Signals and Systems Networks and Communication Department Chapter (1)
Electric Circuits Fundamentals
5.1 The Unit Circle.
DCSP-3: Fourier Transform (continuous time)
Standing waves.
CSCE 643 Computer Vision: Thinking in Frequency
THE UNIT CIRCLE SECTION 4.2.
Simple Harmonic Motion
Wavetable Synthesis.
Preliminaries 0.1 THE REAL NUMBERS AND THE CARTESIAN PLANE 0.2
Chapter 4: Rational, Power, and Root Functions
Chapter 4: Rational, Power, and Root Functions
THE UNIT CIRCLE.
C H A P T E R 11 A.C. Fundamentals.
Sampling and Aliasing.
DIGITAL CONTROL SYSTEM WEEK 3 NUMERICAL APPROXIMATION
Year 7 Unit 1 Knowledge Organiser PLACE VALUE, DECIMALS & USING SCALES
Presentation transcript:

CS 591 S1 – Computational Audio – Spring 2017 Wayne Snyder Computer Science Department Boston University Today Real Phasors as a way of understanding sine waves and sampling Aliases due to negative frequencies, negative amplitudes, and phase. Aliases due to frequencies above the Nyquist Limit Next Time Additive/Fourier Synthesis; time domain vs frequency Basics of musical signals: Fundamental frequency, harmonic series, partials, timbre. Exploring resonance properties in musical instruments. 1

Sine Waves in Detail: The Unit Circle The trigonometric functions can be defined using the notion of the unit circle, and if we scale the figure by the radius R, we can scale the sin or cos function to an arbitrary radius R: 2

Sine Waves in Detail: Real Phasors Thus, the unit circle traces a sine wave as a point moves around it, with the locations around the circle showing the phase, and the radius being the amplitude. One rotation around the circle = one complete cycle: π/2 2π π 3π/2 3

Sine Waves in Detail: Real Phasors A real phasor is a vector moving around a scaled unit circle, whose y dimension traces a sin wave: In this representation: Amplitude = radius of the circle Period = time for 1 rotation Frequency = speed of rotation = number of rotations per second Phase = location around circle in radians Starting phase = where the vector starts to rotate π/2 π 2π 3π/2 4

Sine Waves in Detail: Real Phasors and Sampling Phasors elegantly explain all the different ways that sine waves can be created, and how various aliases arise. A simple sine wave can be completely characterized by three parameters: ( Frequency in Hz, Amplitude, (starting) Phase ) Let us consider a wave which has frequency 882 Hz, amplitude 1.0, and phase 0.0, and which is sampled at 44.1 kHz. Note: This wave will be sampled 44100 / 882 = 50 times during its cycle Signal ( 882, 1.0, 0.0 ): Now explain: 5

Sine Waves in Detail: Real Phasors and Sampling Phasors elegantly explain all the different ways that sine waves can be created, and how various aliases arise. A simple sine wave can be completely characterized by three parameters: ( Frequency in Hz, Amplitude, (starting) Phase ) Let us consider a wave which has frequency 882 Hz, amplitude 1.0, and phase 0.0, and which is sampled at 44.1 kHz. Note: This wave will be sampled 44100 / 882 = 50 times during its cycle Questions: What happens if the amplitude is negative? What happens if the phase is not 0.0? What happens if the frequency is negative? How do aliases arise with frequencies outside the Nyquist Limit? Now explain: 6

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 7

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 5 samples Period = 50 samples 8

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 10 samples Period = 50 samples 9

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 15 samples Period = 50 samples 10

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 20 samples Period = 50 samples 11

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 25 samples Period = 50 samples 12

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 30 samples 13

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 35 samples Period = 50 samples 14

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 40 samples Period = 50 samples 15

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 25 30 45 35 40 Time (in samples): 45 samples Period = 50 samples 16

Sine Waves in Detail: Real Phasors and Sampling The signal [ (882, 1.0, 0.0) ] can be represented by a phasor which rotates 882 times a second, of length A, and starting at phase 0.0, so that each rotation occurs in a time span of 50 samples. Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 ϕ = 0 25 A = 1.0 30 45 35 40 Time (in samples): 50 samples Period = 50 samples 17

Sine Waves in Detail: Real Phasors and Sampling Aliases due to negative amplitudes and phase shifts: If the amplitude is -1.0 OR the phase is π, then we have flipped the vector across the origin and hence the wave flips top to bottom: Signal Window for [ ( 882, -1.0, 0 ) ] 15 10 5 20 ϕ = 0 25 A = -1.0 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 18

Sine Waves in Detail: Real Phasors and Sampling Aliases due to negative amplitudes and phase shifts: If the amplitude is -1.0 or the phase is π, then we have flipped the wave top to bottom: Signal Window for [ ( 882, 1.0, 3.1415 ) ] 15 10 5 20 φ = π 25 A = 1.0 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 19

Sine Waves in Detail: Real Phasors and Sampling Aliases due to negative amplitudes and phase shifts: If the amplitude is -1.0 or the phase is π, then we have flipped the wave top to bottom: Signal Window for [ ( 882, 1.0, 3.1415 ) ] 15 10 5 20 φ = π 25 30 45 35 40 Time (in samples): 5 samples Period = 50 samples 20

Sine Waves in Detail: Real Phasors and Sampling Aliases due to negative amplitudes and phase shifts: If the amplitude is -1.0 or the phase is π, then we have flipped the wave top to bottom: Signal Window for [ ( 882, 1.0, 3.1415 ) ] 15 10 5 20 φ = π 25 30 45 35 40 Time (in samples): 10 samples Period = 50 samples 21

Sine Waves in Detail: Real Phasors and Sampling Aliases due to negative frequencies: If the frequency is -882 then again we have flipped the wave top to bottom, because now the phasor moves clockwise instead of counter-clockwise: Signal Window for [ ( -882, 1.0, 0 ) ] 35 40 45 30 25 20 5 15 10 Time (in samples): 0 samples Period = 50 samples 22

Sine Waves in Detail: Real Phasors and Sampling Aliases due to negative frequencies: If the frequency is -882 then again we have flipped the wave top to bottom, because now the phasor moves clockwise instead of counter-clockwise: Signal Window for [ ( -882, 1.0, 0 ) ] 35 40 45 30 25 20 5 15 10 Time (in samples): 5 samples Period = 50 samples 23

Sine Waves in Detail: Real Phasors and Sampling Aliases due to negative frequencies: If the frequency is -882 then again we have flipped the wave top to bottom, because now the phasor moves clockwise instead of counter-clockwise: Signal Window for [ ( -882, 1.0, 0 ) ] 35 40 45 30 25 20 5 15 10 Time (in samples): 10 samples Period = 50 samples 24

Sine Waves in Detail: Real Phasors and Sampling SO if we have a sine wave [ ( 882, 1.0, 0 ) ], we could create the same signal by using both a negative frequency and a negative amplitude: [ ( -882, -1.0, 0 ) ]: we have flipped the wave top to bottom, and then flipped it back! Signal Window for [ ( -882, -1.0, 0 ) ] 35 40 45 30 25 20 5 15 10 Time (in samples): 0 samples Period = 50 samples 25

Sine Waves in Detail: Real Phasors and Sampling SO if we have a sine wave [ ( 882, 1.0, 0 ) ], we could create the same signal by using both a negative frequency and a negative amplitude: [ ( -882, -1.0, 0 ) ]: we have flipped the wave top to bottom, and then flipped it back! Signal Window for [ ( -882, -1.0, 0 ) ] 35 40 45 30 25 20 5 15 10 Time (in samples): 5 samples Period = 50 samples 26

Sine Waves in Detail: Real Phasors and Sampling Punchline: Any of these will flip the signal around the x axis: Multiplying the frequency by -1 Multiplying the amplitude by -1 Changing the phase by adding or subtracting k*π for an odd integer k. Doing any of these an odd number of times will flip the signal, doing them an even number of times will leave the signal unchanged. Changing the phase by adding or subtracting k*π for an even integer k has NO EFFECT. Mega Punchline: Your ear hears only frequency and amplitude, not phase, and so it can not distinguish a negative frequency from a positive one, or a negative amplitude from a positive one, since these are equivalent to phase shifts! This also explains the idea of aliases causes by frequencies above or below the Nyquist Limit…

Sine Waves in Detail: Real Phasors and Sampling These ways of coming up with alternate ways of expressing the same thing (= aliases) are based on the properties of the sin function: sin is an odd function: - sin( x ) = sin( - x ) so flipping around the x axis = flipping around the y axis - sin( 2 * π * f * t ) = // flipping around x axis sin( - 2 * π * f * t ) = // flipping around y axis sin( 2 * π * f * - t ) = // time running backward sin( 2 * π * - f * t ) = // negative frequency sin( 2 * π * f * t + π ) // advancing phase by π sin( 2 * π * f * t ) = sin( 2 * π * f * t + 2*π ) sin(x) = sin(x + 2π) sin(-x) 28

Sine Waves in Detail: Real Phasors and Sampling Aliases due to frequencies above the Nyquist Limit: If the frequency is 44980 = 882 + 44100 then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates 882 + 1/50 times: Signal Window for [ ( 44980, 1.0, 0 ) ] 15 10 5 20 1 25 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 29

Sine Waves in Detail: Real Phasors and Sampling Aliases due to frequencies above the Nyquist Limit: If the frequency is 44980 = 882 + 44100 then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates 882 + 1/50 times: Signal Window for [ ( 44980, 1.0, 0 ) ] 15 10 5 20 1 25 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 30

Sine Waves in Detail: Real Phasors and Sampling Aliases due to frequencies above the Nyquist Limit: If the frequency is 44980 = 882 + 44100 then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates 882 + 1/50 times: Signal Window for [ ( 444980, 1.0, 0 ) ] 15 10 5 20 1 25 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 31

Sine Waves in Detail: Real Phasors and Sampling Aliases due to frequencies above the Nyquist Limit: If the frequency is 44980 = 882 + 44100 then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates 882 + 1/50 times: Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 1 25 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 32

Sine Waves in Detail: Real Phasors and Sampling Aliases due to frequencies above the Nyquist Limit: If the frequency is 44980 = 882 + 44100 then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates 882 + 1/50 times: Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 1 25 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 33

Sine Waves in Detail: Real Phasors and Sampling Aliases due to frequencies above the Nyquist Limit: If the frequency is 44982 = 882 + 44100 then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates 882 + 1/50 times: Signal Window for [ ( 882, 1.0, 0 ) ] 15 10 5 20 1 25 30 45 35 40 Time (in samples): 1 samples Period = 50 samples 34

Sine Waves in Detail: Real Phasors and Sampling Aliases due to frequencies above the Nyquist Limit: If the frequency is 44980 = 882 + 44100 then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates 882 + 1/50 times: Signal Window for [ ( 44980, 1.0, 0 ) ] 15 10 5 20 25 5.1 rotations instead of 0.1 rotations 30 45 35 40 Time (in samples): 5 samples Period = 50 samples 35

( ) Sine Waves in Detail: Real Phasors and Sampling Summary of frequency aliases: A signal of frequency f sampled at a sample rate S (e.g., S = 44,100) will have exactly the same samples as a signal of frequency f ± S Your ear will always find the simplest (= lowest frequency) sine wave fitting the samples, so by the Nyquist Theorem, any frequency larger than S/2 will be interpreted as a signal less than S/2, by subtracting k*S to bring it inside the baseband ( -S/2 .. S/2 ). Any negative frequency will be indistinguishable to the ear from a positive frequency, since it is equivalent to a phase shift by π. Example: 30,000 Hz 30,000 – 44,100 = -14,100 heard as 14,100 Hz. Subtract sample rate to bring inside baseband of “simplest” sine wave fitting samples. -14.1 14.1 30 Heard as ( ) -44.1 -22.05 22.02 44.1 (All frequencies in kHz) Baseband

Sine Waves in Detail: Real Phasors and Sampling Summary of Sine Wave Aliases: Any sine wave ( f, A, ϕ ) sampled at rate SR has an alias (a sine wave fitting the same samples) at: ( f’ ± SR, A’, ϕ’ ) where any even number (0 or 2) of these conditions are true (otherwise f’ = f, etc.): (1) f’ = -f (2) A’ = -A (3) ϕ’ = ϕ ± kπ for odd integer k Note also that (A) Conditions (1) and (2) above are not detectable by the human ear, and (B) ϕ = ϕ ± kπ for even k.

Sine Waves in Detail: Real Phasors and Sampling Punchline for Human Ears: A sine wave of frequency SR ≥ f ≥ SR/2 and amplitude A > 0 will be heard as a sine wave of frequency (-f + SR) = (SR – f) and amplitude A, which means that an increasing series of frequency components (e.g., a harmonic spectrum) will “reflect off” the Nyquist Frequency “wall” and descend back towards 0: The solution to this problem when digitizing an analog signal is to remove the frequencies above the Nyquist Limit using a “filter,” which we will discuss shortly. This causes horrible artifacts in audio files: Sound example in Wikipedia article on Aliasing 38