1. LPC (Linear Predictive Coding) 란 무엇인가?

잘 알려져있고 가장 강력한 speech analysis technique 중 하나로 discrete-time speech production model의 parameter들을 추정하거나 낮은 bit rate으로 speech를 representing하여 전송 혹은 저장하는데 사용됩니다.

 

이름(linear predictive coding)에서 알 수 있듯이 본래는 speech processing 분야에서 speech coding application에 사용되었다가 지금은 일반적으로 linear predictive analysis technique들을 말하는데 쓰입니다.

2. LPC를 사용하는 이유

1) Speech Production Model

speech production과정을 아래와 같이 excitation과 vocal tract을 통과하는 과정으로 나누어 나타내줄 수 있습니다. 이때, vocal tract의 formants (공명주파수)에 따라 발생하는 음성 신호가 달라지게 됩니다.

그래서 만약 우리가 이 vocal tract을 digital filter로 나타내고, 이 digital filter의 parameter에 따라 formants가 달라지는 것을 반영하면 말소리를 흉내낼 수 있게 됩니다.

 

 

 

 

 

음성신호의 생성 과정은 아래의 Speech production model (Source filter model)로 나타냅니다. 그러면 voiced speech signal 와 unvoiced speech signal 과 각각의 vocal tract impulse response는 아래와 같이 식으로 표현해줄 수 있습니다.

 

[voiced speech]

signal : $s[n]=p[n] * h_V[n]$

impulse response : $h_V[n]=A_V \cdot g[n] * v[n] * r[n]$

 

[unvoiced speech]

signal : $s[n]=u[n] * h_U[n]$

impulse response : $h_U[n]=A_U \cdot v[n] * r[n]$

 

위의 식을 통해서 각각의 component signal들이 convolution되어 최종적으로 음성신호로 출력되는 것을 알 수 있습니다.

 

1. Homomorphic system

Homomorphic system은 우리가 자주 들어본 LTI system에서의 linearity 성질(principle of superposition)을 일반화 시킨 시스템입니다. 기존의 LTI system은 input으로 두 가지 signal이 addition된 형태가 들어오면 output 역시 각 signal의 output의 addition을 출력해주는 특성을 가지고 있습니다.

Homomorphic system의 경우에는 이 superposition 특성을 일반화하여서 input으로 두 가지 signal이 convolution된 형태가 들어오면 output 역시 각 signal의 output의 convolution을 출력해주는 특성을 갖는 시스템을 말합니다.

LTI system와 Homomorphic system

이 Homomorphic system의 중요한 특징이 바로 3개의 homomorphic system을 casecade의 형태로 합쳐 아래의 그림처럼 표현을 할 수 있다는 점입니다. 이때 $\mathcal{D}_*\{ \cdot \}$은 characteristic system으로 convolution → addition 형태로 출력해주는 시스템이고, 그 inverse system같은 경우에는 반대로 addition → convolution의 형태로 바꿔주는 특성을 가지고 있습니다. 즉 characteristic system에 convolutioned input을 넣어주면 signal의 component들을 addition한 non-linearity한 convoltion 연산을 linearity 연산으로 바꿔줍니다..!!!

 

Homomorphic deconvolution의 casecade form

그런데 speech signal은 각 component들의 convolution된 signal이니까, 이 characteristic system을 이용하면 신호의 각 성분들을 decompose할 수 있게 되는 것입니다. 이때 charateristic system의 output은 complex cepstrum의 합입니다.

2. Cepstrum

Cepstrum은 time-domain에서 frequency-domain으로 변환을 해준 것처럼 frequency-domain에서 time-domain으로의 변환도 가능하다는 것을 보여주기 위해 도입된 개념입니다.

 

Cepsturm은 아래의 식과 같이 spectrum의 log magnitude를 취한 후 Inverse Fourier Transform을 해주어 구합니다. 그리고 이때 magnitude를 취하지 않고 spectrum의 magnitude만 취한 후 Inverse Fourier Transform을 해주어 구한 것은 complex cepsturm이라고 합니다.

 

[cepstrum]

$c[n]=\frac{1}{2 \pi} \int_{-\pi}^\pi \log \left|X\left(e^{j \omega}\right)\right| e^{j \omega n} d \omega$

[complex cepstrum]

$\hat{x}[n]=\frac{1}{2 \pi} \int_\pi^\pi \log \left\{X\left(e^{j \omega}\right)\right\} e^{j \omega n} d \omega$

 

3. Homomorphic Analysis

그럼 실제로 homomorphic system을 이용해 voiced sound를 decompose하는 예를 보도록 하겠습니다.

