We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byJaron Yelvington
Modified about 1 year ago
0 - 1 © 2010 Texas Instruments Inc Practical Audio Experiments using the TMS320C5505 USB Stick “Sine Waves” Texas Instruments University Programme Teaching Materials
Chapter 4 - Slide 2 © 2010 Texas Instruments Inc Sine Waves
Chapter 4 - Slide 3 © 2010 Texas Instruments Inc 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).
Chapter 4 - Slide 4 © 2010 Texas Instruments Inc Objectives To generate sine waves from 10Hz to 16000Hz. To introduce the Texas Instruments library of DSP functions DSPLIB.
Chapter 4 - Slide 5 © 2010 Texas Instruments Inc Knowledge Required Some understanding of fixed-point and floating-point numbers is required. Details of two useful articles from are given in the References Section.www.cnx.org
Chapter 4 - Slide 6 © 2010 Texas Instruments Inc Sine Wave and FFT A sine wave is a pure tone. It only contains one frequency:
Chapter 4 - Slide 7 © 2010 Texas Instruments Inc Complex Waveform and FFT A complex waveform has several frequency components:
Chapter 4 - Slide 8 © 2010 Texas Instruments Inc Generating Sine Waves There are 3 main ways to generate sine waves: –Look-up Table –Recursive Equation –Taylor Expansion.
Chapter 4 - Slide 9 © 2010 Texas Instruments Inc Look-up Table This is the simplest way to generate a sine wave. Put known values into a table: Values are read using an offset e.g. sinetable;
Chapter 4 - Slide 10 © 2010 Texas Instruments Inc About Look-up Tables Advantages: –Fast to implement –Values are always accurate Disadvantages: –Can only be used for exact divisions of sampling frequency.
Chapter 4 - Slide 11 © 2010 Texas Instruments Inc Recursive Equation Uses the following mathematical equation: The next sine output is derived from the previous values We shall look at this in more detail in Chapter 7, Infinite Impulse Response (IIR) filters.
Chapter 4 - Slide 12 © 2010 Texas Instruments Inc Taylor Series A sine function can be implemented as a geometric series: where x is the input in radians. This method is used by the Texas Instruments DSP Library DSPLIB.
Chapter 4 - Slide 13 © 2010 Texas Instruments Inc 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.
Chapter 4 - Slide 14 © 2010 Texas Instruments Inc C Code Implementation
Chapter 4 - Slide 15 © 2010 Texas Instruments Inc Sine Function in C As standard, C comes with the function sin(x) in “ math.h ”. This uses floating-point maths. It is not efficient for real-time applications. A better way is to use DSPLIB.
Chapter 4 - Slide 16 © 2010 Texas Instruments Inc Introducing DSPLIB
Chapter 4 - Slide 17 © 2010 Texas Instruments Inc 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. Each function is optimised for the processor, in this case the TMS320C55xx.
Chapter 4 - Slide 18 © 2010 Texas Instruments Inc DSP LIB Headers When using DSPLIB, you need to add the two following #include statements to your code:
Chapter 4 - Slide 19 © 2010 Texas Instruments Inc DSPLIB Library The library file 55xdsph.lib must be present in the build. DSPLIB for TMS320C5505 USB Stick.
Chapter 4 - Slide 20 © 2010 Texas Instruments Inc DSPLIB Sine Function Is written in TMS320C55xx assembly language. The function takes 3 parameters: –Parameter 1. Address of location containing the frequency –Parameter 2. Address of location to store calculated sine –Parameter 3. Always 1.
Chapter 4 - Slide 21 © 2010 Texas Instruments Inc Scaling the sine() function Need to convert frequency in Hz to value for sine () function. Use a scaling factor of
Chapter 4 - Slide 22 © 2010 Texas Instruments Inc Magic Numbers Where did the magic number come from? The TMS320C5505 is a 16-bit fixed-point processor that uses: – to represent – –32767 to represent –1.000 Here represents decimal. We shall now look at how this magic number was obtained.
Chapter 4 - Slide 23 © 2010 Texas Instruments Inc DSPLIB sine() function The DSPLIB function sine() calculates the sine of an angle. The input to the function is a fixed-point number that represents an angle: – 0 => 0 o – => 90 o – => 180 o – 2 * => 360 o
Chapter 4 - Slide 24 © 2010 Texas Instruments Inc Sine 90 o To generate a waveform using 4 values we use: –sin 0 o –sin 90 o –sin 180 o –sin 270 o. If Fs = Hz, the frequency generated will be: –48000/4 = Hz.
Chapter 4 - Slide 25 © 2010 Texas Instruments Inc Sine 45 o To generate a waveform using 8 value use: –sin 0 o –sin 45 o –sin 90 o –sin 135 o etc. If Fs = Hz, the frequency generated will be: –48000/8 = 6000 Hz.
Chapter 4 - Slide 26 © 2010 Texas Instruments Inc 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: – 360 o /48000 = o To implement a 1 Hz sine wave we use: 0 o, o, o, o, o etc.
Chapter 4 - Slide 27 © 2010 Texas Instruments Inc Fixed-Point Implementation For 1 Hz we require each angle to be multiples of: – 360 o /48000 = o For 1 Hz using fixed-point using DSPLIB we require: –2 * / 48000
Chapter 4 - Slide 28 © 2010 Texas Instruments Inc Scaling Factor We can use the value for 1 Hz as a scaling factor to calculate other frequencies: SCALING FACTOR = 360 o /48000 = o For 2 Hz: – 2 * SCALING FACTOR = 2 * 360 o /48000 = o For 10 Hz: – 10 * SCALING FACTOR = 10 * 360 o /48000 = o
Chapter 4 - Slide 29 © 2010 Texas Instruments Inc Scaling Factor Calculation The fixed-point scaling factor is: In fixed-point maths, to divide by is awkward However, to divide by is easy because = 2 15 Example: To divide 3FFFFFFFh by 32768d shift right 15 places. Result = 7FFFh In C code, divide by is implemented as >> 15.
Chapter 4 - Slide 30 © 2010 Texas Instruments Inc Scaling Factor Calculation The fixed-point scaling factor is derived as follows: The divide by is implemented as >>15 Here 2/32768 is implemented as >>14. The scaling factor used is therefore
Chapter 4 - Slide 31 © 2010 Texas Instruments Inc Introduction to Laboratory
Chapter 4 - Slide 32 © 2010 Texas Instruments Inc USB Stick Setup TMS320C5505 USB to PC Headphones USB Stick
Chapter 4 - Slide 33 © 2010 Texas Instruments Inc Installing the Application Use the code given in Application 4, Sine Waves Follow the steps previously given in Chapter 1 to set up the new project.
Chapter 4 - Slide 34 © 2010 Texas Instruments Inc Create New Project
Chapter 4 - Slide 35 © 2010 Texas Instruments Inc Files Used in Project
Chapter 4 - Slide 36 © 2010 Texas Instruments Inc Console Sampling frequency and Gain are shown in the Console window.
Chapter 4 - Slide 37 © 2010 Texas Instruments Inc Experiments
Chapter 4 - Slide 38 © 2010 Texas Instruments Inc Change the Headphone Volume Reduce gain from to 5000.
Chapter 4 - Slide 39 © 2010 Texas Instruments Inc Change the Frequencies Rather than 200 Hz and 500 Hz, use two musical notes: A = 440 Hz C = 523 Hz
Chapter 4 - Slide 40 © 2010 Texas Instruments Inc Change the Sampling Frequency Change the sampling frequency to Hz. The output frequencies will have changed. You will need to alter the scaling factor in sinewaves.c
Chapter 4 - Slide 41 © 2010 Texas Instruments Inc 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?
Chapter 4 - Slide 42 © 2010 Texas Instruments Inc References TMS320C55xx DSP Library Programmer’s Reference. SPRU 422. Digital Signal Processing with C and the TMS320C30 by Rulph Chassaing. ISBN Fixed Point Arithmetic and Format (m10919) by Hyeokho Choi.www.cnx.org Fixed Point Arithmetic (m11054) by Hyeokho Choi.www.cnx.org
Copyright © 2003 Texas Instruments. All rights reserved. DSP C5000 Chapter 19 Fast Fourier Transform.
COMPILER CONSTRUCTION WEEK- 4: INTRODUCTION TO COMPILER & INTERPRETER.
Design of Digital IIR Filter DR. Wajiha Shah. A digital filter is simply a discrete-time, discrete-amplitude convolver. Filtering is in essence the multiplication.
DCSP-2: Fourier Transform I Jianfeng Feng
Next Back Tangent and Cotangent Graphs Reading and Drawing Tangent and Cotangent Graphs Some slides in this presentation contain animation. Slides will.
1 ControlNumber Nature of light and theories about it Fourier optics falls under wave optics Provides a description of propagation of light waves based.
ANALOG TO DIGITAL CONVERSION Lecture 3,4 Syed M. Zafi S. Shah احسان احمد عرساڻي
C How to Program, 6/e © by Pearson Education, Inc. All Rights Reserved.
Microsoft ® Access ® 2010 Training Create queries for a new database.
Welcome! You should have an Analog Discovery module, a USB drive and a USB connector You should have a laptop or netbook PC Get started by installing the.
2.1 Program Construction In Java Joey Militti Brendan Tackney Period 1.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Nancy Stern Hofstra University Robert A. Stern Nassau Community.
DCSP-1: Introduction Jianfeng Feng. DCSP-1: Introduction Jianfeng Feng Office: CS313
Next Back Esc Sine and Cosine Graphs Reading and Drawing Sine and Cosine Graphs Some slides in this presentation contain animation. Slides will be more.
Chapter 21 Frequency Modulation GMSK Modulation DSP C5000 Copyright © 2003 Texas Instruments. All rights reserved.
©G. Millbery 2003File and Database ConceptsSlide 1 Methods of Access Serial Sequential Indexed Sequential Random Access Need to show advantages,
SG 4: FIT1001 Computer Systems S Important Notice for Lecturers This file is provided as an example only Lecturers are expected to modify / enhance.
1 Chapter 2 Differentiation: Tangent Lines. tangent In plane geometry, we say that a line is tangent to a circle if it intersects the circle in one point.
What the Is an FFT? James D. (jj) Johnston Independent audio and electroacoustics consultant.
GRADE 1 Curriculum Work Group. Agenda Present the pacing calendar Unit 1 Review unit plan document Work groups Essential Resource List for Grade 1.
DCSP-12 Jianfeng Feng
Copyright © 2003 Pearson Education, Inc. Slide 1.
Lesson 6D – Loops and String Arrays – split process By John B. Owen All rights reserved ©2011.
1 ECE 206L Lecture Notes 1ECE 206L. 2 DC Current vs. AC Current Direct current (DC) flows in one direction the circuit. Alternating current (AC) flows.
DCSP-1: Introduction Jianfeng Feng. DCSP-1: Introduction Jianfeng Feng Department of Computer Science Warwick Univ., UK
Computer Architecture And Organization. Difference between computer organization and computer architecture Computer architecture is the architectural.
Boosting achievement in A2 Core Mathematics: Supporting lower ability students through the C3 and C4 modules Phil Chaffé 2012.
First Program in JAVA: Printing a Line of Text Modifying our First Java Program Escape Sequences Displaying Text with printf Data types in JAVA.
Tangent Lines Section 2.1. Secant Line A secant line is a line that connects two points on a graph. Notice the slopes of secant lines are different depending.
Setting Up a Custom Gradebook Logon to GDP and click Instructor options. Then click LAN Gradebook and Create New Class to create a class in which a Custom.
© 2016 SlidePlayer.com Inc. All rights reserved.