From a48d1c344b54bc9ffb24b1c43fc0206bd9ef3958 Mon Sep 17 00:00:00 2001 From: Wan Ziyu Date: Tue, 17 Mar 2026 14:08:49 +0900 Subject: [PATCH] dsp: multiple reworks - deadpan tone adjustment - added summary section - inline LaTeX for symbols and exprs --- wip/dsp.md | 79 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/wip/dsp.md b/wip/dsp.md index 9c1ddc6..f283cdc 100644 --- a/wip/dsp.md +++ b/wip/dsp.md @@ -9,7 +9,7 @@ The actual material (text that is read out by a vocal synthesiser) is in Japanes For things that are not easily pronounced (e.g. formulae, expressions, symbols), inclusive either: - Mark how the thing should be pronounced in a pair of adjacent parentheses - - e.g. H(ω) (エッチオメガ) + - e.g. $H(\omega)$ (エッチオメガ) - (inclusive) Or don't embed these elements too deep into the flow of sentences; use common, laymen's language instead - e.g. not `Fs/2(サンプリング周波数の半分)までの帯域を忠実に再構成できる` but `サンプリング周波数の半分までの帯域を忠実に再構成できる` @@ -43,24 +43,24 @@ The general direction is to stay boring, but the deadpan kind of boring. Keep te - Any input decomposes into scaled, shifted impulses - By linearity and time-invariance, the output is the corresponding sum of scaled, shifted impulse responses - Convolution as the operation - - That sum is convolution: y = x * h - - In continuous time, this is an integral: y(t) = ∫ x(τ) h(t−τ) dτ - - Symmetric in its arguments: x * h = h * x + - That sum is convolution: $y = x * h$ + - In continuous time, this is an integral: $y(t) = \int x(\tau) \, h(t - \tau) \, d\tau$ + - Symmetric in its arguments: $x * h = h * x$ - Signal and system are interchangeable operands — both are functions; convolution makes no distinction between them - Commutativity: for LTI systems, order of composition is irrelevant - Two LTI systems in series have a combined impulse response equal to the convolution of each - - h₁ * h₂ = h₂ * h₁ — order does not affect the result + - $h_1 * h_2 = h_2 * h_1$ — order does not affect the result ### 3. Signal transformation - A signal can be represented equivalently in the frequency domain -- The Fourier transform: s(t) ↔ S(ω); any signal is a sum of sinusoids at different frequencies +- The Fourier transform: $s(t) \leftrightarrow S(\omega)$; any signal is a sum of sinusoids at different frequencies - Each sinusoid has a frequency, amplitude, and phase - - S(ω) is the spectrum: how much of each frequency is present + - $S(\omega)$ is the spectrum: how much of each frequency is present - Analog signals carry components from DC to arbitrarily high frequencies ### 4. Filters -- A filter is an LTI system — characterized by its frequency response H(ω) - - H(ω) is the Fourier transform of the impulse response h(t) +- A filter is an LTI system — characterized by its frequency response $H(\omega)$ + - $H(\omega)$ is the Fourier transform of the impulse response $h(t)$ - Filtering: shaping a signal's spectrum by selectively attenuating or preserving frequency bands - Basic types: lowpass, highpass, bandpass - Lowpass: passes low frequencies, attenuates high @@ -70,16 +70,16 @@ The general direction is to stay boring, but the deadpan kind of boring. Keep te ### 5. Discrete time - Moving from continuous to discrete: two axes require discretization -- Amplitude: N bits → 2^N discrete levels +- Amplitude: $N$ bits → $2^N$ discrete levels - Each sample is mapped to the nearest representable level; the error is quantization noise - The representable range is fixed by design and hardware (ADC/DAC reference voltage) - Hard clip at the boundary — analog degrades gradually toward its physical limits; digital does not - Time axis: sampling captures only finitely many values per second - Analog signals contain frequency components up to infinity — a discrete system cannot represent all of them - Discrete time is viable when the high-frequency components that would be lost are not needed -- Nyquist: given sampling rate Fs, faithful reconstruction is guaranteed up to Fs/2 - - What Fs/2 should be is an applied engineering question — Nyquist does not answer it - - Components above Fs/2 are lost: aliasing +- Nyquist: given sampling rate $F_s$, faithful reconstruction is guaranteed up to $F_s/2$ + - What $F_s/2$ should be is an applied engineering question — Nyquist does not answer it + - Components above $F_s/2$ are lost: aliasing - LTI and convolution hold in discrete time — commutativity survives - Convolution becomes a sum (finite for FIR, infinite for IIR) @@ -90,9 +90,15 @@ The general direction is to stay boring, but the deadpan kind of boring. Keep te - Modulated delay (chorus, flanger): delay time varies with time → time-invariance breaks; same input at different times yields different output - Overdrive: saturation above threshold → linearity breaks; EQ before overdrive ≠ overdrive before EQ - Commutativity breaks — order of composition is no longer irrelevant - - h₁ followed by h₂ ≠ h₂ followed by h₁ in general + - $h_1$ followed by $h_2$ ≠ $h_2$ followed by $h_1$ in general - No universal rule; behavior must be examined per case +### 7. Summary +- Most of the framework rests on the LTI assumption + - Signal–system equivalence, convolution, commutativity, frequency-domain analysis — all require linearity and time-invariance +- Real systems break the assumption routinely +- The framework is studied not as a description of reality, but as a baseline against which deviations are understood + ## Text (lyrics if you insist) 信号とシステム、そしてデジタル信号処理について説明する。 @@ -145,15 +151,15 @@ The general direction is to stay boring, but the deadpan kind of boring. Keep te 連続時間においては、畳み込みは積分として定義される。 時間軸に沿って入力を少しずつずらしながら、そのずれに対応するインパルス応答を強さに応じて足し合わせる。その積分の結果が出力である。 -y = x * h (y イコール x 畳み込み h) +$y = x * h$ (y イコール x 畳み込み h) ここで興味深い性質がある。畳み込みはその二つの引数に対して対称である。 -x * h = h * x (x 畳み込み h イコール h 畳み込み x) +$x * h = h * x$ (x 畳み込み h イコール h 畳み込み x) これは単なる計算上の便宜ではない。x と h が同じ種類の対象であること、つまりシステムが信号空間に吸収されることの、自然な帰結である。 この対称性から、実用上重要な結論が出てくる。 二つの線形時不変システムを直列につないだとき、合成されたシステムのインパルス応答は、各インパルス応答の畳み込みである。 -h₁ * h₂ = h₂ * h₁ (h1 畳み込み h2 イコール h2 畳み込み h1) +$h_1 * h_2 = h_2 * h_1$ (h1 畳み込み h2 イコール h2 畳み込み h1) どちらを先につないでも、結果は変わらない。 ### 3. 信号変換 @@ -162,14 +168,13 @@ h₁ * h₂ = h₂ * h₁ (h1 畳み込み h2 イコール h2 畳み込み h それが周波数領域という見方である。 フーリエ変換がそれを可能にする。 -s(t)(エス ティー)と S(ω)(エス オメガ)は同じ信号の二つの顔である。 +$s(t)$(エス ティー)と $S(\omega)$(エス オメガ)は同じ信号の二つの顔である。 一方は時間の経過を、もう一方は周波数の分布を示す。 フーリエ変換が言っているのは、こういうことである。 どんな信号も、周波数の異なる正弦波をいくつか重ね合わせたものとして表せる。 -たとえば楽器の音を思い浮かべてほしい。基音があり、倍音がある。 -それぞれが異なる周波数の正弦波で、それらが重なって一つの音色になる。 -S(ω) はその内訳である。どの周波数の成分がどれだけの強さで含まれているか、それがスペクトルである。 +楽器かエンジンの音がわかりやすい例である。基音と倍音がある。それぞれ異なる周波数の正弦波で、それらが重なって音色になる。 +$S(\omega)$ はその内訳である。どの周波数の成分がどれだけの強さで含まれているか、それがスペクトルである。 アナログ信号は原理的には、ゼロから無限大まであらゆる周波数成分を持ちうる。 このことが、後の離散化の議論に関わってくる。 @@ -179,8 +184,8 @@ S(ω) はその内訳である。どの周波数の成分がどれだけの強 フィルタは線形時不変システムの実用的な例である。 フーリエ変換の言葉で言えば、フィルタとは信号のスペクトルを形作るシステムである。 -フィルタを特徴づけるのは周波数応答 H(ω)(エイチ オメガ)である。 -これはインパルス応答 h(t) をフーリエ変換したものである。 +フィルタを特徴づけるのは周波数応答 $H(\omega)$(エイチ オメガ)である。 +これはインパルス応答 $h(t)$ をフーリエ変換したものである。 インパルス応答が時間領域でシステムを表すように、周波数応答は周波数領域でそのシステムを表している。 フィルタの働きは、周波数によって信号をふるいにかけることである。 @@ -201,7 +206,7 @@ S(ω) はその内訳である。どの周波数の成分がどれだけの強 まず振幅軸について。 デジタルシステムが振幅を表現できる精度は、ビット深度によって決まる。 -Nビットのシステムは 2^N 個の離散的な振幅レベルを持つ。 +$N$ ビットのシステムは $2^N$ 個の離散的な振幅レベルを持つ。 各サンプルの値は、最も近いレベルに丸められる。この丸め誤差を量子化ノイズと呼ぶ。 表現できる振幅の上限と下限は、設計とハードウェアによって固定されている。ADCやDACの基準電圧がそれを決める。 その境界を超えると、ハードクリップが起きる。 @@ -217,9 +222,9 @@ Nビットのシステムは 2^N 個の離散的な振幅レベルを持つ。 これが離散化を正当化する前提である。 ナイキストの定理が、これを定量化する。 -サンプリング周波数を Fs としたとき、Fs/2 より低い周波数成分は忠実に再構成できる。 -定理が言うのはそれだけである。Fs をどこに設定すべきかは、定理が教えてくれることではない。用途が決める。 -Fs/2 を超える成分は再構成できない。これをエイリアシングと呼ぶ。 +サンプリング周波数を $F_s$ としたとき、$F_s/2$ より低い周波数成分は忠実に再構成できる。 +定理が言うのはそれだけである。$F_s$ をどこに設定すべきかは、定理が教えてくれることではない。用途が決める。 +$F_s/2$ を超える成分は再構成できない。これをエイリアシングと呼ぶ。 補足しておく。この離散化によって、線形時不変システムの性質が崩れるわけではない。 連続時間において積分であった畳み込みは、離散時間においては和になる。有限インパルス応答なら有限和、無限インパルス応答なら無限和である。 @@ -245,8 +250,22 @@ Fs/2 を超える成分は再構成できない。これをエイリアシング このとき、畳み込みの可換性は成立しない。 非線形システムでは、一般に -h₁(システム1)の後にh₂(システム2)を適用した結果と、 -h₂(システム2)の後にh₁(システム1)を適用した結果は、等しくない。 +$h_1$(システム1)の後に$h_2$(システム2)を適用した結果と、 +$h_2$(システム2)の後に$h_1$(システム1)を適用した結果は、等しくない。 普遍的な規則は存在しない。 -各ケースを個別に検討する必要がある。 \ No newline at end of file +各ケースを個別に検討する必要がある。 + +### まとめ + +以上がデジタル信号処理の基本的な枠組みである。 + +振り返ると、ここで述べたことの大半は線形時不変システムという前提の上に成り立っている。 +信号とシステムが同じ空間に住むこと。畳み込みによる合成。可換性。周波数領域での見通しのよさ。 +これらは全て、線形性と時不変性が揃っているからこそ成り立つ性質である。 + +そして最後の節で述べた通り、現実のシステムはその前提をしばしば破る。 + +では、なぜこの枠組みを学ぶのか。 +破れ方を理解するには、まず何が破れているのかを知る必要があるからである。 +線形時不変システムの理論は、現実そのものの記述ではない。現実を測るための基準線である。 \ No newline at end of file