资源简介
基于VC6.0(MFC)的对声卡音频数据采集,实时显示波形。可以设置采样率、声道、采样位数等参数
代码片段和文件信息
/*================================================================================
fftdom.cpp - Copyright (C) 1997 by Don Cross
http://www.intersrv.com/~dcross/fft.html
This C++ source file contains a function for finding the dominant
frequency in an output buffer calculated by the FFT algorithm.
================================================================================*/
#include “stdafx.h“
#include
// This function returns the dominant frequency in Hz.
double FindDominantFrequency (
int numSamples // total number of frequency samples in buffer
int windowSize // width of search window (experiment with this; try 4)
double *real // real coefficient buffer
double *imag // imaginary coefficient buffer
double *ampl // work buffer for holding r*r+i*i values
double samplingRate ) // sampling rate expressed in samples/second [Hz]
{
const int n = numSamples/2; // number of positive frequencies.
// Pre-calculate amplitude values in the buffer provided by the caller.
// This makes the code a lot more efficient.
for ( int i=0; i {
ampl[i] = real[i]*real[i] + imag[i]*imag[i];
}
// Zero out amplitudes for frequencies below 20 Hz.
int low = int ( numSamples * 20.0 / samplingRate );
assert ( low>=0 && low for ( i=low; i>=0; i-- )
{
ampl[i] = 0.0;
}
// In the following loop i1 is the left side of the window
// and i2 is the right side.
double maxWeight = -1.0;
double centerFreq = -1.0;
for ( int i2 = windowSize; i2 < n; i2++ )
{
const int i1 = i2 - windowSize;
double moment = 0.0;
double weight = 0.0;
for ( int i=i1; i<=i2; i++ )
{
weight += ampl[i];
moment += double(i) * ampl[i];
}
if ( weight > maxWeight )
{
maxWeight = weight;
centerFreq = moment / weight;
}
}
return samplingRate * centerFreq / double(numSamples);
}
/*--- end of file fftdom.cpp ---*/
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 415 1996-06-04 19:18 RECORD\DDCMATH.H
文件 11062 2009-09-27 10:24 RECORD\Debug\BuildLog.htm
文件 0 2009-09-30 11:23 RECORD\Debug\data.txt
文件 4233 2009-09-27 13:11 RECORD\Debug\Fftdom.obj
文件 0 2009-09-27 13:11 RECORD\Debug\Fftdom.sbr
文件 5037 2009-09-27 13:10 RECORD\Debug\Fftmisc.obj
文件 0 2009-09-27 13:10 RECORD\Debug\Fftmisc.sbr
文件 6609 2009-09-27 13:10 RECORD\Debug\Fourierd.obj
文件 0 2009-09-27 13:10 RECORD\Debug\Fourierd.sbr
文件 6571 2009-09-27 13:10 RECORD\Debug\Fourierf.obj
文件 0 2009-09-27 13:10 RECORD\Debug\Fourierf.sbr
文件 67 2009-09-27 10:23 RECORD\Debug\mt.dep
文件 450092 2009-09-27 16:02 RECORD\Debug\Noname.wav
文件 450048 2009-09-27 16:02 RECORD\Debug\Noname.wav.dat
文件 4015104 2009-09-27 13:11 RECORD\Debug\Record.bsc
文件 1306709 2009-09-27 13:11 RECORD\Debug\Record.exe
文件 146 2009-09-25 12:43 RECORD\Debug\Record.exe.em
文件 212 2009-09-25 12:43 RECORD\Debug\Record.exe.em
文件 145 2009-09-27 10:23 RECORD\Debug\Record.exe.intermediate.manifest
文件 5916584 2009-09-27 13:11 RECORD\Debug\Record.ilk
文件 16512 2009-09-27 13:10 RECORD\Debug\Record.obj
文件 18196 2009-09-25 14:17 RECORD\Debug\Record.res
文件 0 2009-09-27 13:10 RECORD\Debug\Record.sbr
文件 48658 2009-09-27 13:09 RECORD\Debug\RecordDlg.obj
文件 0 2009-09-27 13:10 RECORD\Debug\RecordDlg.sbr
文件 101871 2009-09-27 13:09 RECORD\Debug\Scope.obj
文件 0 2009-09-27 13:10 RECORD\Debug\Scope.sbr
文件 106019 2009-09-27 13:09 RECORD\Debug\StdAfx.obj
文件 1358043 2009-09-27 13:09 RECORD\Debug\STDAFX.sbr
文件 238592 2009-09-27 13:11 RECORD\Debug\vc60.idb
............此处省略44个文件信息
相关资源
- 研华 数据采集卡应用与编程
- 温度数据采集系统程序上位机程序+
- kinect2.0数据采集及点云生成代码C++
- TCPIP实用程序&温度数据采集系统程序
- usb2187数据采集卡的程序
- 基于C++的三菱机床实时数据采集可运
- 声卡采集与分析程序C++
- 声卡数据采集播放演示源程序vc.zip
- 基于STM32单片机的多路数据采集系统设
- C++ 数据采集
- 激光雷达UTM-30LX图像采集程序及数据
- ADC0809做的电压+电流+功率数据采集系
- vc++ 数据采集卡编程
- 基于VC++6.0的串口实时数据采集及实时
- VC环境下高速实时数据采集的实现
- 4G远程温湿度数据采集系统(原理图和
- C++ 检测是否安装声卡
- Sick LMS激光雷达数据采集程序
- Visual C++数据采集与串口通讯测控应用
- VC++实现GPS数据采集与提取的软件编程
- 基于8051的四路数据采集系统设计
- 基于VC++6.0的串口数据实时采集
评论
共有 条评论