!pip install librosa soundfile
import librosa
import soundfile as sf
librosa.effects.split(y, top_db=60, ref=<function amax>, frame_length=2048, hop_length=512, aggregate=<function amax>)
활용처: 오디오에서 무음을 제거하고자 할 때
(1) y: np.ndarray
ㄴ librosa.load() 함수를 통해 로드된 1D 배열(오디오 신호)
ㄴ audiosignal, = librosa.load('audio.wav')
ㄴ librosa.effects.split(audio_signal, top_db=30)
(2) top_db: number > 0
ㄴ input 오디오에서 무음으로 간주할 decibels 기준
ㄴ 예, {top_db=30}은 input 오디오 신호의 최고점(peak amplitude) 보다 30dB 이하로 낮은 구간을 무음으로 간주
ㄴ 즉, 무음 = 최고점에서 top_db 만큼 차이나는 구간
ㄴ 예, input 오디오 신호의 최고점이 -10dB이고, top_db가 30이면, -45(-10-30)dB 이하가 무음
ㄴ input 오디오 신호의 최고점과의 상대적 차이를 나타냄
(3) ref: number or callable
ㄴ input 오디오 신호에서 무음 판단 기준으로 사용할 진폭의 참조값(진폭 비교를 위한 기준값)
(4)frame_length: int > 0
ㄴ 오디오 분석 시 사용할 프레임의 길이(길수록 정확한 분석 가능)
(5)hop_length: int > 0
ㄴ 한 프레임에서 다음 프레임으로 이동할 때 얼마만큼의 샘플을 건너뛸지 지정(값이 작을 수록 세밀한 분석 가능)
(6)aggregate: callable [default: np.max]
ㄴ non-silent 구간 계산 방식 지정
non-silent 구간의 start, end를 나타내는 2D 배열
>>> [[ 34816 42496]
[ 45568 47616]
.
.
[ 48640 54272]]