Write some voice analysis programs created in the experiment.
The voice data of 30 tapping sounds was used for 1 minute. Sampling frequency: 48 kHz Bit size: 24 bit
FFT It's the same program I posted the other day.
FFT.py
print("===== Wave2FFT_lim =====")
F = np.fft.fft(self.data)
Amp = np.abs(F/(self.frames/2))
Amp_tmp = np.abs(F/(self.frames/2))
Amp_new = Amp / Amp_tmp.max()
freq = np.fft.fftfreq(self.frames, 1/self.Fs)
fig = plt.figure()
plt.plot(freq[1:int(self.frames/2)],Amp_new[1:int(self.frames/2)])
plt.xlabel("Freq [Hz]")
plt.ylabel("Amp")
plt.title("FFT")
plt.ylim(0, 1)
fig.savefig("{}/FFT(Normalization).png ".format(self.Folder))
plt.show()
plt.close()
Execution result It stands up in a specific cycle with a good feeling. Also, this time, it is normalized to see if there is a reaction.
spectrogram.py
print("===== Wave2Spec =====")
fig = plt.figure()
pxx, freq, bins, t = plt.specgram(self.data[:,0], Fs = self.Fs)
plt.title("spec")
plt.xlabel("time [sec]")
plt.ylabel("Freq [Hz]")
fig.savefig("{}/Spec.png ".format(self.Folder))
plt.show()
plt.close()
Execution result Vertical stripes can be seen faintly between 0 and 25000Hz, but it is important because the low frequency band is a little darker.
STFT
STFT.py
print("===== Wave2STFT =====")
pylab.figure()
f, t, stft = sp.stft(self.data[:,0],fs=self.Fs)
plt.pcolormesh(t, f, np.abs(stft),cmap='hot')
pylab.title("STFT")
plt.xlabel("time [sec]")
plt.ylabel("Freq [Hz]")
pylab.savefig("{}/STFT.png ".format(self.Folder))
pylab.show()
Execution result I tried to make it with interest, but I think that the important part is extracted from the spectrogram. Also, I cannot deny the feeling of lack of study, so I would like to learn what this result shows.
I did some voice analysis this time, and all of them were visually easy to understand and could be used in research.
Recommended Posts