使用jupyter / matplotlib查找由呼吸音频(wav)生成的图形中的呼入和呼出次数

时间:2018-08-25 06:56:20

标签: python matplotlib graph jupyter

现在我有了呼吸男人的音频情节 (plot)

然后我将其通过FFT(傅立叶快速变换) (plot)

现在,我必须找到每分钟呼吸的次数

import matplotlib.pyplot as plt
import wavio
import numpy as np
from scipy.fftpack import fft, fftfreq
from IPython.display import display, HTML
import math
%matplotlib inline

rate, sampwidth, array = wavio.readwav('breath.wav')
data = array[:,0]
samples = data.shape[0]
plt.plot(data)
# here i have plot of audio

fft_out = fft(array)
fft_out = fft_out[:,0]
fftabs = np.abs(fft_out)
freqs = fftfreq(samples, 1 / rate)
plt.plot(freqs, fftabs)
# here i have fft plot

0 个答案:

没有答案