voiced sound의 component들이 아래와 같은 신호가 있다고 할 때, 우리는 signal과 complex cepstrum을 다음의 식으로 나타낼 수 있습니다.

\begin{aligned} & s[n]=h_V[n] * p[n]=A_V g[n] * v[n] * r[n] * p[n] \\ & \hat{s}[n]=\hat{h}_V[n]+\hat{p}[n]=\log \left|A_V\right| \delta[n]+\hat{g}[n]+\hat{v}[n]+\hat{r}[n]+\hat{p}[n]\end{aligned}

Time-domain representation of speech model for a voiced sound /AE/

그러면 각각의 component들의 complex cepstrum을 addition하면 기존의 신호의 complex cepstrum을 나타낼 수 있습니다. 그럼 addition된 결과물에서 각각의 component의 특성이 잘 보이니까 음성신호 분석에 사용이 가능하다는 것이겠죠? 아래는 각각의 component들의 complex cepstrum입니다.

보시면 아실 수 있듯이 각자 특징이 보입니다. 그렇기 때문에 원래의 synthetic speech의 complex cepstrum을 보았을 때, 각각의 component들의 특징을 알아볼 수 있습니다. 이때 이 포스트에서는 다루진 않았지만, 각각의 component들이 모두 maximum/minimum phase signal이기 때문에 cepstrum은 아래의 오른쪽 그림과 같이 complex cepstrum의 even part로 나타납니다. (이 내용은 길어질 것 같아 따로 포스팅으로 하도록 하겠습니다.)

STFT는 특정 짧은 시간 구간을 windowing을 통해 추출해내고 해당 구간 동안에 DFT를 하여 연산을 수행한다.

이때 windowing은 signal을 window와 time domain에서 multiplication을 시키는 과정이다. time domain에서의 multiplication 연산은 frequency domain에서는 convolution 연산과 같다.

여기서 time resolution과 frequency resolution의 관계에 대해 생각해볼 수 있다.

window의 크기를 작게하면 우리는 시간축에 대해 세밀한 분석을 수행해줄 수 있지만, 주파수축에서는 convolution을 수행하는 band가 넓어지게 된다(wide band). 그러면 주파수축에 대해서는 오히려 resolution(분해능)이 떨어지게 된다.

 

예를 들어 아래와 같은 narrow band와 wide band가 있다고 가정을 해보자.

0

위에서의 해당 시간에 대한 신호의 frequency response가 아래와 같을 때,

time domain에서 window를 수행한 결과(왼)와 해당 signal의 frequency response

narrow band와 wide band에 대한 convolution 연산 결과는 다음과 같이 나타나게 된다.

대충 그려서 그림이 부정확할 수 있어요....

즉 narrow band를 사용하면 frequency domain에서 각 frequency 에 대한 정보를 세밀하게 살릴 수 있게 된다.

 

아래는 실제 STFT 결과이다. 아래에서도  wide band를 사용했을 때는 time resolution이 좋고, frequency resolution이 떨어져 세로선의 형태가 나타나는 것을 확인할 수 있다. 반대로 narrow band를 사용했을 때는 time resolution이 떨어지고 frequency resolution이 좋아져 가로선의 형태가 나타나는 것을 확인할 수 있다.

Wide band
Narrow band

1.time responses

1) Rectangular window

frame length=21

2) Hamming window

frame length=21

2. Frequency Response (frame length = 51)

  Rectangular window Hamming window
 
cutoff
frequency
$$2\pi/L = 196Hz$$ $$4\pi/L = 392Hz$$  

Attenuation > 14 dB > 40 dB 

 

같은 fram length를 가질 때, Hamming window의 cutoff frequency가 Rectangular window의 cutoff frequency의 두배이다. 즉 Hamming window(wide band)를 사용해 얻은 결과는 Rectangular window(narrow band)를 사용했을 때보다 frequency resolution이 떨어진다. (Rectangular window는 hamming window에 비해 freqeucncy resolution이 좋음)

 

하지만 Attenuation 같은 경우에는, Hamming window가 더 강하기 때문에 lobe가 약하게 나타난다. 그렇기 때문에 Rectangular window보다는 Hamming window를 사용했을 때, frequency band 외의 frequency가 연산에 개입이 적게 되기 때문에 error가 비교적 적다. (attenuation이 아주 강해서 lobe가 없는 경우가 noise가 없는 이상적인 상황)

 

즉, Rectangular window를 사용하면 frequency resolution이 좋다는 장점을 챙길 수 있으나 연산 과정에서 발생하게 되는  noise가 비교적 크고, Hamming window를 사용하면 frequency resolution은 떨어질 수 있으나 noise가 적다는 이점을 가진다.

+ Recent posts