I have for over a year now tried to figure out both the electronic aspect and the software aspect of my project.
I have somewhat successfully managed to make the overall idea to work, the bumps I have come along the way are quite frankly stressing me out.
Project description and goal:
Basically a beat-detection device with a very small formfactor.
I am using an Arduino Uno as a prototyping device, but I have an Arduino Mega, Sparkfun Micro and several other development boards it stock to use if needed.
I want the microcontroller to read analog audio, convert it to FFT or FHT or any other easily translated data, read the lower frequencies where the Kick of the music is presented, and finally measure the timing between each kick to calculate the BPM of the song.
The frequency range of where the Kick in the music is present is around the 45Hz to 55Hz range and is most distinguishable in that area when looking at it in a spectrum analyzer.
This should also be correct when doing FFT/FHT with a microcontroller due to the nature of raw analog to digital to FFT/FHT conversion.
However, it may differ and is most likely to differ if a microphone is used to listen to the audio.
What I have successfully accomplished:
- Assembling a circuit which allows for audio to be injected to an analog input of the arduino. The circuit can be found here:
(source: interface.khm.de)
- Implementing Open Music Labs FHT library to convert the analog audio to a frequency spectrum. The library can be found here: http://wiki.openmusiclabs.com/wiki/ArduinoFHT
So the two most important components of the project is in place.
What I have problems with:
- I get a constant peak in the lower frequency area of the spectrum which is present at all times. This is a problem because the Kick of the music is in that area.
Things I have tried:
- A guy on youtube tried to help me out by giving me simple instructions and he told me to use a 1uF capacitor between the Audio Surce and the Analog input, as well as trying either a pull-up or a pull-down resistor on the Analog Input.
Results (quote):
When using a pull-up, the low freq peak increases, when using a pull-down, the low freq disappears.
So the Pull-down is the way to go.
HOWEVER, with the pull-down present, harmonics of the sinus tone is introduced but no peak at the lower freq area as long as no sound is present.
With the pull-down NOT present, the harmonics vanish, but the peak is present.
- Implementing FIR and IIR filters. Results: Audio still reacting to all frequencies.
What more can I try before I throw this project out the window?
Approaches and suggestions need to be component-limited and preferably software oriented.
The light organ needs to have low power consumption and very few physical components, and if physical components are required, they need to be tiny and surface mounted.