ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

43
ESE 250 – S'12 Kod & 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time- Frequency

Transcript of ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

Page 1: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

1

ESE250:Digital Audio Basics

Week 4 February 2, 2012

Time-Frequency

Page 2: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

2

Course Map

Numbers correspond to course weeks

2,5 6

11

13

12

Today

Page 3: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

3

Teaser: Musical Representation

• With this compact notation Could communicate a sound to pianist Much more compact than 44KHz time-sample

amplitudes (fewer bits to represent) Represent frequencies

Page 4: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

4

Week 4: Time-Frequency

• There are other ways to represent Frequency representation particularly efficient

http://en.wikipedia.org/wiki/File:Lead_Sheet.png

t 2 .1

t 0

t 2 .1

H 0 0 .6 , 0 .6 , 0 .6

H 1 0 .7 , 0 , 0 .7 H 2 0 .4 , 0 .8 , 0 .4

In this lecture we will learn that the frequency domain entails representing time-sampled signals using a conveniently rotated coordinate system

Page 5: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

5

Prelude: Harmonic Analysis• Fourier Transform ( FT )

Fourier (& other 19th Century Mathematicians) discovered that (real) signals can always (if they are smooth enough) be expressed as the sum of harmonics

• Defn: “Harmonics” (Fourier Series) collections of periodic signals (e.g., cos, sin) whose frequencies are related by integer

multiples arranged in order of increasing frequency summed in a linear combination whose coefficients provide an alternative representation

the job of this lecture is to replace this signals-analysis perspective with a symbols-synthesisperspective

Page 6: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

6

A Sampled (Real) Signal

Sample Data: Sampled Signal:(D e b u g ) O u t [ 3 7 7 ] =

t v

4

5

1

4 1 5 2 5 5

2

5

1

4 1 5 1 0 2 5

0 1

2

5

1

4 1 5 1 0 2 5

4

5

1

4 1 5 2 5 5

Page 7: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

7

Reconstructing the Sampled Signal• Exact Reconstruction

May be possible Under the right

assumptions Given the right model

• This example A “harmonic” signal Sampled in time Can be reconstructed

o exactly o from the time-sampled

valueso given knowledge of the

harmonics:

Cos[1t]/p (5/2)

p(5/2) ¢ Sin[2t]/ p(5/2)

+=

{ Cos[0t], Sin[1t], Cos[1t], Sin[2t], Cos[2t], Sin[3t], Cos[3t] }

p(5/2) ¢

Page 8: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

8

Reconstructing the Sampled Signal• Exact Reconstruction

May be possible Under the right

assumptions Given the right model

• This example A “harmonic” signal Sampled in time Can be reconstructed

o exactly o from the time-sampled

valueso given knowledge of the

harmonics:

p (5/2) ¢ Cos[1t]/p (5/2)

p(5/2) ¢ Sin[2t]/p (5/2)

+=

{ Cos[0t], Sin[1t], Cos[1t], Sin[2t], Cos[2t], Sin[3t], Cos[3t] }

Page 9: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

9

Sequence of Analysis• Given

Fundamental frequency: f = 1/2 Sampling Rate: ns = 5 Measured Data:

• Compute “basis” functions coefficients

• Reconstruct exact function from linear combination of

o “basis elements”(known)o coefficients(computed)

{r(-4/5), r(-2/5), r(02/5) , r(2/5), r(4/5) }

h0(t) = Cos[0t] / p 5

h1s(t) = Sin[1t] / p

(5/2)

h1c(t) = Cos[1t]/ p

(5/2)

h2s(t) = Sin[2t] / p

(5/2)

h2c(t) = Cos[2t]/ p

(5/2)

0 0p(5/2)

p(5/2)

0

r(t) = Cos[t] + Sin[2t] = 0 ¢ h0(t)

+ 0 ¢ h1s(t)

+ p(5/2) ¢ h1c(t)

+ p

(5/2) ¢ h2s(t)

+ 0 ¢ h2c(t)

Page 10: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

10

Fourier AnalysisTime-Values

(D e b u g ) O u t [ 3 7 7 ] =

t v

4

514

1 5 2 5 5

2

514

1 5 1 0 2 5

0 1

2

514

