Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 591 S1 – Computational Audio – Spring 2017

Similar presentations


Presentation on theme: "CS 591 S1 – Computational Audio – Spring 2017"— Presentation transcript:

1 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

2 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

3 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 π 3π/2 3

4 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 π 3π/2 4

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 / 882 = 50 times during its cycle Signal ( 882, 1.0, ): Now explain: 5

6 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 / 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

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): 0 samples Period = 50 samples 7

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): 5 samples Period = 50 samples 8

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): samples Period = 50 samples 9

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): samples Period = 50 samples 10

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): samples Period = 50 samples 11

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): samples Period = 50 samples 12

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): samples 13

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): samples Period = 50 samples 14

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): samples Period = 50 samples 15

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, 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): samples Period = 50 samples 16

17 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): samples Period = 50 samples 17

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 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

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, ) ] 15 10 5 20 φ = π 25 A = 1.0 30 45 35 40 Time (in samples): 0 samples Period = 50 samples 19

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, ) ] 15 10 5 20 φ = π 25 30 45 35 40 Time (in samples): 5 samples Period = 50 samples 20

21 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, ) ] 15 10 5 20 φ = π 25 30 45 35 40 Time (in samples): samples Period = 50 samples 21

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): 0 samples Period = 50 samples 22

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): 5 samples Period = 50 samples 23

24 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): samples Period = 50 samples 24

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): 0 samples Period = 50 samples 25

26 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

27 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…

28 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

29 Sine Waves in Detail: Real Phasors and Sampling
Aliases due to frequencies above the Nyquist Limit: If the frequency is = then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates /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

30 Sine Waves in Detail: Real Phasors and Sampling
Aliases due to frequencies above the Nyquist Limit: If the frequency is = then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates /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

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

32 Sine Waves in Detail: Real Phasors and Sampling
Aliases due to frequencies above the Nyquist Limit: If the frequency is = then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates /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

33 Sine Waves in Detail: Real Phasors and Sampling
Aliases due to frequencies above the Nyquist Limit: If the frequency is = then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates /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

34 Sine Waves in Detail: Real Phasors and Sampling
Aliases due to frequencies above the Nyquist Limit: If the frequency is = then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates /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

35 Sine Waves in Detail: Real Phasors and Sampling
Aliases due to frequencies above the Nyquist Limit: If the frequency is = then we have an identical signal, since between each two samples, instead of rotating 1/50 of the circle, it rotates /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

36 ( ) 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 ,000 – 44,100 = -14, 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

37 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.

38 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


Download ppt "CS 591 S1 – Computational Audio – Spring 2017"

Similar presentations


Ads by Google