Wav文件作为频率图像 [英] Wav File As Frequency Image
问题描述
我想将wav文件显示为图像,因此频率显示在屏幕上,就像在wav编辑器中看到的一样.有什么想法吗?
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?
推荐答案
这是一个粗略的答案,您必须使用这些关键字进行更多的研究...首先,您需要一个 FFT函数 ( http://en.wikipedia.org/wiki/FFT ),我建议你尝试找到一个lib或源代码,无需重新发明轮子.然后,将该FFT功能应用于移动窗口.所以:
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:
- 从wav文件中获取n个样本
- 使用FFT函数对其进行转换
- 将fft值转换为绝对值(即频谱)
- 移动m个样本
- 回到1.
- take n-samples from your wav-file
- converts them using the FFT-function,
- convert the fft-values to absolute values (that's the spectrum)
- moves on m-samples
- go back to 1.
最后,每个窗口代表一个x值(时间),光谱值代表y值(频率).这样,您就可以拥有自己的形象.
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. :-)
这篇关于Wav文件作为频率图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!