DSPRelated.com

FIR Filter to Match Any Magnitude and Phase Response

Dan BoschenDan Boschen September 30, 20252 comments

This post details a technique for designing high quality FIR filters that match arbitrary magnitude and phase responses.


Filtering Noise: The Basics (Part 1)

Aditya DuaAditya Dua September 17, 20223 comments

How do you pull signals out of random noise? This post builds intuition from first principles for discrete-time white Gaussian noise and shows how simple linear FIR filtering (averaging) reduces noise. You’ll get derivations for the output mean, variance and autocorrelation, learn why the uniform moving-average minimizes noise under a unity-DC constraint, and why its sinc spectrum can be problematic. Part 1 of a short series.


In Search of The Fourth Wave

Allen DowneyAllen Downey September 25, 20214 comments

While working on Think DSP the presenter ran into a curious spectral pattern: sawtooth waves have all harmonics with amplitudes that scale like 1/f, square waves keep only odd harmonics with 1/f, and triangle waves keep odd harmonics with 1/f^2. That observation motivates a simple question: is there a basic waveform that has all integer harmonics but a 1/f^2 rolloff? The talk walks through four solution approaches, a fifth idea from the audience, and links to a runnable Colab notebook.


Project Report : Digital Filter Blocks in MyHDL and their integration in pyFDA

Sriyash CaculoSriyash Caculo August 13, 20181 comment

This Summer of Code project shows how to move from Python filter design to synthesizable HDL by building a MyHDL "filter-blocks" package and connecting it to PyFDA. The author implemented direct form I FIR and IIR blocks, added an API, tests, tutorials, and PyFDA export to VHDL and Verilog. The report also highlights practical fixed-point design choices and remaining work such as second-order sections.


Project update-2 : Digital Filter Blocks in MyHDL and their integration in pyFDA

Sriyash CaculoSriyash Caculo July 9, 2018

This update shows a working integration between Pyfda and MyHDL using a compact API that passes fixed-point coefficients, stimulus data, and returns simulated filter responses. It walks through two usage styles, constructor-based and setter-method-based, and demonstrates a Pyfda workflow from specs to MyHDL simulation and plotting. Future plans include HDL code generation and API extension as filters grow.


Project update-1 : Digital Filter Blocks in MyHDL and their integration in pyFDA

Sriyash CaculoSriyash Caculo June 22, 2018

By week 5 the project delivered parameterized MyHDL implementations of multiple digital filter topologies and started integration with PyFDA. The post walks through a behavioral direct-form I FIR, cascaded second-order-section implementations for FIR and IIR using structural modeling, and a parallel IIR design that concatenates per-section outputs for final summation. All designs infer order and coefficients from PyFDA, with examples in the filter-blocks repository.


Project introduction: Digital Filter Blocks in MyHDL and their integration in pyFDA

Sriyash CaculoSriyash Caculo May 25, 20184 comments

Sriyash Caculo is building a bridge between filter design and hardware by implementing digital filter blocks in MyHDL and integrating them with PyFDA as part of a Google Summer of Code project. The work aims to convert PyFDA floating point designs into fixed point MyHDL blocks that automatically generate VHDL or Verilog, with tests and tutorials to ensure correctness and usability.


Autocorrelation and the case of the missing fundamental

Allen DowneyAllen Downey January 21, 201610 comments

A short hands-on exploration shows why we perceive the fundamental pitch even when it's absent from the spectrum. Using saxophone recordings, high-pass filtering, and autocorrelation plots, the post demonstrates that the highest ACF peak often predicts perceived pitch rather than the strongest spectral line. The experiments also show that removing high harmonics eliminates the effect, and that autocorrelation is a useful but incomplete model of pitch perception.


Generating pink noise

Allen DowneyAllen Downey January 20, 20161 comment

This post implements a stochastic Voss-McCartney pink-noise generator in Python, tackling why incremental per-sample algorithms do not map well to NumPy batch operations. It presents a practical NumPy/Pandas approach that uses geometric-distributed update events and pandas' fillna for column-wise zero-order hold to make batch generation efficient. The generated noise shows a power-spectrum slope near -1, matching expected 1/f behavior.


Differentiating and integrating discrete signals

Allen DowneyAllen Downey December 14, 20152 comments

Think DSP's new chapter digs into discrete differentiation and integration, using first differences, convolution, and FFTs to compare time and frequency domain views. The author reproduces diff via convolution then explores cumsum as its inverse and runs into two puzzling mismatches: noisy FFT amplitude ratios for nonperiodic data, and a time-domain convolution that does not reproduce cumsum for a sawtooth despite matching frequency responses. The post includes IPython notebooks and invites troubleshooting.


Python scipy.signal IIR Filtering: An Example

