2016/07/20

Realtime sound FFT analysis with microphone of iPhone

I was not able to use the accelerometer of iPhone as ‘input’ of VR apps. So I tried to use sound, for example, when you made a clap sound, a missile fired.

And I found one good webpage :
Capture iPhone microphone | Stefan Popp

With this page, I finally got each spectrum of sound from iPhone’s microphone.

Tone Generator

↑I downloaded this tone generator app to my iPad to check my code actually got correct frequency.

real time FFT result

↑I just moved the place of UIView object by the source sound ,where vertical axis is frequency (logarithm) and horizontal axis is spectrum.
According to this, my code might analyze sound correctly.


But… I was not able to find the proper way to compare sounds. If the app must recognize a clap sound, it should have got clap-sound spectrums. And the app must analyze and compare real time sound with the one got previously.
At first, I just found the total difference values of spectrum but failed because error was too large. I tried other ways but all failed.
So I gave up FFT analysis. I would just check sound level to recognize as ‘input’ … orz
Develop | Comments(0) | Trackback(0)
Comment

管理者のみに表示