1 5 1 0 2 5

4

514

1 5 2 5 5

(D e b u g ) O u t [ 3 8 4 ] =

f AC os 0 t 0

S in t 0

C os t 5

2

S in 2 t 5

2

C os 2 t 0

Frequency-Amplitudes

FT

(D e b u g ) O u t [ 3 9 0 ]=

t v 3 0 .1

1 0 .3

0 1 .

1 0 .9

3 1 .8

Sampled

Quantized

DFT (D e b u g ) O u t [ 3 9 5 ] =

f A0 01s 01c 1.62s 1.62c 0

(“closed form”)

(computation)

Page 11: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

11

Reconstruction vs Approximation• Previous Example

received function was “in the span” of the harmonics reconstruction achieves exact match at all times

• More General Case received function is “close” to the “span” reconstruction achieves exact match only at the sampled times get successively better approximation at all times

o by taking successively more sampleso and using successively higher harmonics

Page 12: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

12

Another Sampled (Real) Signal

t

v

Sample Data: Sampled Signal:

O u t [ 2 9 5 ] =

t v 6

7328

1 4 Cos 7

Sin 7

4

7114

2 Sin 7

2

7128

2 Cos 14

0 02

7128

1 2 Cos 14

4

7 114

1 2 Sin 7

6

7 328

4 Cos 7

Sin 7

Page 13: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

13

• Approximate Reconstruction is always achievable and more relevant to our problem

• Example A roughly “harmonic” signal Sampled in time Can be approximated

o “arbitrarily” closely o from the time-sampled valueso using any “good” set of harmonics

Approximating the Sampled Signal

{ Cos[0t], Sin[1t], Cos[1t] , Sin[2t], Cos[2t] , Sin[3t], Cos[3t] }

Page 14: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

14

ApproximateReconstruction

(D e b u g ) O u t [ 3 6 0 ] =

C os 0 t C os 14

2 1 3 C os 7 Sin

7

7 7

S in t 2 C os

14 C os 3

14 3 Sin

7

7 14

C os t 147 5 4 1114 1314 5 1514 1914 4 11114

14 14

S in 2 t C os

14 3 C os 3

14 2 Sin

7

7 14

C os 2 t 1914 1 2 117 3 127 3 137 2 147 157 14 14

S in 3 t 3 C os

14 2 C os 3

14 Sin

7

7 14

C os 3 t 1914 1 2 117 3 127 3 137 2 147 157 14 14

(Successively Thinner Green Dashed Curves Denote Successively Fewer Harmonic Components)

Sum up the (black) harmonics using the (green) coefficients:

Page 15: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

15

More Harmonics are Better

(D e b u g ) O u t [ 3 6 9 ] =

C os 0 t 2 C os

22 3 C sc

22 Sin

11 4 C os 3

22 Sin 3

22 5 Sin 2

11 2 C os 2

11 Sin 2

11

11 11

S in t 20 C sc

22 6 4 C sc 3

22 C sc 5

22 Sin

11 4 Sin 2

11

44 22

C os t 1

11

2

11 3 S in

22S in

11 4 C os 3

22S in 3

222

5 C os

11S in 2

11 2 C os 2

112

S in 2

11 2 C os

22S in 5

22 4

C os 5

22S in 5

222

S in 2 t 24 C sc 22

16 4 C sc 3 22

C sc 5 22

Sin 11

40 Sin 2 11

88 22

C os 2 t 32 C sc 22

8 2 5 C sc 3 22

C sc 5 22

Sin 11

24 Sin 2 11

88 22

S in 3 t 16 C sc 22

4 10 3 C sc 3 22

C sc 5 22

Sin 11

32 Sin 2 11

88 22

C os 3 t 1122 2 6 1111 1211 3 1311 4 1411 4 1611 3 1711 1811 6 1911 2 11011 22 22

S in 4 t 32 C sc 22

8 2 5 C sc 3 22

C sc 5 22

Sin 11

24 Sin 2 11

88 22

C os 4 t 8 C sc 5

22 Sin

11 C sc

22 C sc 3

22 Sin

11 2 3 C sc 2

11 C sc 5

22 Sin

11 16 Sin 2

11 80 Sin 3

22 Sin 2

11

