- Appendix a Page 524
- maple 8
- MITRES18 05S10 Big Picture Derivatives
- Hong Qian- Terminal Twist Induced Continuous Writhe of a Circular Rod with Intrinsic Curvature
- 14-1 Graphs
- speca
- 2013 Roseville College Year 11 General Mathematics Half Yearly 2013.docx
- Precalc Survival Sheet
- Math Revision.pptx
- GHS AP Stat Talk
- Jee 2014 Booklet3 Hwt Functions
- QAT110701_Sol.doc
- Identities and Inequalities in Geometry - Version 1.0
- 9709_w08_qp_2
- Flash Cards | Calculus | www.ilearnmath.net
- Height and Distance
- Plot Function
- Palmer c , Leigh c - Plane and Spherical Trigonometry
- Time Table for II Sem_ M(1)
- Chapter 5 Trigonometry
- DESIGN AND IMPLEMENTATION OF A LOW COMPLEXITY NCO BASED CFO.pdf
- maths t paper2
- Wh Alley l Report
- dsp_QB
- A Textbook of Practical Astronomy, Nassau
- Change of Axis
- Partial Lecture Notes
- Bat dang thuc luong giac
- DSP Orfanidis Errata
- HMS211Msb
- Lista_de_Exercicios_2.pdf
- Codificacao pjsua
- Biological Science
- ARP Tables Lookup Algorithms
- Avaliacao Sup
- solution manual - microelectronics; circuit analysis & design ch1
- livro_canon.pdf
- Chapter 1 Getting Started
- BC1501 - POO
- Discussao Em Grupo 1
- Chapter 3 Echo and Reverberation
- Chapter 2 Improved Audio Template
- Chapter 2 Improved Audio Template
- calc_complex.pdf

“Sine Waves”

Texas Instruments University Programme Teaching Materials

© 2010 Texas Instruments Inc

0-1

Sine Waves

© 2010 Texas Instruments Inc

Chapter 4 - Slide 2

Introduction

• DSP can be used to generate sine waves • Sine waves can be used in audio to:

– Generate musical tones and complex waveforms – Generate tones for touch phones (DTMF) – Modulate audio signals (alien voices) – Control audio effects (chorus/phasing/flanging).

© 2010 Texas Instruments Inc

Chapter 4 - Slide 3

Objectives

• To generate sine waves from 10Hz to 16000Hz. • To introduce the Texas Instruments library of DSP functions DSPLIB.

© 2010 Texas Instruments Inc

Chapter 4 - Slide 4

org are given in the References Section.cnx. © 2010 Texas Instruments Inc Chapter 4 .Knowledge Required • Some understanding of fixed-point and floating-point numbers is required.Slide 5 . • Details of two useful articles from www.

Sine Wave and FFT • A sine wave is a pure tone.Slide 6 . It only contains one frequency: © 2010 Texas Instruments Inc Chapter 4 .

Complex Waveform and FFT • A complex waveform has several frequency components: © 2010 Texas Instruments Inc Chapter 4 .Slide 7 .

© 2010 Texas Instruments Inc Chapter 4 .Slide 8 .Generating Sine Waves • There are 3 main ways to generate sine waves: – – – Look-up Table Recursive Equation Taylor Expansion.

© 2010 Texas Instruments Inc Chapter 4 . sinetable[3]. • Put known values into a table: • Values are read using an offset e.Slide 9 .g.Look-up Table • This is the simplest way to generate a sine wave.

© 2010 Texas Instruments Inc Chapter 4 .About Look-up Tables • Advantages: – Fast to implement – Values are always accurate • Disadvantages: – Can only be used for exact divisions of sampling frequency.Slide 10 .

z 1 z 2 • The next sine output is derived from the previous values • We shall look at this in more detail in Chapter 7.Recursive Equation • Uses the following mathematical equation: y ( n) sin T . © 2010 Texas Instruments Inc Chapter 4 .Slide 11 . Infinite Impulse Response (IIR) filters.z 1 H ( z) x(n) 1 2 cosT .

• This method is used by the Texas Instruments DSP Library DSPLIB.Taylor Series • A sine function can be implemented as a geometric series: x x x sin( x) x 3! 5! 7! where 3 5 7 x is the input in radians.Slide 12 . © 2010 Texas Instruments Inc Chapter 4 .

Slide 13 .About Taylor Series • Advantages: – Can generate any frequency • Disadvantages: – Not as accurate as look-up table because there are rounding errors – Care needs to be taken to avoid overflow during multiplications. © 2010 Texas Instruments Inc Chapter 4 .

Slide 14 .C Code Implementation © 2010 Texas Instruments Inc Chapter 4 .

• A better way is to use DSPLIB.Sine Function in C • As standard.Slide 15 . C comes with the function sin(x) in “math. • This uses floating-point maths. © 2010 Texas Instruments Inc Chapter 4 . • It is not efficient for real-time applications.h”.

