IP摄像机和FFT的音频采样率 [英] Audio sampling rate of an ip camera and FFT

查看:323
本文介绍了IP摄像机和FFT的音频采样率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到的字节从音频输入流的阵列(尺寸64)(从与采样速率Fs的= 44100Hz的照相机,在Java)。然后我这个数组转换成double数组(此数组的大小变为8),并与jtransforms库执行FFT:

I am getting an array of bytes (size 64) from an audio input stream (from a camera with sampling rate Fs = 44100Hz, in java). And then I convert this array into an array of doubles (the size of this array becomes 8) and perform FFT with jtransforms library:

DoubleFFT_1D fft = new DoubleFFT_1D(8);
fft.realForward(doubles);

然后我计算频率:频率= I * Fs的/ N。我的问题是,N = 8或N = 64?
如果N = 8,要我莫名其妙正确率采样Fs的价值?
会澄清非常感谢。

And then I calculate frequencies: freq = i*Fs/N. My question is, N=8 or N=64? If N=8, should I somehow correct the value of rate sampling Fs? Would be very grateful for clarification.

编辑:
我想,当我结合对字节,数组的大小将成为2分之64= 32。会做这样每对:

EDITED: I figured that when I combine pairs of bytes, the size of the array will become 64/2=32. Will do it like this for each pair:

ByteBuffer bb = ByteBuffer.allocate(2);
bb.order(ByteOrder.LITTLE_ENDIAN);
bb.put(firstByte);
bb.put(secondByte);
double val = bb.getDouble(0);

结果是双打的数组,正是我需要的。现在,当我计算
频率频率(正常化后)= I * FS / N,N = 32,它是正确的?

The result is an array of doubles, exactly what I need. Now, when I calculate the frequencies (after normalization) freq = i*Fs/N, N = 32. Is it correct?

另外,我使用fft.realForward(双打),而不是fft.realForwardFull(双打),我应该devide Fs的2?即,FS = FS / 2

Also, as I am using fft.realForward(doubles) and not fft.realForwardFull(doubles), should I devide Fs by 2? That is, Fs = Fs/2?

再次感谢您的帮助和时间。

Thank you again for your help and time..

推荐答案

执行你要知道音频的比特深度数据的FFT之前(这通常是16位或32位),这样你就可以重新组装样品

Before performing the FFT of the data you have to know the bit depth of the audio ( this is usually 16bits or 32Bits) so you can re-assemble the samples.

如果例如位深度是16位(2字节),那么我们知道,一个字节仅包含样品的前8位和另一个字节将包含最后8位,所以我们结合(未添加),以形成字节一个sample.After这一点,我们将在2 ^把这个样本(位深度 - 1)= 2 ^ 15 = 32678,以获得实际的样本归,这将是介于-1和1.After这样做,我们可以继续执行样本FFT上的数据。

If for instance the bit depth is 16Bits ( 2 bytes) then we know that one byte only contains the first 8 bits of the sample and another byte will contain the last 8 bits so we combine ( not add ) the bytes to form a sample.After this we will divide this sample by 2^(BitDepth - 1) = 2^15 = 32678 to get the actual normalised sample which will be a sample between -1 and 1.After doing this we can proceed to perform an FFT on the data.

您可能想看看答案这个问题看到code展示了如何实际铸造和规范化可以做到的。

You might want to look at the answer to this question to see code showing how the actual casting and normalisation can be done.

这篇关于IP摄像机和FFT的音频采样率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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