88 22

S in 5 t 4 C sc 22

10 3 2 C sc 3 22

C sc 5 22

Sin 11

8 Sin 2 11

44 22

C os 5 t 1122 1 8 1111 6 1211 7 1311 2 1411 2 1611 7 1711 6 1811 8 1911 11011

22 22

(D e b u g ) O u t [ 3 6 3 ] =

t v 10

11 544

1 2 Sin 2 11

8

11111

4 Cos 5 22

Sin 5 22

6

11144

3 6 Sin 11

4

11122

4 Cos 3 22

Sin 3 22

2

11144

4 Cos 2 11

Sin 2 11

0 02

11144

1 4 Cos 2 11

Sin 2 11

4

11122

1 4 Cos 3 22

Sin 3 22

6

11 344

2 Sin 11

8

11 111

1 2 Cos 22

10

11 544

2 Sin 2 11

7 Samples; 7 Harmonics 11 Samples 15 Samples; 15 Harmonics; 11 Harmonics

Page 16: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

16

Usually Computed, Not “Solved”7 Samples; 7 Harmonics 11 Samples 15 Samples; 15 Harmonics; 11 Harmonics

(D e b u g ) O u t [ 3 9 8 ] =

t v 2 .9 0

2 .3 0 .3

1 .7 0 .1

1 .1 0 .4

0 .6 0 .2

0 0

0 .6 0 .1

1 .1 0 .1

1 .7 0 .3

2 .3 0 .9

2 .9 0 .7

DFT

(D e b u g ) O u t [ 3 9 7 ] =

f A0 0.41s 0.61c 0.82s 0.32c 0.23s 0.23c 0.44s 0.24c 0.15s 0.25c 0

(D e b u g ) O u t [ 4 0 0 ]=

t v 2 .9 0 .1

2 .5 0 .3

2 .1 0 .2

1 .7 0 .1

1 .3 0 .3

0 .8 0 .3

0 .4 0 .1

0 0

0 .4 0

0 .8 0 .1

1 .3 0

1 .7 0 .3

2 .1 0 .7

2 .5 0 .9

2 .9 0 .7

(D e b u g ) O u t [ 3 9 9 ] =

f A0 0.51s 0.71c 0.92s 0.42c 0.23s 0.23c 0.54s 0.24c 0.25s 0.25c 0.16s 0.26c 07s 0.17c 0

(D e b u g ) O u t [ 4 0 4 ] =

t v2.7 0.21.8 00.9 0.30 00.9 0.11.8 0.42.7 0.9

(D e b u g ) O u t [4 0 5 ]=

f A0 0.41s 0.51c 0.72s 0.32c 0.23s 0.23c 0.2

DFTDFT

the “spectrum” is often plotted as a function of frequency

Page 17: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

17

Yet Another Sampled (Real) Signal

t

v

Measured Data:

Sampled Signal:

(D e b u g ) O u t [ 4 2 0 ] =

t v 14

15 12

4 5

12

2 3

12

8 15

12

2 5

12

4 15

12

2 15

12

0 12

2

1512

4

1512

2

5 12

8

15 12

2

312

4

512

14

15 12

Page 18: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

18

• Approximate Reconstruction although always achievable may require a lot of samples to get good performance from “poorly chosen”

harmonics

• Different “bases” match different “data” better or worse

(sometimes time is better than frequency)

Some Signals Dislike Some Harmonics

15 Samples & Harmonics

21 Samples & Harmonics

31 Samples & Harmonics

Page 19: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

19

t 2 .1

t 0

t 2 .1

H 0 0 .6 , 0 .6 , 0 .6

H 1 0 .7 , 0 , 0 .7 H 2 0 .4 , 0 .8 , 0 .4

Choice of Basis• What is a “harmonic”?

we could have used periodic “pulse trains”o previous signal would be reconstructed exactlyo with one or two pulse-train harmonics

but “sound-like” signals o would typically require a very large numbero of “pulse-train” harmonics

• Fourier Theory (and generalizations) permits very broad choice of harmonics such choices amount to the selection of a model

• Today’s Lecture interprets the choice of harmonics

o as a selection of coordinate reference frame o in the space of received (sampled,quantized) data

