FIR Band-Pass Filter

View on GitHub

Digital Signal Processing · C

Overview

A low-level implementation of a Finite Impulse Response (FIR) band-pass filter written entirely in C, without any DSP libraries. The project demonstrates a deep understanding of digital signal processing fundamentals — specifically how to isolate a specific frequency band from a mixed signal using convolution.

The filter is designed to pass frequencies between 1 kHz and 3 kHz while attenuating all other frequency components. This type of filter is foundational in audio processing, communications, and — particularly relevant to my professional work — sonar signal processing.

The Problem

Real-world signals contain noise and unwanted frequency components mixed in with the desired signal. A band-pass filter solves this by selectively allowing only a specific range of frequencies to pass through, rejecting everything outside that range. Implementing this from scratch in C requires understanding the mathematics of convolution, windowing functions, and the frequency-domain characteristics of filter design — all without relying on higher-level abstractions.

How It Works

1

Define Filter Specifications

Determine the desired passband (1–3 kHz), stopband frequencies, and acceptable ripple levels for the application.

2

Calculate Filter Coefficients

Use the windowed-sinc method with a Hamming window to compute the FIR coefficients that shape the frequency response.

3

Implement Convolution

Apply the filter by convolving the input signal with the computed coefficients using a direct-form FIR structure in C.

4

Validate Output

Feed test signals at various frequencies and verify that only the target band passes through while others are attenuated.

Tech Stack

CGCC CompilerWindowed-Sinc MethodHamming WindowDirect-Form FIR

Key Learnings

  • Deepened understanding of the relationship between time-domain convolution and frequency-domain filtering.
  • Learned how windowing functions (Hamming, Hanning, Blackman) affect the trade-off between transition bandwidth and stopband attenuation.
  • Gained appreciation for numerical precision issues when implementing DSP algorithms in fixed-point C.
  • This project directly prepared me for working on real-time sonar signal processing at TÜBİTAK BİLGEM.