음성

Module 3 - Frequency domain

김아다만티움 2023. 8. 24. 15:29

 Speech Processing>Module 3>Digital Speech Signals>Videos>Frequency domain

https://speech.zone/courses/speech-processing/module-3-digital-speech-signals/videos-2/frequency-domain/

 

Frequency domain

 

speech.zone

 

푸리에 분석의 핵심 기능은 이미 알고 계시겠지만, 위상(phase)이라는 세부 사항에 대해서는 간략히 설명했습니다.
이제 푸리에 분석을 사용하여 시간 영역 신호를 스펙트럼(더 정확하게는 앞으로 보게 될 크기 스펙트럼)으로 변환하는 방법에 대해 더 명확히 설명하겠습니다.
이제부터는 이것을 푸리에 변환이라고 부르겠습니다.
시간 영역 신호를 가져옵니다.
이를 짧은 분석 프레임으로 나눕니다.
각각의 분석 프레임에 대해 series expansion을 수행합니다.
일련의 기저 함수(basis function)는 주파수가 증가하는 사인파로 구성됩니다.
이것이 푸리에 분석이며 이제 주파수 영역으로 이동합니다.
일반적인 경우, 우리는 각 기저 함수의 크기뿐만 아니라 위상(phase)이라는 것에 대해서도 걱정해야 합니다.
이 예시를 살펴보겠습니다.
왼쪽의 파형을 보세요.
오른쪽의 기저 함수를 보세요.
작동할 수 있는 계수 집합을 생각해낼 수 있는지 살펴보세요.
모든 기저 함수가 0시점에서 0이기 때문에 당연히 불가능합니다.
우리는 0시에 0이 아닌 값을 만들려고 하는데, 이 세상에 그런 값을 줄 수 있는 가중치는 없습니다.
따라서 여기에는 뭔가 빠진 것이 있습니다.
이 다이어그램은 현재 참이 아니지만 오른쪽의 기저 함수의 위상을 바꾸기만 하면 매우 쉽게 참이 될 수 있습니다.
이제 다이어그램이 참입니다!

위상은 단순히 파형이 시작되는 주기의 한 지점입니다.
다른 방법으로 생각하면 기저 함수를 시간에 따라 좌우로 밀 수 있다는 것입니다.
따라서 푸리에 분석을 수행할 때는 각 기저함수의 크기만 계산할 것이 아니라 위상도 계산해야 합니다.
하지만 위상이 중요할까요?
위상이 무슨 의미일까요?
위상은 어디에 유용할까요?
여기서는 네 개의 사인파와 이 계수 세트를 합산하여 말과 같은 파형을 만들었습니다.
오른쪽에 한 주기가 있습니다.
이 신호의 더 긴 부분을 재생해 보겠습니다.
좋아요, 분명히 실제 음성은 아닙니다!
방금 이 사인파와 계수를 더해서 만든 것이니까요.
하지만 음성의 몇 가지 필수 속성을 가지고 있습니다.
예를 들어, 지각할 수 있는 음높이가 있고 순수한 톤이 아닙니다.
동일한 계수 세트를 사용하되 기저 함수의 위상을 바꾸려고 합니다.
따라서 정확히 동일한 기저 함수가 주기의 다른 지점에서 시작될 뿐입니다.
이제 결과 신호는 원래 신호와 매우 다르게 보입니다.
소리가 달라질 것 같나요?
글쎄요, 알아봅시다.
아니요, 제게는 똑같이 들립니다.
우리의 청각은 이 위상차에 민감하지 않습니다.
따라서 당분간은 위상이 특별히 흥미롭지 않다고 말할 것입니다.
우리의 음성 분석은 크기(magnitute)만 신경 쓰면 됩니다.
다시 말해, 이 부분이 중요한 부분입니다.
이러한 위상, 즉 파형이 사이클에서 정확히 어디에서 시작되는지는 훨씬 덜 중요합니다.
사실, 이제부터는 위상은 무시하겠습니다.
이 계수(coefficients)만 플롯하면 스펙트럼을 얻을 수 있으며, 이것이 제가 여기서 한 작업입니다.
왼쪽은 원래 신호와 그 크기 스펙트럼입니다.
오른쪽은 위상은 다르지만 크기는 동일한 신호로, 크기 스펙트럼은 동일합니다.
흔히 이를 스펙트럼이라고 부르지만, 위상 정보를 버렸다는 것을 명확히 하기 위해 항상 '크기 스펙트럼'이라고 말하는 것이 더 정확합니다.
이 그림에서 배울 수 있는 또 다른 중요한 점은 시간 영역에서는 두 신호가 매우 다르게 보일 수 있지만 크기 스펙트럼 영역에서는 동일하다는 것입니다.
이는 시간 영역이 음성 신호를 분석하는 데 가장 적합한 방법이 아닐 수 있다는 것을 의미합니다.
진폭 스펙트럼이 적합한 곳입니다.
음성의 주파수별 에너지 양은 매우 다양하고 범위가 매우 넓기 때문에 일반적으로 크기 스펙트럼의 세로축은 로그 스케일로 표시되며 데시벨 단위로 표시됩니다.
이것은 로그 스케일입니다.
하지만 파형과 마찬가지로 보정되지 않은 상태이므로 예를 들어 마이크가 얼마나 민감한지 알 수 없습니다.
절대값이 아니라 각 주파수에서 상대적인 에너지 양에 관한 것이기 때문에 크게 중요하지 않습니다.

