LoginSignup
1
1

More than 5 years have passed since last update.

Android SDK Visualizer でFFTしてみたけど、とれたデータの意味を理解してみた。

Posted at

Android SDK Visualizer

具体的にどんな値がとれるのか?

getFFT()

The capture is an 8-bit magnitude FFT, the frequency range covered being 0 (DC) to half of the sampling rate returned by getSamplingRate(). The capture returns the real and imaginary parts of a number of frequency points equal to half of the capture size plus one.

  • サンプリングレート 一秒間あたりの分割数

getSamplingRate()

Returns
int the sampling rate in milliHertz.

デバッグした実際の値:44100000 (mmHz)

44,1 kHz (オーディオの一般的なサンプリングレート)

  • ビット深度 サンプリング1つに対して 2^(ビット数) の情報量

8bit マニュアル記載より

  • キャプチャーサイズ

getCaptureSize()

Returns
int the capture size in bytes.

デバッグした実際の値:1024 

  • 最初の1バイト目(DC)は実部(real)、2バイト目は(sampling周波数/2)の周波数の実部(real)のみ
  • それ以降は実数+虚数で2つでセットのデータ キャプチャーサイズn の時、全部で ( n -1 )/2 個のセットがある

1 (DC 実数) + 1 (n/2 実数) + 2(実数+虚数) * (n -1 ) /2  = n バイト

44100(Hz) /( 2 * 1024 ) =(約) 21.5 Hz 刻み

バイトを整数に変換してデバッグすると、0ー255までの値になっている。

i=0 .. 1024 { (mBytes[i] & 0xff) }

0 1 2 3 4 5 6 7 8 9 10
0 249 3 241 12 37 198 3 246 248 9
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1