Close

Fast Fournier Transforms (FFT) on the Raspberry Pi

A project log for 3D Haptic Vest for Visually Impaired and Gamers

This project's goal was to make a vest that a visually impaired or gamer could use when moving around in their environment(real or virtual).

Sean BensonSean Benson 09/29/2014 at 00:380 Comments

To run FFT on the Raspberry Pi I downloaded and modified the FFT Program. This allowed me to run real-time FFT. In that code they put down 2^11 as the minimum chunk (a piece of audio) size over the regular 44,100 Hz audio setting. Originally I used 2^13 for the real-time FFT because it worked on the Pi. In order to speed up the process so that the motors would react instantaneously to the noise I lowered the setting from 2^11 to 2^8 with a rate of 14,400 Hz. In order to lower the rate of audio sampling for playing the Call of Duty game I used a USB microphone instead of using a male-male adapter for the microphone slot in the USB sound card. The other one of the male-to-male adapters connects to the audio output of the Xbox.

Lowering the Hz to 14,400 and the chunk size to 2^8 enables the Pi to handle the FFT computations which intern increases the speed proportionally from 5 times to 56 times each second. I was shocked that I was able to get this far with the processing power of the Raspberry Pi. In the process of making the program faster I send out 4 control bytes and a 2-character return byte for each FFT iteration to control the vest. This program takes up about 60% of the computational power of the Raspberry pi excluding the GPU  while still running the python program with c libraries. I was also shocked when I found that out. So in the future I will be making a better pattern recognition program and will hopefully remove the parallax propeller from the equation to have only one main microcontroller running the whole process. I also wrote code for running the vest at different frequencies so that anyone can use it for different games by changing the settings of the code a little. The Raspberry Pi required extra libraries PyAudio, PySerial, NumPy to run the code. This gamer vest is so fun! 

Discussions