잠시 기본 사인파로 돌아가 보겠습니다.
기본 사인파는 분석 프레임에 맞는 한 주기로 가능한 가장 낮은 주파수에서 시작하여 가능한 가장 높은 주파수인 나이퀴스트 주파수까지 올라갑니다.
간격은 동일하며 간격은 가장 낮은 주파수와 동일합니다.여기서는 100Hz입니다.분석 프레임이 1/100초이기 때문에 100Hz입니다.
그렇다면 분석 프레임을 더 길게 만들면 어떻게 될까요? 
100분의 1초보다 긴 음성 구간을 분석한다고 가정해 봅시다.기저 함수 집합에 어떤 일이 일어날지 생각해 보세요.동영상을 일시 정지합니다.분석 창이 더 길어지면 정확히 한 주기로 들어맞는 최저 주파수의 사인파가 더 낮은 주파수에 있으므로 이 주파수는 더 낮아질 것입니다.
우리는 계열이 해당 주파수에서 동일한 간격을 가지므로 모두 더 낮아지고 간격이 더 가까워질 것이라는 것을 알고 있습니다.
그러나 가장 높은 주파수는 항상 나이퀴스트 주파수에 있다는 것도 알고 있습니다.
따라서 가장 낮은 주파수의 기저 함수가 더 낮은 주파수이고 간격이 더 가깝다면, 나이퀴스트 주파수까지 범위에 맞는 기저 함수가 더 많아집니다.분석 프레임이 길수록 기저 함수가 많아집니다.

실제로 작동하는 것을 보면 이해하기가 더 쉬울 것입니다.
여기에는 비교적 짧은 분석 프레임이 있고 오른쪽에는 푸리에 변환을 사용하여 자동으로 계산된 크기 스펙트럼이 표시됩니다.
분석 프레임이 커지면 어떤 일이 일어나는지 보겠습니다.
크기 스펙트럼에 좀 더 자세한 내용이 표시되는 것을 볼 수 있나요?조금 더 나가보면 더 많은 디테일이 나타납니다.
사실 디테일이 너무 많아서 지금은 제대로 볼 수 없습니다.
그래서 제가 할 일은 실제로 주파수 축의 일부, 즉 확대된 부분을 보여드리는 것입니다.
스펙트럼은 여전히 나이퀴스트 주파수까지 올라가지 만 더 자세히 볼 수 있도록 그 아래쪽 부분 만 보여 드리겠습니다.
매우 짧은 분석 프레임과 그 크기 스펙트럼이 있습니다.
조금 축소하면 크기 스펙트럼에 좀 더 자세한 내용이 나타납니다.
분석 프레임을 더 길게 만들면 크기 스펙트럼에서 훨씬 더 자세한 정보를 얻을 수 있습니다.
따라서 분석 프레임이 길어지면 더 많은 구성 요소(더 많은 기저 함수)가 추가되므로 계수도 더 많아집니다.
계수는 주파수 축을 따라 나이퀴스트 주파수까지 균등하게 배치되어 있으므로 분석 프레임을 길게 만들면 계수가 서로 더 가까워져 크기 스펙트럼에서 점점 더 많은 세부 정보를 볼 수 있다는 점을 기억하세요.
더 많은 신호를 분석하면 스펙트럼에서 더 많은 세부 정보를 얻을 수 있습니다.

