kuj0210 / Smart-mobile

for 2018 Creative Design project in Kumoh National Institute of Technology, department of computer engineering
4 stars 2 forks source link

음성 특징 추출 관련 & python 시연 code #43

Closed ras120 closed 6 years ago

ras120 commented 6 years ago

fft 디지털화 https://stackoverflow.com/questions/23377665/python-scipy-fft-wav-files 음원 샘플 추출 https://research.google.com/audioset/dataset/baby_cry_infant_cry.html

pitch or peak(최대, 최소값을 통한 편차를 구해 음성비교) 편차를 구해서 각 소리를 비교하는데 사용

babyCrySoundProcessing 주파수의 진폭 및 피크를 찾고 평균 진폭 값 외에 주파수의 평균 피크 값과 몇 개의 피크가 감지되는지 알아내어 울음 감지 그 외 다른 종류의 소리도 감지 가능 -> 울음소리 타입을 나눌 수도 있을 것. https://github.com/ericzhangle/babyCrySoundProcessing

aubio 라이브러리 - 사용법 미비 https://github.com/aubio/aubio

detect peak 돌려봐야댐 image image

http://nbviewer.jupyter.org/github/demotu/BMC/blob/master/notebooks/DetectPeaks.ipynb



mfcc(구간 별 음성 특징점 추출) 각 종 음성 구분에 가장 많이 쓰이는 특징점 특정 구간을 나누어, 각 구간의 스펙트럼을 분석하여 특징을 추출하는 기법 유사분야 많은 곳에서 사용(좋아서 그런지 이유모름) librosa라이브러리를 통해 mfcc를 간단히 추출

아기 울음측정(mfcc를 통한 측정을 통해 배고픔, 졸림 2가지 울음 비교 + 머신러닝) http://keunwoochoi.blogspot.kr/2016/01/blog-post.html baby_cry_detection (mfcc를 통한 아이울음소리 감지 -> 음악재생, 울음소리 타입을 구분하지는 않음) https://github.com/giulbia/baby_cry_detection



그 외 링크 wav에서 pitch https://github.com/thomasina-lee/wavepitch 코드 - 에러뜸 valueError: Window length M must be a non-negative integer https://github.com/tyrhus/pitch-detection-librosa-python/blob/master/script_final.py 알고리즘 http://access.feld.cvut.cz/view.php?cisloclanku=2009060001 mfcc에 대한 설명 http://www.speech.cs.cmu.edu/15-492/slides/03_mfcc.pdf aubio 사용법 관련 https://aubio.org/manual/latest/python_module.html#a-simple-example detect peak http://nbviewer.jupyter.org/github/demotu/BMC/blob/master/notebooks/DetectPeaks.ipynb

ras120 commented 6 years ago

음성 분석 python code - Kownby 기반으로 다르게 해본거 엄청 느림, 모든 주파수에 점찍음, 2초짜리 샘플로 시연함 그래프 출력 제외(맨밑 세줄) 시 속도 괜찮아 보임 (따로 측정 아직 안 함)

from future import print_function import matplotlib.pyplot as plt import scipy.io.wavfile as wavfile import scipy.fftpack import numpy as np from scipy.signal import argrelextrema from matplotlib.pyplot import *

fs_rate, signal = wavfile.read("0.wav") print ("Frequency sampling", fs_rate)

l_audio = len(signal.shape) print ("Channels", l_audio)

if l_audio == 2: signal = signal.sum(axis=1) / 2 N = signal.shape[0] print ("Complete Samplings N", N)

secs = N / float(fs_rate) print ("secs", secs)

Ts = 1.0/fs_rate # sampling interval in time print ("Timestep between samples Ts", Ts)

t = scipy.arange(0, secs, Ts) # time vector as scipy arange field / numpy.ndarray FFT = abs(scipy.fft(signal)) FFT_side = FFT[range(N//2)] # one side FFT range freqs = scipy.fftpack.fftfreq(signal.size, t[1]-t[0]) fft_freqs = np.array(freqs) freqs_side = freqs[range(N//2)] # one side frequency range fft_freqs_side = np.array(freqs_side)

x = np.array(signal) #signal, FFT, etc m = argrelextrema(x, np.greater) #greater, less y = [x[m] for i in m] plot(x) plot(m, y, 'rs') show()

image

네모부분 확대

image

어디 적당한 위쪽부분

image