--- id: wiki-2026-0508-signal-processing-foundations title: Signal Processing Foundations category: 10_Wiki/Topics status: verified canonical_id: self aliases: [DSP, Digital Signal Processing, Fourier Analysis] duplicate_of: none source_trust_level: A confidence_score: 0.92 verification_status: applied tags: [signal-processing, dsp, fourier, filter, sampling-theorem] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: python framework: scipy / numpy / torchaudio --- # Signal Processing Foundations ## 매 한 줄 > **"매 signal processing 은 시간/공간 신호의 frequency / scale 분해와 그 위의 transform"**. Fourier (1822) 의 heat-equation series 부터 매 Cooley–Tukey FFT (1965), 그리고 2026 의 audio LLM (Whisper-large-v4, MoonShine), neural-vocoder (BigVGAN-2), brain–computer-interface (Neuralink N1) 까지의 backbone. ## 매 핵심 ### 매 핵심 정리 - **Sampling theorem (Nyquist)**: bandwidth B 의 신호는 `f_s ≥ 2B` 면 perfect reconstruct. - **Convolution theorem**: time-domain convolution ↔ frequency-domain product. - **Parseval**: energy 는 time/freq 에서 동일. - **Uncertainty**: Δt · Δf ≥ 1/(4π) — 매 wavelet/STFT trade-off 의 근원. ### 매 Filters - **FIR**: stable, linear-phase 가능, 매 group-delay 일정. - **IIR**: 매 efficient 하지만 phase 비선형 + stability 주의. - **Linear phase 의 필요**: 매 audio crossover, ECG. - **Adaptive (LMS, RLS, Kalman)**: 매 noise-cancelling, echo. ### 매 Transforms - **DFT/FFT**: 매 stationary 분석. - **STFT**: 매 short-time spectrum (mel-spec backbone). - **Wavelet (DWT)**: 매 multiscale. - **Hilbert**: 매 instantaneous amplitude/phase. - **Cepstrum**: 매 pitch / formant. ### 매 응용 1. Audio gen: BigVGAN-2 vocoder 의 multi-scale STFT loss. 2. ASR: Whisper-large-v4 의 80-mel + log-magnitude. 3. EEG/BCI: bandpower in θ/α/β/γ. 4. Radar / lidar: matched filter, FMCW range-doppler. ## 💻 패턴 ### FFT-based PSD (Welch) ```python from scipy.signal import welch def psd(x, fs): f, p = welch(x, fs=fs, nperseg=1024, noverlap=512, window="hann") return f, p ``` ### STFT + log-mel spectrogram ```python import torchaudio mel = torchaudio.transforms.MelSpectrogram( sample_rate=16000, n_fft=400, hop_length=160, n_mels=80, f_min=0, f_max=8000, power=2.0, ) log_mel = lambda wav: (mel(wav) + 1e-6).log() ``` ### FIR low-pass design (firwin) ```python from scipy.signal import firwin, filtfilt def lpf(x, fs, cutoff_hz, taps=129): b = firwin(taps, cutoff_hz, fs=fs, window="hamming") return filtfilt(b, [1.0], x) ``` ### Butterworth IIR (zero-phase) ```python from scipy.signal import butter, sosfiltfilt def bandpass(x, fs, lo, hi, order=4): sos = butter(order, [lo, hi], btype="band", fs=fs, output="sos") return sosfiltfilt(sos, x) ``` ### Wavelet denoise (PyWavelets) ```python import pywt, numpy as np def wavelet_denoise(x, wavelet="db4", level=4): coeffs = pywt.wavedec(x, wavelet, level=level) sigma = np.median(np.abs(coeffs[-1])) / 0.6745 thr = sigma * np.sqrt(2 * np.log(len(x))) coeffs[1:] = [pywt.threshold(c, thr, mode="soft") for c in coeffs[1:]] return pywt.waverec(coeffs, wavelet)[:len(x)] ``` ### Hilbert envelope ```python from scipy.signal import hilbert def envelope(x): a = hilbert(x) return np.abs(a), np.unwrap(np.angle(a)) ``` ### Resampling (polyphase) ```python from scipy.signal import resample_poly def to_16k(x, fs): from math import gcd g = gcd(fs, 16000) return resample_poly(x, 16000 // g, fs // g) ``` ### CQT / chroma (music-domain) ```python import librosa # 0.11.x chroma = librosa.feature.chroma_cqt(y=wav, sr=sr, n_chroma=12, hop_length=512) ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | Stationary spectrum | FFT / Welch PSD | | Time-varying | STFT / Mel | | Transient / multiscale | Wavelet | | Pitch / formant | Cepstrum / autocorr | | Linear-phase audio | FIR (filtfilt) | | Real-time low-latency | IIR (biquad cascade) | | Resampling | Polyphase (resample_poly) | **기본값**: ML feature 는 log-mel spectrogram, 분석은 Welch PSD, denoise 는 wavelet / RNNoise, real-time 은 SOS biquad. ## 🔗 Graph - 부모: [[Linear-Algebra-Foundations]] · [[Probability Theory|Probability-Theory-Foundations]] - 변형: [[Entropy in Information Theory|Information Theory]] · [[Signal in Noise]] - 응용: [[Kalman-Filter-and-State-Tracking]] · [[Computer_Vision]] - Adjacent: [[Roughness (그래픽 및 물리)]] · [[Cross-Frequency Coupling (CFC)]] ## 🤖 LLM 활용 **언제**: audio/EEG pipeline, vocoder loss design, sensor preprocessing, time-series feature engineering. **언제 X**: pure tabular data, NLP token streams (use sequence models directly). ## ❌ 안티패턴 - **Aliasing 무시**: anti-alias LPF 없이 downsample → 매 spectral fold-back. - **Window 의 leakage 미고려**: rectangular window → sidelobe 심함, Hann/Blackman 사용. - **filtfilt 를 real-time 에 사용**: 매 non-causal — production 은 단방향 IIR + group-delay 보정. - **dB 의 reference 누락**: dBFS / dBSPL / dBm 명시 필수. ## 🧪 검증 / 검토 - Verified (Oppenheim & Schafer "Discrete-Time Signal Processing" 3rd ed.; Mallat "Wavelet Tour" 3rd ed.; torchaudio docs 2.5). - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — Nyquist/Parseval/uncertainty, FIR/IIR/wavelet/STFT patterns, 2026 audio-LLM context |