Slide 16 .Introducing DSPLIB © 2010 Texas Instruments Inc Chapter 4 .

• Each function is optimised for the processor.About DSPLIB • Texas Instruments provides a library containing a whole range of useful functions used in DSP: • Fast Fourier Transform (FFT) • Sine. Cosine and Tangent • Exponentials and logs.Slide 17 . in this case the TMS320C55xx. © 2010 Texas Instruments Inc Chapter 4 .

Slide 18 . you need to add the two following #include statements to your code: © 2010 Texas Instruments Inc Chapter 4 .DSP LIB Headers • When using DSPLIB.

Slide 19 .lib must be present in the build.DSPLIB Library • The library file 55xdsph. © 2010 Texas Instruments Inc Chapter 4 . DSPLIB for TMS320C5505 USB Stick.

Address of location containing the frequency – Parameter 2. © 2010 Texas Instruments Inc Chapter 4 .DSPLIB Sine Function • Is written in TMS320C55xx assembly language. • The function takes 3 parameters: – Parameter 1. Address of location to store calculated sine – Parameter 3.Slide 20 . Always 1.

• Use a scaling factor of 22368.Scaling the sine() function • Need to convert frequency in Hz to value for sine() function.Slide 21 . © 2010 Texas Instruments Inc Chapter 4 .

Slide 22 .000 – –32767 to represent –1.000 • Here 22368 represents 0. • We shall now look at how this magic number was obtained.Magic Numbers • Where did the magic number 22368 come from? • The TMS320C5505 is a 16-bit fixed-point processor that uses: – 32767 to represent 1. © 2010 Texas Instruments Inc Chapter 4 .682 decimal.

• The input to the function is a fixed-point number that represents an angle: – 0 => 0o – 16383 => 90o – 32767 => 180o – 2 * 32767 => 360o © 2010 Texas Instruments Inc Chapter 4 .DSPLIB sine() function • The DSPLIB function sine() calculates the sine of an angle.Slide 23 .

Sine 90o • To generate a waveform using 4 values we use: – sin 0o – sin 90o – sin 180o – sin 270o. • If Fs = 48000 Hz. the frequency generated will be: – 48000/4 = 12000 Hz. © 2010 Texas Instruments Inc Chapter 4 .Slide 24 .

• If Fs = 48000 Hz.Sine 45o • To generate a waveform using 8 value use: – sin 0o – sin 45o – sin 90o – sin 135o etc. © 2010 Texas Instruments Inc Chapter 4 .Slide 25 . the frequency generated will be: – 48000/8 = 6000 Hz.

0225 . 0. 0.0075o • To implement a 1 Hz sine wave we use: • 0 .0075 .015 . 0.Slide 26 . o o o o o © 2010 Texas Instruments Inc Chapter 4 .030 etc.Generate 1 Hz Sine Wave • To generate a 1 Hz sine wave we work backwards: – 48000/value = 1 Hz – value = 1/48000 • There corresponding angle will be: – 360o/48000 = 0. 0.

0075o • For 1 Hz using fixed-point using DSPLIB we require: – 2 * 32767 / 48000 © 2010 Texas Instruments Inc Chapter 4 .Fixed-Point Implementation • For 1 Hz we require each angle to be multiples of: – 360o/48000 = 0.Slide 27 .

0075o • For 2 Hz: – 2 * SCALING FACTOR = 2 * 360o/48000 = 0.Slide 28 .075o © 2010 Texas Instruments Inc Chapter 4 .Scaling Factor • We can use the value for 1 Hz as a scaling factor to calculate other frequencies: • SCALING FACTOR = 360o/48000 = 0.015o • For 10 Hz: – 10 * SCALING FACTOR = 10 * 360o/48000 = 0.

© 2010 Texas Instruments Inc Chapter 4 . divide by 32768 is implemented as >> 15.Scaling Factor Calculation • The fixed-point scaling factor is: 32767 2* 48000 • In fixed-point maths. to divide by 48000 is awkward • However.Slide 29 . to divide by 32768 is easy because 32768 = 215 • Example: To divide 3FFFFFFFh by 32768d shift right 15 places. Result = 7FFFh • In C code.

Slide 30 . • The scaling factor used is therefore 22368.Scaling Factor Calculation • The fixed-point scaling factor is derived as follows: 32767 22368 2* 2* 48000 32768 • The divide by 32768 is implemented as >>15 • Here 2/32768 is implemented as >>14. © 2010 Texas Instruments Inc Chapter 4 .

Slide 31 .Introduction to Laboratory © 2010 Texas Instruments Inc Chapter 4 .

USB Stick Setup TMS320C5505 USB to PC USB Stick Headphones © 2010 Texas Instruments Inc Chapter 4 .Slide 32 .

Sine Waves • Follow the steps previously given in Chapter 1 to set up the new project. © 2010 Texas Instruments Inc Chapter 4 .Slide 33 .Installing the Application • Use the code given in Application 4.

