开发者

Simple music visualizer

I understand the general concepts for this, but I am very new to java graphics programming.

The idea is:

1. Get byte data from a song and store in a byte array.

2. Take a small chunk of byte data, perform FFT, and get some sort of useful data (different things you can do once FFT is performed).

3. Feed that processed data to a graphics function that will somehow use it for whatever visualization is active.

I'm having a hard time on figuring out how to do 2 and 3 in real time. I want the data processed, the song played, and the processed d开发者_C百科ata influencing the graphics function currently drawing all at the same time. I understand how to do these things separately, but I can't quite figure out how to put it all together.


Fourier transforms cannot be performed in real time (not even the Fast Fourier variety). You have to be able to "lead" the music source by reading ahead to generate the frequency histogram. You also need a sample of some nonzero length to analyze. To make it look realtime, your analyzer might grab samples of, say, a half second, ten times a second (so there is significant overlap), compute a FFT on each, then show the difference between a sample beginning at the current point in the music and the very next one (which will show the strength of frequencies occurring only during the 10th of a second while still having enough signal to perform a meaningful analysis).

Yes, you'll need threads. Quite a few.


..I understand how to do these things separately, but I can't quite figure out how to put it all together.

Threads.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