lends (geometric) insight to high-dimensional phenomena introduces arsenal of linear algebraic computation encourages “learning” data-driven models

Page 20: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

20

Intuitive Concept Inventory

(D e b u g ) O u t [ 3 6 9 ] =

C os 0 t 2 C os

22 3 C sc

22 Sin

11 4 C os 3

22 Sin 3

22 5 Sin 2

11 2 C os 2

11 Sin 2

11

11 11

S in t 20 C sc

22 6 4 C sc 3

22 C sc 5

22 Sin

11 4 Sin 2

11

44 22

C os t 1

11

2

11 3 S in

22S in

11 4 C os 3

22S in 3

222

5 C os

11S in 2

11 2 C os 2

112

S in 2

11 2 C os

22S in 5

22 4

C os 5

22S in 5

222

S in 2 t 24 C sc 22

16 4 C sc 3 22

C sc 5 22

Sin 11

40 Sin 2 11

88 22

C os 2 t 32 C sc 22

8 2 5 C sc 3 22

C sc 5 22

Sin 11

24 Sin 2 11

88 22

S in 3 t 16 C sc 22

4 10 3 C sc 3 22

C sc 5 22

Sin 11

32 Sin 2 11

88 22

C os 3 t 1122 2 6 1111 1211 3 1311 4 1411 4 1611 3 1711 1811 6 1911 2 11011 22 22

S in 4 t 32 C sc 22

8 2 5 C sc 3 22

C sc 5 22

Sin 11

24 Sin 2 11

88 22

C os 4 t 8 C sc 5

22 Sin

11 C sc

22 C sc 3

22 Sin

11 2 3 C sc 2

11 C sc 5

22 Sin

11 16 Sin 2

11 80 Sin 3

22 Sin 2

11

88 22

S in 5 t 4 C sc 22

10 3 2 C sc 3 22

C sc 5 22

Sin 11

8 Sin 2 11

44 22

C os 5 t 1122 1 8 1111 6 1211 7 1311 2 1411 2 1611 7 1711 6 1811 8 1911 11011

22 22

(D e b u g ) O u t [3 6 3 ] =

t v 10

11 544

1 2 Sin 2 11

8

11111

4 Cos 5 22

Sin 5 22

6

11144

3 6 Sin 11

4

11122

4 Cos 3 22

Sin 3 22

2

11144

4 Cos 2 11

Sin 2 11

0 02

11144

1 4 Cos 2 11

Sin 2 11

4

11122

1 4 Cos 3 22

Sin 3 22

6

11 344

2 Sin 11

8

11 111

1 2 Cos 22

10

11 544

2 Sin 2 11

11 Samples;

Q = FT(q)

11 Harmonics

Time Domain Frequency Domain

r (received signal)

(sam

pling) q Q

Page 21: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

21

(D e b u g ) O u t [ 3 9 6 ] =

t v 3 0

2 0 .3

2 0 .1

1 0 .4

1 0 .2

0 0

1 0 .1

1 0 .1

2 0 .3

2 0 .9

3 0 .7

Intuitive Concept Inventory11 Samples;

Q = DFT(q)

11 Harmonics

Time Domain Frequency Domain

Floating P

oint Flo

atin

g P

oint

r (received signal)

Sampling &Quantization

q Qthis week’s idea

Perceptual coding

(D e b u g ) O u t [ 3 9 7 ] =

f A0 0.41s 0.61c 0.82s 0.32c 0.23s 0.23c 0.44s 0.24c 0.15s 0.25c 0

Page 22: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

22

Where Are We Heading After Today?• Week 2

Received signal iso discrete-time-stampedo quantized

q = PCM[ r ]

= quantL [SampleTs[r] ]

• Week 3 Quantized Signal is

Coded c =code[ q ]

• Week 4 Sampled signal

o not coded directly o but rather, “Float” -‘edo then linearly

transformed o into frequency domain

Q = DFT[ q ]

[Painter & Spanias. Proc.IEEE, 88(4):451–512, 2000]

q

Sample CodeStore/

Transmit Decode Producer(t) p(t)

Generic Digital Signal Processor

q c

c

Q

Psychoacoustic Audio Coder

Page 23: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

23

Interlude: Audio Communications