Create New Project © 2010 Texas Instruments Inc Chapter 4 .Slide 34 .

Files Used in Project © 2010 Texas Instruments Inc Chapter 4 .Slide 35 .

Slide 36 .Console • Sampling frequency and Gain are shown in the Console window. © 2010 Texas Instruments Inc Chapter 4 .

Experiments © 2010 Texas Instruments Inc Chapter 4 .Slide 37 .

© 2010 Texas Instruments Inc Chapter 4 .Change the Headphone Volume • Reduce gain from 10000 to 5000.Slide 38 .

Slide 39 .Change the Frequencies • Rather than 200 Hz and 500 Hz. use two musical notes: A = 440 Hz C = 523 Hz © 2010 Texas Instruments Inc Chapter 4 .

Change the Sampling Frequency • Change the sampling frequency to 24000 Hz.c © 2010 Texas Instruments Inc Chapter 4 . • You will need to alter the scaling factor in sinewaves. • The output frequencies will have changed.Slide 40 .

Questions • What are 3 ways to generate sine waves? • Which method is best suited to the TMS320C5505 USB Stick? • What are 3 applications of sine waves? © 2010 Texas Instruments Inc Chapter 4 .Slide 41 .

• Digital Signal Processing with C and the TMS320C30 by Rulph Chassaing.org Fixed Point Arithmetic (m11054) by Hyeokho Choi.org Fixed Point Arithmetic and Format (m10919) by Hyeokho Choi.Slide 42 . ISBN 0-471-55780-3. SPRU 422.cnx. © 2010 Texas Instruments Inc Chapter 4 .References • TMS320C55xx DSP Library Programmer’s Reference. • www. • www.cnx.

- Appendix a Page 524Uploaded byawaisshamim2008
- maple 8Uploaded byyizzy
- MITRES18 05S10 Big Picture DerivativesUploaded byHenry Ong
- Hong Qian- Terminal Twist Induced Continuous Writhe of a Circular Rod with Intrinsic CurvatureUploaded byLokosoo
- 14-1 GraphsUploaded bykeenahbernadette
- specaUploaded byKabir Khan
- 2013 Roseville College Year 11 General Mathematics Half Yearly 2013.docxUploaded byShahrazad8
- Precalc Survival SheetUploaded byKrešimir Ivanović
- Math Revision.pptxUploaded byjuliana
- GHS AP Stat TalkUploaded bysouvik5000
- Jee 2014 Booklet3 Hwt FunctionsUploaded byvarunkohliin
- QAT110701_Sol.docUploaded byapi-3756296
- Identities and Inequalities in Geometry - Version 1.0Uploaded bythalesreda
- 9709_w08_qp_2Uploaded byZubair Junjunia
- Flash Cards | Calculus | www.ilearnmath.netUploaded byteachopensource
- Height and DistanceUploaded bysureshreddy1234
- Plot FunctionUploaded byShoba Devulapalli
- Palmer c , Leigh c - Plane and Spherical TrigonometryUploaded byfafarifafu
- Time Table for II Sem_ M(1)Uploaded bydonzjk
- Chapter 5 TrigonometryUploaded byjoseph yu
- DESIGN AND IMPLEMENTATION OF A LOW COMPLEXITY NCO BASED CFO.pdfUploaded byPhuc Hoang
- maths t paper2Uploaded bynamasayaitah
- Wh Alley l ReportUploaded bylucywhalley
- dsp_QBUploaded bydabhianand13
- A Textbook of Practical Astronomy, NassauUploaded byandresmejia68
- Change of AxisUploaded byveena209
- Partial Lecture NotesUploaded bySam Kor
- Bat dang thuc luong giacUploaded byapi-19473489
- DSP Orfanidis ErrataUploaded byNikunj Shah
- HMS211MsbUploaded byunknown error

- Lista_de_Exercicios_2.pdfUploaded byDouglas Mangini
- Codificacao pjsuaUploaded byDouglas Mangini
- Biological ScienceUploaded byDouglas Mangini
- ARP Tables Lookup AlgorithmsUploaded byDouglas Mangini
- Avaliacao SupUploaded byDouglas Mangini
- solution manual - microelectronics; circuit analysis & design ch1Uploaded byDouglas Mangini
- livro_canon.pdfUploaded byDouglas Mangini
- Chapter 1 Getting StartedUploaded byDouglas Mangini
- BC1501 - POOUploaded byDouglas Mangini
- Discussao Em Grupo 1Uploaded byDouglas Mangini
- Chapter 3 Echo and ReverberationUploaded byDouglas Mangini
- Chapter 2 Improved Audio TemplateUploaded byDouglas Mangini
- Chapter 2 Improved Audio TemplateUploaded byDouglas Mangini
- calc_complex.pdfUploaded byDouglas Mangini