user501861
user501861

Reputation: 51

Wav File As Frequency Image

I want to show a wav file as an image, so the frequency is charted on screen like you would see in a wav editor. Any ideas?

Upvotes: 1

Views: 2755

Answers (2)

stacker
stacker

Reputation: 68992

See Chapter 10 Page 379 in Swing Hacks for an example.

Note it doesn't display the frequencies in the signal. You probably want to draw the amplitude of an audio signal, as an wav-editor would do.

Upvotes: 0

AudioDroid
AudioDroid

Reputation: 2322

This is a rough answer, you have to investigate a little more with these keywords...First you need an FFT-function ( http://en.wikipedia.org/wiki/FFT ), I'd suggest you try to find a lib or source-code, no need to reinvent the wheel. Then you apply that FFT-function to a moving window. So:

  1. take n-samples from your wav-file
  2. converts them using the FFT-function,
  3. convert the fft-values to absolute values (that's the spectrum)
  4. moves on m-samples
  5. go back to 1.

In the end each window stands for a x-value (time), and the values of the spectrum represent the y-value (frequencies). That way you have your image.

I hope this is half-way understandable. It's hard to explain with just a few words. Good luck. :-)

Upvotes: 5

Related Questions