Close Encounters

Page 24: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

24

Technical Concept Inventory• Floating Point Quantization

a symbolic representation admitting a mimic of continuous arithmetic

• Vectors sampled signals are points in a (high dimensional) vector space

• Linear Algebra the “Swiss Army Knife” of high dimensions provides a logical, geometric, and computational toolset for manipulating vectors

• Change of Basis DFT is a high dimensional rotation in the vector space of time-sampled signals

Page 25: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

25

Technical Concept Inventory• Floating Point Quantization

a symbolic representation admitting a mimic of continuous arithmetic

• Vectors sampled signals are points in a (high dimensional) vector space

• Linear Algebra the “Swiss Army Knife” of high dimensions provides a logical, geometric, and computational toolset for manipulating vectors

• Change of Basis DFT is a high dimensional rotation in the vector space of time-sampled signals

Page 26: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

26

6 4 2 2 4 6

2

1

1

2

r(t)

q1

q2 q3

q4 q5

Float-Quantized Symbols Act “Real”• q = PCM[ r(t) ] = Float(b,p,E) [SampleTs

[r(t)] ] eliminates continuous time dependence discretizes continuous values

o cannot represent an uncountable collection of functions o with a countable (of course, in fact, finite!) set of “symbols”

• Floating Point Representation and Computer Arithmetic Choose: Base (b), Precision (p), Magnitude (E)

o q = be ¢ [d0 + d1 ¢ b-1 + … + dp-1 ¢ b-(p-1)]o - E · e · Eo 0 < di < b

Non-uniform quantizationo bp different “mantissas”o 2E different exponentso ~ Log2[2E] + Log2[bp] bits

Associated Flop Arithmeticop 2 { +, -, *, /} [ { Sqrt, Mod, Flint} ) Flop(x,y) = Float[ op(x,y) ]

Archetypal Computation: Inner producto x = (x1, .., xn), y = (y1, … , yn)o hx,yi = x1¢y1 + x2¢y2 + … + xn¢ yn

Crucially important operation for signal processing applications !

[Widrow, et al., IEEE TIM’96]

Page 27: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

27

Technical Concept Inventory• Floating Point Quantization

a symbolic representation admitting a mimic of continuous arithmetic

• Vectors sampled signals are points in a (high dimensional) vector space

• Linear Algebra the “Swiss Army Knife” of high dimensions provides a logical, geometric, and computational toolset for manipulating vectors

• Change of Basis DFT is a high dimensional rotation in the vector space of time-sampled signals

Page 28: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

28

• Sampled received signal

• Is a discrete sequence of time-stamped floats q = (q1, q2, … qns

)

= Float( r(T0+Ts), r(T0 + 2Ts), …. , r(T0 + nsTs)) of “real” (i.e. Float’ed) values

at each of the ns time-stamps

• Think of each of the time-stamps as an “axis” of “real” (float) values

6 4 2 2 4 6

2

1

1

2

Time Functions are Vectors

r(t)

q1

q2

q3

q4

q5

Page 29: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

29

Time Functions are Vectors• Think of each of the time-

stamps as an “axis” of “real” (float) values

• E.g., for three time stamps, ns = 3, we can record the values arrange each axis located

perpendicular to the other two in space mark their values and interpret them as a vector

t 6 .2 8

t 0 .6 9

t 4 .9

t 6 .2 8

t 0 .6 9

t 4 .9

Page 30: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

30

• Think of each of the time-stamps as an “axis” of “real” (float) values E.g., for two time stamps, ns = 2,

o we can draw both axes o on “graph paper”

… for a greater number of time stamps …

o we can “imagine” arranging each axis

o in a mutually perpendicular direction

o in space of appropriately high dimension

t = - 6.28

t = 2.5

q1

q2

q

b1

b2

Time Functions are Vectors

Page 31: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

31

Technical Concept Inventory• Floating Point Quantization

a symbolic representation admitting a mimic of continuous arithmetic

• Vectors sampled signals are points in a (high dimensional) vector space

• Linear Algebra the “Swiss Army Knife” of high dimensions provides a logical, geometric, and computational toolset for manipulating vectors

• Change of Basis DFT is a high dimensional rotation in the vector space of time-sampled signals

