DSP - 让所有的频率的幅度 [英] DSP - get the amplitude of all the frequencies

查看:154
本文介绍了DSP - 让所有的频率的幅度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是有关:
<一href=\"http://stackoverflow.com/questions/20057831/dsp-audio-processing-squart-or-log-to-leverage-fft\">DSP :音频处理:squart或登录利用FFT

在我损失了大约正确的算法来选择。

in which I was lost about the right algorithm to choose.

现在,

我要得到我的信号的所有频率,我从一个音频文件得到的。

I want to get all the frequencies of my signal, that I get from an audio file.

我使用numpy的,和scikits.audiolab。我做了阅读在DSP上​​受到了不少,去dspguru.com以及阅读过网文件和漂亮的博客。

I use numpy, and scikits.audiolab. I made a lot of reading on the dsp subject, went to dspguru.com as well, read papers and nice blogs over the net.

在code我用这一条是:

The code I use is this one :

import numpy as np
from scikits.audiolab import Sndfile


f = Sndfile('first.ogg', 'r')

# Sndfile instances can be queried for the audio file meta-data
fs = f.samplerate
nc = f.channels
enc = f.encoding

print(fs,nc,enc)
# Reading is straightfoward
data = f.read_frames(10)
print(data)
print(np.fft.rfft(data))

我是新来的DSP。

I am new to DSP.

我想能够的信号的所有频率分离,以比较不同的信号。
我用numpy.fft.rfft声音的阵列上;但现在,仅此操作是不够的。那么,什么是获得频率的所有大小的最佳解决方案是否正确?

I would like to be able to separate all the frequencies of a signal to compare different signals. I use numpy.fft.rfft on the array of sound; But now, this operation alone is not enough. So, what is the best solution to get all the magnitudes of frequencies correctly ?

我看到相乘所得到的值获得复数关闭,整个转化为实数。

I saw that multiplying the resulting values get the complex numbers off and transform the whole as a real number.

现在是什么吗?是不是这样?

Now what please ? Is that it ?

如果你需要我澄清什么,只是问。

if you need me to clarify anything, just ask.

非常感谢!

推荐答案


  • 您说我想我的信号的所有频率,我从一个音频文件得到的。但你真正想要的是频率的幅度。

  • You say "I want to get all the frequencies of my signal, that I get from an audio file." but what you really want is the magnitude of the frequencies.

    在您的code,它看起来像(我不知道蟒蛇)你只读了前10个样本。假设你的文件是单声道的,这很好,但你可能想看看更大的一组样品,说1024个样本。一旦你这样做,当然,你要重复上下一组N个样本。您可能会或可能不想重叠样本集,您可能希望应用窗口的功能,但你所做的是一个良好的开端。

    In your code, it looks like (I don't know python) you only read the first 10 samples. Assuming your file is mono, that's fine, but you probably want to look at a larger set of samples, say 1024 samples. Once you do that, of course, you'll want to repeat on the next set of N samples. You may or may not want to overlap the sets of samples, and you may want to apply a window function, but what you've done here is a good start.

    什么贪睡说的是真的。 FFT的输出是复杂的。为了找到一个给定频率的大小,你需要找到长度或复数,这简直是开方的绝对值(R ^ 2 + I ^ 2)。

    What sleepyhead says is true. The output of the fft is complex. To find the magnitude of a given frequency, you need to find the length or absolute value of the complex number, which is simply sqrt( r^2 + i^2 ).

    这篇关于DSP - 让所有的频率的幅度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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