Android 2.3的可视化工具 - 很难理解getFft() [英] Android 2.3 Visualizer - Trouble understanding getFft()

查看:454
本文介绍了Android 2.3的可视化工具 - 很难理解getFft()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里很遗憾第一次事先的任何屠杀格式。

First time here so sorry in advance for any butchered formatting.

所以我完全新的DSP,所以我有变换傅立叶只有非常大致的了解。我想建立的Andr​​oid SDK中9,其中包括在android.media.audiofx.Visualizer展示台类可视化应用程序 <一href="http://developer.android.com/reference/android/media/audiofx/Visualizer.html#getFft%28byte%5b%5d%29">http://developer.android.com/reference/android/media/audiofx/Visualizer.html

So I am completely new to DSP so I have only a very general understanding of the Fourier Transform. I am trying to build a visualizer app for Android SDK 9, which includes a Visualizer class in android.media.audiofx.Visualizer http://developer.android.com/reference/android/media/audiofx/Visualizer.html

的javadoc方法getFft(),这是我用什么样的状态:

The javadoc for the method getFft(), which is what I am using states:

返回的频率捕捉   当前正在播放的音频内容。该   捕捉是一个8位的幅度FFT。注意   该FFT的大小是一半   指定捕捉大小,但两者   频谱的两侧被返回   屈服的字节数等于   捕捉大小。

"Returns a frequency capture of currently playing audio content. The capture is a 8-bit magnitude FFT. Note that the size of the FFT is half of the specified capture size but both sides of the spectrum are returned yielding in a number of bytes equal to the capture size."

首先,什么是频谱两侧是什么意思?请问这个输出从标准FFT有什么区别?

First of all, what does "both sides of the spectrum" mean? How does this output differ from a standard FFT?

下面是字节数组中的一些样本输出,getFft()给予124点,以保持它的简单,我抓住了第一个31箱。以下是前31个垃圾箱的大小:

Here is some sample output of the byte array, getFft() was given 124 points to keep it simple and I grabbed the first 31 bins. Here are the magnitudes of the first 31 bins:

{123, -2, -23, -3, 6, -16, 15, -10, -8, -12, 9, -9, 17, -6, -18, -22, -8, 4, -5, -2, 10, -3, -11, 3, -4, -11, -8, 15, 16, 11, -12, 12}

任何帮助或解释是大大AP preciated!

Any help or explanation would be greatly appreciated!

编辑: 所以,盯着一堆图表后,它看起来像我的问题的一部分,是谷歌没有具体说明设备的使用情况。几乎所有的其他测量以MHz为单位进行,以假设FTT输出也是以MHz会是公平的?有一个地方,我可以看到展示台类的源$ C ​​$ C所以也许我可以找出到底是引擎盖下的真实场景?

我说干就干,抓住所有getFft的输出()

I went ahead and grabbed all of the output of getFft()

93, -2, -28, -16, -21, 19, 44, -16, 3, 16, -9, -4, 0, -2, 21, 16, -3, 1, 2, 4, -3, 5, 5, 10, 6, 4, -9, 7, -2, -1, 2, 11, -1, 5, -8, -2, -1, 4, -5, 5, 1, 3, -6, -1, -5, 0, 0, 0, -3, 5, -4, -6, -2, -2, -1, 2, -3, 0, 1, -3, -4, -3, 1, 1, 0, -2, -1, -1, 0, -5, 0, 4, -1, 1, 1, -1, 1, -1, -3, 2, 1, 2, -2, 1, 0, -1, -2, 2, -3, 4, -2, -2, 0, 1, -4, 0, -4, 2, -1, 0, -3, -1, -1, -1, -5, 2, -2, -2, 0, -3, -2, 1, -5, -2, 0, 0, 0, -2, -2, -1, -1, -1, -2, 0, 3, -3, -1, 0

所以,如果我正确地理解这一点,我这里的输出应该是从-N到0至N -N 0应该活脱脱0到N但是,当我看到这些的幅度,我看不出有任何反映数据。谷歌似乎表明,输出应该是从0到N只在光谱的两侧。所以,我应该能够从(output.length-1)/ 2至output.length-1取数据。负振幅移动速度比采样速率和正幅度被移动比采样速率慢。难道我理解这是否正确?

So if I understand this correctly, my output here should be from -N to 0 to N. -N to 0 should look just like 0 to N. But when I look at these amplitudes, I don't see any mirrored data. Google seems to indicate that the output should be from 0 to N just on both sides of the spectrum. So I should be able to take the data from (output.length-1)/2 to output.length-1. The negative amplitudes are moving faster than the sample rate and the positive amplitudes are moving slower than the sample rate. Did I understand this correctly?

推荐答案

在FFT输出样值K的频率由下式给出:

The frequency at FFT output sample k is given by:

Fk = k * Fs / N,    k = 0,1,...,N-1 

其中

  • FS 是时间序列输入的采样频率
  • N 是用于计算FFT样本数
  • Fs is the sampling frequency of the time series input
  • N is the number of samples used to compute the FFT

频谱的双方是指在FFT的输出的正和负频率。 FFT的强制频率输出为周期性的,一个周期Fs的的。如果你看一下FFT输出,它涵盖了频率从0到fs。它通常是有利,而不是通过移动FFT输出从0.5 * Fs的查看光谱的经-0.5 * Fs的范围内,以0.5 * Fs的 - > Fs的至-0.5 * Fs的 - > 0,因为它们是相等的,因为周期性的。

The two sides of the spectrum refers to the positive and negative frequencies in the output of the FFT. The FFT forces the frequency output to be periodic with a period of Fs. If you look at the FFT output, it covers the frequencies from 0 to Fs. It is often advantageous to view the spectrum over the range of -0.5*Fs to 0.5*Fs instead by shifting the FFT output from 0.5*Fs -> Fs to -0.5*Fs -> 0 since they are equal because of the periodicity.

有关实值信号,像那些必须在音频处理,负频率输出将是正频率的镜像。正因为如此,对光谱往往仅一侧分析真实的信号时使用。

For real-valued signals, like the ones you have in audio processing, the negative frequency output will be a mirror image of the positive frequencies. Because of this, often only one side of the spectrum is used when analyzing real signals.

另外重要的一点是在0.5 * Fs的被称为奈奎斯特频率中的意义。信号只能准确地重新present频率达到奈奎斯特频率和任何高于它会混淆(折叠)放回谱造成失真。

Another important point is the significance of 0.5*Fs which is known as the Nyquist Frequency. A signal can only accurately represent frequencies up to the Nyquist frequency and anything above it will be aliased (folded) back onto the spectrum causing distortion.

因此​​,其实所有你应该担心可视化的目的是对应于频率的范围从0到Fs的FFT输出采样/ 2,因为这些是用于与采样速率Fs的一个真实的信号的有意义的样本

So really all you should worry about for visualization purposes are the FFT output samples corresponding to the range of frequencies from 0 to Fs/2 since those are the meaningful samples for a real signal with sampling rate Fs.

这篇关于Android 2.3的可视化工具 - 很难理解getFft()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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