Page 32: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

32

Linear Algebra: “Swiss Army Knife”• We cannot “see” in high

dimensions• Linear Algebra enables us

in high dimensions to reason precisely think geometrically compute

• Essential Ideas Basis expansion Change of basis Ingredients

o Orthonormalityo Inner Product h ¢ , ¢ i

t = - 6.28

t = 2.5

q1

r(t)q1

q2

BT = { b1 , b2 } = { (1,0), (1,0)}

q2

q = (q1, q2) = (0.8, - 0.9) = 0.8 ¢ (1,0) – 0.9 ¢ (1,0) = 0.8 ¢ b1 + (– 0.9) ¢ b2

= hq,b1i¢ b1 + hq,b2i ¢ b2

= q1 ¢ b1 + q2 ¢ b2

q

b1b2

wherehx,yi = x1y1 + x2y2

hq,b1i = 0.8 ¢ 1 + (-0.9) ¢ 0 = 0.8hq,b2i = 0.8 ¢ 0 + (-0.9) ¢ 1 = - 0.9

(computational definition):

Page 33: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

33

Linear Algebra: “Swiss Army Knife”• Orthonormal Basis

set of unit length vectors

each “perpendicular” to all the others

total number given by dimension of the space

• Inner Product (scaled) cosine of

relative angle scales unit length

t = - 6.28

t = 2.5

q

b1

b2

q1 = hq,b1i = Length(q ) ¢ Cos [Å(q,b1)]

Å(q,b1)

Å(q,b2)

q2 = hq,b2i = Length(q ) ¢ Cos [Å(q,b2)]

Generally: hr, si = Length(r) ¢ Length(s) ¢ Cos [Å(r,s)] ) hr, ri = Length(r)2

geometric re-interpretation of computational definition: hx,yi = x1y1 + x2y2

Page 34: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

34

Technical Concept Inventory• Floating Point Quantization

a symbolic representation admitting a mimic of continuous arithmetic

• Vectors sampled signals are points in a (high dimensional) vector space

• Linear Algebra the “Swiss Army Knife” of high dimensions provides a logical, geometric, and computational toolset for manipulating vectors

• Change of Basis DFT is a high dimensional rotation in the vector space of time-sampled signals

Page 36: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

36

Why Change Basis ?• Efficiency

data sets often lie along lower dimensional

subspaces Of high dimensional data

space• Decoupling

receiver model may “prefer”

a specific basis

Page 37: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

37

Linear Algebra: Change of Basis• Goal

Re-express q In terms of BH

• Notation use new symbol, Q denoting different computational

representation even though vector is geometrically

unchanged• Check: “good” basis?

both unit length? mutually perpendicular vectors?

• Further geometric Interpretation if old basis is orthonormal then new basis is also if and only if it is

o A “rotation” o Away from the old

BH = { H1 , H2 } = { (1/p2 , 1/p2), (- 1/p2 , 1/p2)}

Q

H1H2

Length(H1)2 = h H1, H1 i

= 1/p (2 ¢ 2) + 1/

p (2 ¢ 2)

= ½ + ½ = 1Length(H2)2 = h H2, H2 i

= 1/p (2 ¢ 2) + 1/

p (2 ¢ 2)

= ½ + ½ = 1

hH1, H2i = h11 h2

1 + h12 h2

2

= - 1/p 2 ¢ 2 + 1/

p 2 ¢ 2

= 0

t = - 6.28

t = 2.5

b2

b1

Page 38: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

38

Linear Algebra: Change of Basis• Goal

Re-express q = (q1, q2)o specified by coordinate

representationo in terms of the old basis, BT

As Q= [Q1, Q2] o Specified by coordinate

representationo In terms of rotate basis, BH

• Idea: recall geometric meaning of q = (q1, q2)

o scale b1 by q1 = h b1, q i o scale b2 by q2 = h b2, q i o form the resultant vector

• Compute Q= [Q1, Q2] using same geometric idea reveals how to obtain [Q1, Q2]

o scale H1 by Q1 = hq,H1io scale H2 by Q2 = hq,H2io form the resultant vector

q = (q1, q2) = q1 ¢ b1 + q2 ¢ b2

