Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio...

17
Today C/C++: .h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1 SE3910 Week 6, Class 1

Transcript of Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio...

Page 1: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Today C/C++: .h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates

SE-2811Slide design: Dr. Mark L. Hornick

Content: Dr. HornickErrors: Dr. Yoder

1

SE3910Week 6, Class 1

Page 2: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Ex: C/C++ (Review)

Why do we have both .h and .cpp file extensions for C++? Why not just have .cpp (like .java for Java classes)?

Answer these questions:

1. What should you put into a class’s .h file?

2. What should you put into a class’s .cpp file?

[Note: On next lab, use .hpp and .cpp instead of .h and .cpp]

SE-2811Dr.Yoder 2

Page 3: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Compiling and Linking

Compiling Converting individual .c or .cpp file to object code

Linking Combining multiple object (.o) files into an

excecutable (usually without extension, or .exe on Windows)

SE-2811Dr.Yoder 3

Page 4: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Ex: C/C++

Circle the link-time errors. Box the compile-time syntax error warning: implicit declaration of function `...' point.m:40: error: ‘mypoint’ undeclared (first use in

this function) parse error before `...‘ collect2: ld returned 1 exit status undefined reference to `filterText' /usr/lib/crt1.o(.text+0x18): undefined reference to

`main 'SE-2811Dr.Yoder 4

Page 5: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Network Latency with resmon.exe

SE-2811Dr.Yoder 5

Page 6: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Signals as sums of sine-waves

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling

6http://mathworld.wolfram.com/FourierSeriesSquareWave.html

http://ccn.ucla.edu/BMCweb/SharedCode/slides/SlideFiles.html

Page 7: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling7

Page 8: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Sampling Theorem (again Nyquist)

fs = 2B (B is bandwidth of signal)

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling8

Page 9: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Ex: If this is 1 second,what is the output if we sample 3 times per second?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling9

0 60 120 180 240 300 360 420 480 540 600 660 720 780 840 900 960 1020 1080

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Page 10: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Units: dB

What is a decibel?

A tenth of a bel

What is a bel?

The log10 of some ratio.

X dB = 10 log10 (Y)

Ex: How to compute Y from X?

X – in units of dB

Y – simple ratio (unitless) e.g. signal power / noise power 10

Page 11: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

In-class Activity: Analog to digital bandwidth

Suppose you would like to send video in a (relatively) low-frequency with a narrow bandwidth of 1 Mhz

The connection is fairly noisy and you can only get 20dB SNR

What bit-rate can you achieve?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling

11

Page 12: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Ex:

What are two ways we can avoid the stroboscopic effect in a video game simulation of a rotating wheel?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling12

Page 13: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Muddiest Point

Wait for the slides, or follow this link to answer both questions at once: http://bit.ly/1Mow5a3

SE-2811Dr.Yoder 13

Page 14: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

Muddiest Point

Wait for the slides, or follow this link to answer both questions at once: http://bit.ly/1Mow5a3

SE-2811Dr.Yoder 14

Page 15: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

SE-2811Dr. Josiah Yoder 15

http://bit.ly/1Mow5a3

Page 16: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

SE-2811Dr. Josiah Yoder 16

http://bit.ly/1Mow5a3

Page 17: Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates SE-2811 Slide design: Dr. Mark L. Hornick.

References

EB: Derek Malloy, Exploring Beaglebone, Wiley, 2015

http://www.linuxtopia.org/online_books/an_introduction_to_gcc/gccintro_95.html

http://www.network-theory.co.uk/docs/gccintro/gccintro_95.html

http://stackoverflow.com/questions/5645387/gcc-compile-errors-in-an-basic-example-objc-program

http://www.linuxtopia.org/online_books/an_introduction_to_gcc/gccintro_94.html

SE-2811Slide design: Dr. Mark L. Hornick

Content: Dr. HornickErrors: Dr. Yoder

17