Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seunghan96 committed Oct 19, 2023
1 parent a1cdee5 commit 218dd94
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
2 changes: 2 additions & 0 deletions _posts/2023-10-03-(audio)DFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ $$f \approx F(k)=\frac{k}{N T}=\frac{k s_r}{N}$$.
- $$N$$ : number of samples
- $$s_r$$ : sampling rate ( = inverse of $$T$$ )

<br>

# 3. Redundancy in DFT

![figure2](/assets/img/audio/img40.png)
Expand Down
38 changes: 19 additions & 19 deletions _posts/2023-10-07-(audio)STFT_spectogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ excerpt:

# 1. (Recap) Discrete Fourier Transform

### $\hat{x}(k / N)=\sum_{n=0}^{N-1} x(n) \cdot e^{-i 2 \pi n \frac{k}{N}}$.
### $$\hat{x}(k / N)=\sum_{n=0}^{N-1} x(n) \cdot e^{-i 2 \pi n \frac{k}{N}}$$.

$\rightarrow$ no time information!
$$\rightarrow$$ no time information!

$\rightarrow$ solution: **STFT**
$$\rightarrow$$ solution: **STFT**

<br>

Expand All @@ -37,7 +37,7 @@ slide the window & perform FFT per window!

apply **windowing function** to signal & slide!

$x_w(k)=x(k) \cdot w(k)$.
$$x_w(k)=x(k) \cdot w(k)$$.

<br>

Expand All @@ -50,19 +50,19 @@ Two designs

<br>

## (2) DFT $\rightarrow$ STFT
## (2) DFT $$\rightarrow$$ STFT

[DFT]

### $\hat{x}(k)=\sum_{n=0}^{N-1} x(n) \cdot e^{-i 2 \pi n \frac{k}{N}}$.
### $$\hat{x}(k)=\sum_{n=0}^{N-1} x(n) \cdot e^{-i 2 \pi n \frac{k}{N}}$$.

<br>

[STFT]

### $S(m, k)=\sum_{n=0}^{N-1} x(n+m H) \cdot w(n) \cdot e^{-i 2 \pi n \frac{k}{N}}$.
### $$S(m, k)=\sum_{n=0}^{N-1} x(n+m H) \cdot w(n) \cdot e^{-i 2 \pi n \frac{k}{N}}$$.

- $mH$ : starting sample of current frame
- $$mH$$ : starting sample of current frame

<br>

Expand All @@ -76,45 +76,45 @@ DFT

- spectral vector
- shape: ( \# of frequency bins )
- $N$ complex Fourier coefficients
- $$N$$ complex Fourier coefficients

<br>

STFT

- spectral matrix
- shape: ( \# of frequency bins , \# of frames)
- \# of frequency bins : $\frac{\text{frame size}}{2} + 1$
- \# of frames = $
- $N^{\prime}$ complex Fourier coefficients
- \# of frequency bins : $$\frac{\text{frame size}}{2} + 1$$
- \# of frames = $$
- $$N^{\prime}$$ complex Fourier coefficients

<br>

## (4) Example

Settings

- Raw signal = 10,000 samples ( $N=10,000$ )
- Raw signal = 10,000 samples ( $$N=10,000$$ )

- Frame size = 1,000

- Hop Size = 500

<br>

\# of frequency bins = $\frac{1000}{2}+1 = 501$ .... ( 0, sampling rate / 2)
\# of frequency bins = $$\frac{1000}{2}+1 = 501$$ .... ( 0, sampling rate / 2)

\# of frames = $\frac{10000-1000}{500} + 1= 19$
\# of frames = $$\frac{10000-1000}{500} + 1= 19$$

$\rightarrow$ shape of **spectral matrix** = **(501,19)**
$$\rightarrow$$ shape of **spectral matrix** = **(501,19)**

<br>

## (5) Parameters of STFT

1. Frame Size
- HIGH frame size $\rightarrow$ HIGH frequency resolution & LOW time resolution
- SMALL frame size $\rightarrow$ LOW frequency resolution & HIGH time resolution
- HIGH frame size $$\rightarrow$$ HIGH frequency resolution & LOW time resolution
- SMALL frame size $$\rightarrow$$ LOW frequency resolution & HIGH time resolution
2. Hop Size
3. Windowing Function
- ex) Hann window
Expand All @@ -131,7 +131,7 @@ $\rightarrow$ shape of **spectral matrix** = **(501,19)**

### Visualizing sound

value: $Y(m, k)=\mid S(m, k)\mid ^2$.
value: $$Y(m, k)=\mid S(m, k)\mid ^2$$.

<br>

Expand Down

0 comments on commit 218dd94

Please sign in to comment.