Sunday, July 6, 2008

Blinkbeat

Here is another of my audio experiments, called Blinkbeat. It uses the Caps/Num/Scroll lock lights on your keyboard to blink along with the song you are playing! Click on the picture to see a video (Youtube):

The FFT is used to find the energy at different frequencies. What I display is kind of like a histogram of the frequencies.

I have also added a beat detection option, which is not finished but seems to do a decent job. For beat detection, I divide the song into short segments, and use the FFT to find the low-frequency energy in each segment. So, I now have another signal in time, which is the low-frequency-energy over time. Finally, I take a second FFT of this new signal, which is finding the frequencies in this signal. I estimate the rhythm of the song to be the peak in these results, and return the result in BPM.

Downloads

Windows binary

Check out the source at GitHub, downpoured.

Known issues: The normalization of lengths isn't perfect. If you try to play a long clip, the lights and the audio will eventually lose sync. Also, I draw the bars by changing the dimensions of several button controls :).

WaveAudio Developments

I've also been working on the WaveAudio sound library in C#. It's pretty nice to be able to write:

Sine note = new Sine(440.0);
WaveAudio wave = note.CreateAudio(1.0); //1 second
wave.Amplify(1.5);
AudioPlayer pl = new AudioPlayer();
pl.play(wave); // and now you hear it!
I spent a lot of time yesterday writing some really sweet code for synthesizing audio. By the end of the day I found out that what I had sounded a lot like the cheesy "choir" effect on old keyboards!! Still, this is pretty cool, and there are many more parameters to tweak. I'm owe thanks to Wikipedia and Wikibooks for giving me ideas.

I added an algorithm for autocorrelation pitch detection, which works pretty well. It can tell what pitch I'm singing, and works on various instruments as well.

No comments: