Python的:声音文件的频率分析 [英] Python: Frequency Analysis of Sound Files
本文介绍了Python的:声音文件的频率分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我生成,在具有一定的谐波数不同频率播放音调一些声音文件。结果
最终,这些声音将一个设备上的小喇叭播放。
I am generating some sound files that play tones at various frequencies with a certain number of harmonics.
Ultimately, these sounds will be played on a device with a small speaker.
我有扬声器的频率响应曲线,想要做以下的Python:
I have the frequency response curve of the speaker and want to do the following in Python:
- 画出声音文件的频谱。我需要把文件的FFT和
gnuplot的
绘制它 - 应用基于数据表的频率响应曲线的非线性传递函数。
- 在应用功能之后绘制的结果。
有谁知道:
- 什么最简单的方法这样做会是什么?
- 或应用(基于GNU / Linux),可以为我做到这一点?
- What the simplest way to do this would be?
- or of an Application (GNU/Linux based) that could do this for me?
推荐答案
我知道你没有提到Pylab / Matplotlib,但它的作品。这里是一个例子(假设单信道信号):
I know you didn't mention Pylab/Matplotlib, but it works. Here is an example (assumes single-channel signal):
x, fs, nbits = audiolab.wavread('schubert.wav')
audiolab.play(x, fs)
N = 4*fs # four seconds of audio
X = scipy.fft(x[:N])
Xdb = 20*scipy.log10(scipy.absolute(X))
f = scipy.linspace(0, fs, N, endpoint=False)
pylab.plot(f, Xdb)
pylab.xlim(0, 5000) # view up to 5 kHz
Y = X*H
y = scipy.real(scipy.ifft(Y))
这篇关于Python的:声音文件的频率分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文