你好,我是 python 新手,也有声音信号分析。我正在尝试获取出生歌曲(斑胸草雀)的信封。它的信号波动非常快,我尝试了不同的方法。例如,我尝试根据我发现的其他示例使用以下代码绘制信号并获取包络(我在代码上添加了注释以理解它):
#Import the libraries
from pylab import *
import numpy
import scipy.signal.signaltools as sigtool
import scipy, pylab
from scipy.io import wavfile
import wave, struct
import scipy.signal as signal
#Open the txt file and read the wave file (also save it as txt file)
f_out = open('mike_1_44100_.txt', 'w')
w = scipy.io.wavfile.read("mike_1_44100_.wav") #here your sound file
a=w[1]
f_out.write('#time #z' + '\n')
#I print to check
print 'vector w'
print w[0],w[1]
print w
i=w[1].size
p=numpy.arange(i)*0.0000226 #to properly define the time signal …Run Code Online (Sandbox Code Playgroud)