⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profile.c

📁 CHAPTER 1- real-Time Digital Signal Processing: Implementations and Applications, Second Edition by
💻 C
字号:
// 
//  Project: Experiment 1.6.5 Profile - Chapter 1 
//  File name: profile.c   
//
//  Description: This function is for example 1.6.5 profile
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//
//  Tools used: CCS v.2.12.07
//              TMS320VC5510 DSK Rev-C
//

#include <stdio.h>
#include <math.h>
#include "profile.h"

void main()
{ 
  FILE  *outFile;  // File pointer of output file
  short x[2],i;

  outFile = fopen("..\\data\\output.wav", "wb");
                
  // Add wav header to left and right channel output files
  fwrite(wavHeader, sizeof(char), 44, outFile);  
    
  // Generate 1 second 1 kHz sine wave at 8kHz sampling rate
  for (i=0; i<8000; i++)
  {    
    x[0] = sinewave(i);     // <- Profile range start
    x[1] = (x[0]>>8)&0xFF;  // <- Profile range stop
    x[0] = x[0]&0xFF;
    fwrite(x, sizeof(char), 2, outFile);     
  }
    
  fclose(outFile);
}

// Integer sine-wave generator
short sinewave(short n)          // <- Profile function
{
  return( (short)(sin(TWOPI_f_F*(float)n)*16384.0));
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -