如何转换波数据为复数 [英] How to convert wave data into Complex numbers

查看:176
本文介绍了如何转换波数据为复数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从一个麦克风读取原始数据,并送入FFT。在FFT库,我想( AForge 并的 Exocortex.DSP )开复数作为输入,并给出了复数作为输出。

I'm reading raw data from a mic and feeding into FFT. Two of the FFT libraries I'm trying (AForge and Exocortex.DSP) takes Complex numbers as input and gives Complex numbers as output.

我试图了解复杂的数字。

I'm trying to understand what complex numbers are.

更具体地说 - 我怎么转换成FFT从麦克风到获得复数进行处理的原始音频数据

我如何绘制输出到一个不错的谱图(也就是,阅读从输出的频率和幅度)?

More specifically - how do I convert the raw audio data obtained from a microphone into complex numbers for processing in FFT?
And how do I plot the output to a nice spectrogram (that is; reading the frequencies and amplitudes from the output)?

额外的好处:除上述其他两个是什么FFT库在那里为净

Added bonus: What FFT libs are there for .Net other than the two mentioned?

推荐答案

在执行真实数据的FFT,那么你只需要输入的虚部设置为零。 (请注意,在FFT的输出仍然是复杂的,但。)

When performing an FFT on real data then you just need to set the imaginary part of the input to zero. (Note that the output of the FFT will still be complex though.)

密谋谱图比较复杂 - 有对SO previous张贴关于这一点,但本质上,你需要计算的功率谱作为连续重叠的时间窗口(一般重叠= 50%),然后绘制使用颜色或大小灰度强度(与时间上通常Y轴的X轴和频率)这些功率谱的对数(dB为单位)幅度。来计算功率谱

Plotting a spectrogram is more complex - there are previous posts on SO about this but essentially you need to compute the power spectrum for successive overlapping time windows (typical overlap = 50%) and then plot the log (dB) magnitude of these power spectra using colour or grey scale intensity for magnitude (with time on the X axis and frequency on the Y axis usually). To compute the power spectrum:


  • 窗函数输入数据(例如汉宁窗)

  • FFT

  • 取平方第一的幅度 N / 2 FFT输出值(重*重+ IM * IM

  • 转换幅度dB值( 10 * LOG10(幅度平方)

  • apply window function to input data (e.g. Hanning window)
  • FFT
  • take magnitude squared of first N/2 values of FFT output (re*re + im*im)
  • convert magnitude to dB value (10 * log10 (magnitude squared))

这篇关于如何转换波数据为复数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