Christopher FeltonChristopher Felton May 19, 2013

Christopher Felton walks through using scipy.signal IIR filters to demodulate PWM signals, using spectrum and spectrogram analysis to show what works and what does not. He demonstrates using filtfilt to avoid phase delay, compares a single narrow IIR to a very high order FIR, and shows how staged IIR filtering and multirate ideas give much better attenuation. Includes an FPGA-ready MyHDL PWM model.


Polyphase Filters and Filterbanks

Kyle Kyle March 19, 201310 comments

Kyle walks through practical polyphase filtering and analysis filterbanks, complete with Python code using numpy, scipy and matplotlib. The post shows how splitting an FIR into M polyphase legs gives identical, more efficient decimation while avoiding aliasing, and it flags the subtle reordering, zero padding and FFT versus IDFT ordering issues that trip many implementers. Includes runnable reference code and links for deeper theory.


Python scipy.signal IIR Filter Design

Christopher FeltonChristopher Felton May 13, 20124 comments

Christopher Felton walks through designing infinite impulse response filters using scipy.signal in Python, focusing on practical specs and functions rather than theoretical derivations. He explains normalized passband and stopband definitions, gpass and gstop, and shows how iirdesign and iirfilter differ. Plots compare elliptic, Chebyshev, Butterworth and Bessel responses, highlighting steep transitions versus near-linear phase tradeoffs.


Generating pink noise

Allen DowneyAllen Downey January 20, 20161 comment

This post implements a stochastic Voss-McCartney pink-noise generator in Python, tackling why incremental per-sample algorithms do not map well to NumPy batch operations. It presents a practical NumPy/Pandas approach that uses geometric-distributed update events and pandas' fillna for column-wise zero-order hold to make batch generation efficient. The generated noise shows a power-spectrum slope near -1, matching expected 1/f behavior.


Python scipy.signal IIR Filter Design Cont.

Christopher FeltonChristopher Felton June 19, 20127 comments

Christopher Felton continues his practical tour of SciPy's iirdesign, moving beyond lowpass examples to show highpass, bandpass, and stopband designs with concise, code-focused explanations. He highlights how ellip and cheby2 let you tighten specifications for sharper transitions, and shows that the iirdesign workflow is consistent across filter types. Read for clear, reusable examples to produce IIR filter coefficients with scipy.signal.


Curse you, iPython Notebook!

Christopher FeltonChristopher Felton May 1, 20124 comments

Christopher Felton shares a cautionary tale about losing an ipython 0.12 notebook session after assuming the browser would save his interactive edits. He explains that notebooks at the time required clicking the top Save button to persist sessions, and autosave was not yet available. He recommends basing interactive work on scripts, saving often, and testing export behavior to avoid redoing text, LaTeX, and plots.


Differentiating and integrating discrete signals

Allen DowneyAllen Downey December 14, 20152 comments

Think DSP's new chapter digs into discrete differentiation and integration, using first differences, convolution, and FFTs to compare time and frequency domain views. The author reproduces diff via convolution then explores cumsum as its inverse and runs into two puzzling mismatches: noisy FFT amplitude ratios for nonperiodic data, and a time-domain convolution that does not reproduce cumsum for a sawtooth despite matching frequency responses. The post includes IPython notebooks and invites troubleshooting.


Filtering Noise: The Basics (Part 1)

Aditya DuaAditya Dua September 17, 20223 comments

How do you pull signals out of random noise? This post builds intuition from first principles for discrete-time white Gaussian noise and shows how simple linear FIR filtering (averaging) reduces noise. You’ll get derivations for the output mean, variance and autocorrelation, learn why the uniform moving-average minimizes noise under a unity-DC constraint, and why its sinc spectrum can be problematic. Part 1 of a short series.


Project introduction: Digital Filter Blocks in MyHDL and their integration in pyFDA

Sriyash CaculoSriyash Caculo May 25, 20184 comments

Sriyash Caculo is building a bridge between filter design and hardware by implementing digital filter blocks in MyHDL and integrating them with PyFDA as part of a Google Summer of Code project. The work aims to convert PyFDA floating point designs into fixed point MyHDL blocks that automatically generate VHDL or Verilog, with tests and tutorials to ensure correctness and usability.


Bayes meets Fourier

Allen DowneyAllen Downey October 26, 2015

Joseph Fourier never met Thomas Bayes—Fourier was born in 1768, seven years after Bayes died.  But recently I have been exploring connections between the Bayes filter and the Fourier transform.

By "Bayes filter", I don't mean spam filtering using a Bayesian classifier, but rather recursive Bayesian estimation, which is used in robotics and other domains to estimate the state of a system that evolves over time, for example, the position of a moving robot.  My interest...