= hq, b1i¢ b1 + hq, b2i ¢ b2

) Q1 = hq , H1i

=h (0.8, - 0.9), (1/p

2, 1/p

2)i = (0.8/1.1 - 0.9/1.1) ¼ - 0.11

Q = [Q1, Q2] = hQ,H1i¢ H1 + hQ,H2i ¢ H2

= hq,H1i¢ H1 + hq,H2i ¢ H2

) Q2 = hq , H2i

=h (0.8, - 0.9), (-1/p

2, 1/p

2)i = - (0.8/1.1 + 0.9/1.1) ¼ - 1.6

- Q2

t = - 6.28

t = 2.5

-Q1

Q

H1b2

b1H2

Page 39: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

39

1 . 0

0 . 5

0 . 0

0 . 5

1 . 0

t 2 .1 , v 0 .4

1 . 0

0 . 5

0 . 0

0 . 5

1 . 0

t 0 , v 0 .8

1 . 0 0 . 50 . 00 . 51 . 0t 2 .1 , v 0 .4

1 . 0

0 . 5

0 . 0

0 . 5

1 . 0

t 2 .1 , v 0 .7

1 . 0 0 . 5 0 . 0 0 . 5 1 . 0t 0 , v 0

1 . 0

0 . 5

0 . 0

0 . 5

1 . 0

t 2 .1 , v 0 .7

Generalize to ns = 3 Samplesh0(t) = Cos[0t]/p3

h1(t) = 2 Sin[t]/p3

h2(t) = 2 Cos[t]/p3

1 . 0

0 . 5

0 . 0

0 . 5

1 . 0

t 2 .1 , v 0 .6

1 . 0 0 . 5 0 . 0 0 . 5 1 . 0t 0 , v 0 .6

1 . 0

0 . 5

0 . 0

0 . 5

1 . 0

t 2 .1 , v 0 .6 H0 = Float[ h0(-2/3), h0(0/3), h0(2/3)]

H1 = Float[ h1(-2/3), h1(0/3), h1(2/3)]

H2 = Float[ h2(-2/3), h2(-0/3), h2(2/3)]

The 3-sample DFT:• take inner products• of sampled signal• with each harmonic

Page 40: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

40

Generalize to ns = 3 Samplesh0(t) = Cos[0t]/p3

h1(t) = 2 Sin[t]/p3

h2(t) = 2 Cos[t]/p3 t 2 .1

t 0

t 2 .1

H 0 0 .6 , 0 .6 , 0 .6

H 1 0 .7 , 0 , 0 .7 H 2 0 .4 , 0 .8 , 0 .4

Page 41: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

41

(D e b u g ) O u t [ 3 9 6 ] =

t v 3 0

2 0 .3

2 0 .1

1 0 .4

1 0 .2

0 0

1 0 .1

1 0 .1

2 0 .3

2 0 .9

3 0 .7

11 Samples;

Q = DFT(q)

11 Harmonics

Time Domain Frequency Domain

Floating P

oint Flo

atin

g P

oint

r (received signal)

Sampling &Quantization

q Qthis week’s idea

Perceptual coding

(D e b u g ) O u t [ 3 9 7 ] =

f A0 0.41s 0.61c 0.82s 0.32c 0.23s 0.23c 0.44s 0.24c 0.15s 0.25c 0

Generalize to Arbitrary Samples

Page 42: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

42

… for more understanding….• Courses ESE 325 ! (Math 240) ) Math 312 !!!

• Reading Quantization

B. Widrow, I. Kollar, and M. C. Liu. Statistical theory of quantization. IEEE Transactions on Instrumentation and Measurement, 45(2):353–361, 1996.

Floating Point D. Goldberg. What every computer scientist should know about

floating-point arithmetic. ACM Computing Surveys, 23(1), 1991.

Linear Algebra for Frequency Transformationso G. Strang. The discrete cosine transform. SIAM Review, 41(1):135–

147, 1999

Page 43: ESE 250 – S'12 Kod & DeHon 1 ESE250: Digital Audio Basics Week 4 February 2, 2012 Time-Frequency.

ESE 250 – S'12 Kod & DeHon

43

ESE250:Digital Audio Basics

End Week 4 Lecture

Time-Frequency