이것은 좋은 일처럼 들리지만, 물론 이 스펙트럼은 전체 분석 프레임에 대한 것입니다.
사실상 프레임 내 신호의 평균 구성입니다.따라서 분석 프레임이 클수록 분석이 적용되는 시간대를 정확하게 파악할 수 없으므로 시간 분해능력이 낮아집니다.
따라서 장단점이 있습니다.
모든 엔지니어링이 그렇듯이, 우리는 선택을 해야 합니다.
분석의 목적에 맞게 분석 프레임을 선택해야 합니다. 이것은 설계 결정입니다.
다음 단계는 주파수 영역에서 음성 신호의 주기성에 대한 증거인 harmonics를 찾는 것입니다.
하지만 아직 성대가 음원에 어떤 영향을 미치는지에 대해 생각하지 않았기 때문에 이는 절반의 이야기일 뿐입니다.
이에 대한 첫 번째 단서는 spectral envelope에서 찾을 수 있습니다.
따라서 주파수 영역에서 두 가지 다른 속성을 살펴보겠습니다.
하나는 spectral envelope이고 다른 하나는 harmonics이며, 이 두 가지 속성을 크기 스펙트럼에서 함께 볼 수 있습니다.

 

You already know the essential features of Fourier analysis, but we've glossed over a little detail called phase.
So we need to now clarify that, as well as then using Fourier analysis to transform any time domain signal into its spectrum: more correctly, its magnitude spectrum as we're going to see.
From now on will be calling this the Fourier transform.
We take a time domain signal.
We break it into short analysis frames.
On each of those, we perform a series expansion.
The series of basis functions are made of sine waves of increasing frequency.
That is Fourier analysis and that gets us now into the frequency domain.
In the general case, we need to worry not just about the magnitude of each of the basis functions, but also something called phase.
Consider this example here.
Look at the waveform on the left.
Look at the basis functions on the right.
See if you can come up with a set of coefficients that would work.
Well, fairly obviously you cannot, because all the basis functions are zero at time zero.
We're trying to construct a non-zero value at time zero, and there are no weights in the world that will give us that.
So there's something missing here.
This diagram is currently untrue, but I can make it true very easily by just shifting the phase of the basis function on the right.
Now the diagram is true!
Phase is simply the point in the cycle where the waveform starts.
Another way to think about it is that we can slide the basis functions left and right in time.
So when we are performing Fourier analysis, we don't just need to calculate the magnitude of each of the basis functions, but also their phase.
But does phase matter?
I mean, what does phase mean?
Is it useful for anything?
Here I've summed together four sine waves with this set of coefficients to make a waveform that speech-like.
There's one period of it on the right.
I'm going to play you a longer section of that signal.
OK, it's obviously not real speech!
I mean, I just made it by adding together these sine waves with those coefficients.
But it's got some of the essential properties of speech.
For example, it's got a perceptible pitch, and it's not a pure tone.
I'm going to use the same set of coefficients, but I'm going to change the phases of the basis functions.
So, exactly the same basis functions, they just start at different points in their cycle.
The resulting signal now looks very different to the original signal.
Do you think it's going to sound different?
Well, let's find out.
No, it sounds exactly the same to me.
Our hearing is simply not sensitive to this phase difference.
So for the time being, we're just going to say that phase is not particularly interesting.
Our analysis of speech will only need to worry about the magnitudes.
In other words, these are the important parts.
These phases - exactly where these waveforms start in their cycle - is a lot less important.
In fact, we're just going to neglect the phase from now on.
If we plot just those coefficients, we get the spectrum, and that's what I've done here.
On the left is the original signal, and its magnitude spectrum.
On the right is the signal with different phases, but the same magnitudes: its magnitude spectrum is identical.
We'll very often hear this called the spectrum, but more correctly we should always say the 'magnitude spectrum' to make it clear that we've discarded the phase information.
Something else that's very important that we can learn from this picture is that in the time domain two signals might look very different, but in the magnitude spectrum domain, they're the same.
Now that's telling us that the time domain might not be the best way to analyse speech signals.
The magnitude spectrum is the right place.
Because the amount of energy at different frequencies in speech can vary a lot - it's got a very wide range - the vertical axis of a magnitude spectrum is normally written on a log scale and we give it units of decibels.
This is a logarithmic scale.
But like the waveform, it's uncalibrated because, for example, we don't know how sensitive the microphone was.
It doesn't really matter because it's all about the relative amount of energy at each frequency, not the absolute value.
Back to the basis sine waves for a moment.
They start from the lowest possible frequency, with just one cycle fitting the analysis frame, and they go all the way up to the highest possible frequency, which is the Nyquist frequency.
They're spaced equally and the spacing is equal to the lowest frequency.
Here it's 100 Hz.
It's 100 Hz because the analysis frame is 1/100th of a second.
So what happens if we make the analysis frame longer?
Imagine we analyse a longer section of speech than 1/100th of a second.
Have a think about what happens to the set of basis functions.
Pause the video.
Well, if we've got a longer analysis window, that means that the lowest frequency sine wave that fits into it with exactly one cycle will be at a lower frequency, so this frequency will be lower.
We know that the series are equally spaced at that frequency, so they'll all go lower and they'll be more closely spaced.
But we also know that the highest frequency one is always at the Nyquist frequency.
So if the lowest frequency basis function is of a lower frequency and they're more closely spaced, then we'll just have more basis functions fitting into the range up to the Nyquist frequency.
A longer analysis frame means more basis functions.
This will be easier to understand if we see it working in practise.
Here I've got a relatively short analysis frame and on the right, I'm showing its magnitude spectrum: that's calculated automatically with the Fourier transform.
Let's see what happens as the analysis frame gets larger.
Can you see how a bit more detail appeared in the magnitude spectrum?
Let's go out some more, and even more detail appeared.
In fact there's so much detail, we can't really see it now.
So what I'm going to do is I'm actually going to just show you a part of the frequency axis: a zoomed-in part.
The spectrum still goes up to the Nyquist frequency, but I'm just going to show you the lower part of that, so we see more detail.
So there's the very short analysis frame and its magnitude spectrum.
Zoom out a bit and a bit more detail appears in the magnitude spectrum.
We make the analysis frame longer still, and we get a lot more detail in the magnitude spectrum.
So a longer analysis frame means that we have more components added together (more basis functions), therefore more coefficients.
Remember that the coefficients are just spaced evenly along the frequency axis up to the Nyquist frequency, and so we're just going to get them closer together as we make the analysis frame longer, so we see more and more detail in the magnitude spectrum.
Analysing more signal gives us more detail on the spectrum.
This sounds like a good thing, but of course that spectrum is for the entire analysis frame.
It's effectively the average composition of a signal within the frame.
So a larger analysis frame means we're able to be less precise about where in time that analysis applies to, so we get lower time resolution.
So it's going to be a trade-off.
Like in all of engineering, we have to make a choice.
We have to choose our analysis frame to suit the purpose of the analysis.
It's a design decision.
The next steps involve finding, in the frequency domain, some evidence of the periodity in the speech signal: the harmonics.
But that will only be half the story, because we haven't yet thought about what the vocal tract does to that sound source.
Our first clue to that will come from the spectral envelope.
So we're going to look at two different properties in the frequency domain.
We see both of them together in the magnitude spectrum, one being the spectral envelope, and the other being the harmonics.