Python 에서 소리 데이터로 뭔가를 해보려 한다면 librosa 를 많이 쓰는듯 하다..
하지만 왠지 남들 따라하는거 같은 진 기분? 이라서.. scipy 를 쓰기로 했다.
scipy는 이전에도 이미지 데이터 다룰때도 써봐서 익숙한 기분이고 그냥 친숙했다.
from scipy.io import wavfile
from scipy.cignal import butter, lfilter
# 파일 읽기
sampleRate, data = wavfile.read(dataPath)
# bandpass
filteredData = buter(order, [low, high], btype='bandpass')
이렇게 선언하면 wave 파일을 읽어오고 low-pass, band-pass, high-pass 필터 를 쓸수 있다.
btype 에는 bandpass 외 에도 ‘lowpass’, ‘highpass’, ‘bandstop’ 들이 가능 하다.
아직은 이 정도 필터만 사용해도 될듯 한데.. 조금씩 더 알아가야지..
https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html
scipy.signal.butter — SciPy v1.9.3 Manual
Type of output: numerator/denominator (‘ba’), pole-zero (‘zpk’), or second-order sections (‘sos’). Default is ‘ba’ for backwards compatibility, but ‘sos’ should be used for general-purpose filtering.
docs.scipy.org
# 왜 이름이 butter 인가 궁금해서 찾아보니 butterworth 라는 이름의 필터가 있더라...
https://en.dict.naver.com/#/entry/enko/2d9430ff4e9b47e7bbf30b1c3f3134e4
네이버 영어사전
미국/영국식 발음, 여러 종류의 출판사 사전 뜻풀이, 풍부한 유의어/반의어, 대표사전 설정 기능, 상세검색 기능, 영어 단어장 제공
en.dict.naver.com