Voice analysis with python

Voice analysis

Write some voice analysis programs created in the experiment.

Experimental audio data

The voice data of 30 tapping sounds was used for 1 minute. Sampling frequency: 48 kHz Bit size: 24 bit image.png

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. image.png

spectrogram

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. image.png

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. image.png

Summary

I did some voice analysis this time, and all of them were visually easy to understand and could be used in research.

Recommended Posts

Voice analysis with python
Voice analysis with python
Data analysis with python 2
Data analysis with Python
[Python] Morphological analysis with MeCab
[Co-occurrence analysis] Easy co-occurrence analysis with Python! [Python]
Sentiment analysis with Python (word2vec)
Planar skeleton analysis with Python
Japanese morphological analysis with Python
Muscle jerk analysis with Python
3D skeleton structure analysis with Python
Impedance analysis (EIS) with python [impedance.py]
Text mining with Python ① Morphological analysis
Data analysis starting with python (data visualization 1)
Logistic regression analysis Self-made with python
Data analysis starting with python (data visualization 2)
Let's analyze voice with Python # 1 FFT
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
Data analysis python
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
Bingo with python
Zundokokiyoshi with python
Excel with Python
Microcomputer with Python
Cast with python
Marketing analysis with Python ① Customer analysis (decyl analysis, RFM analysis)
Two-dimensional saturated-unsaturated osmotic flow analysis with Python
Machine learning with python (2) Simple regression analysis
2D FEM stress analysis program with Python
[Voice analysis] Find Cross Similarity with Librosa
Let's make a voice slowly with Python
Tweet analysis with Python, Mecab and CaboCha
Principal component analysis with Power BI + Python
Data analysis starting with python (data preprocessing-machine learning)
Two-dimensional unsteady heat conduction analysis with Python
Python: Simplified morphological analysis with regular expressions
Serial communication with Python
Zip, unzip with python
Django 1.11 started with Python3.6
Primality test with Python
Python with eclipse + PyDev.
Socket communication with Python
Scraping with Python (preparation)
Learning Python with ChemTHEATER 03
Sequential search with Python
Run Python with VBA
Handling yaml with python
Solve AtCoder 167 with python
Serial communication with python
[Python] Use JSON with Python
Basket analysis with Spark (1)