seven band equalizer filter

4 views (last 30 days)
Noman
Noman on 23 Jul 2023
Answered: Milan Bansal on 10 Sep 2024
The aim of the proposed project is to design a seven-band equalizer based on Hamming and Hanning windows using MATLAB software. The filters are used Low pass filter, band pass and high pass filters. The low pass filter is working from 0-27 (kHz), all band pass filter is from 27 (kHz) to (27+ 27) kHz while the High pass filter is working from (27+ 27) kHz to (27x 27+ 27) kHz. Seven Band Equalizer Requirements
a) Seven Band Equalizer bandwidth: (27x 27+ 27) kHz.
b) One Low pass filter (Bandwidth 0 → 27 (kHz)
c) Five High pass filters (Bandwidth 27 (kHz)→ (27+ 27) kHz
d) One Band pass filter (Bandwidth (27+ 27) kHz → (27x 27+ 27) kHz.
e) Pass band ripple: max. 5%
f) Stop band rejection min 45 dB
g) Mild phase distortions are acceptable.
h) Keep sampling frequency high”

Answers (1)

Milan Bansal
Milan Bansal on 10 Sep 2024
Hi Noman
I see that you wish to create a 7 band equalizer with the given specifications.
To design a seven-band equalizer using Hamming and Hanning windows in MATLAB, you'll need to implement filters that meet the specified requirements. Here's a structured approach to achieve this:Design Steps
Sampling Frequency: Choose a high sampling frequency, e.g.1 MHz, to ensure accurate representation of the highest frequency (756 kHz).
Filter Specifications:
  • Low Pass Filter (LPF): Cutoff frequency at 27 kHz.
  • Band Pass Filters (BPF): Each filter covers a bandwidth of 27 kHz, starting from 27 kHz to 54 kHz.
  • High Pass Filter (HPF): Cutoff frequency begins at 54 kHz.
Window Functions: Use Hamming and Hanning windows to design the filters, as they provide different trade-offs in terms of main lobe width and side lobe attenuation.
Design : Use the fir1 function in MATLAB to design FIR filters with specified window functions.
Assembly of Equalizer: Combine the filters to form the seven-band equalizer. Adjust the gain of each band to achieve the desired equalization effect.
Refer to the code snippet below for sample implementation.
fs = 1e6; % Sampling frequency
n = 128; % Filter order, adjust as needed
% Low Pass Filter
lpf_cutoff = 27e3 / (fs/2);
lpf_hamming = fir1(n, lpf_cutoff, 'low', hamming(n+1));
lpf_hanning = fir1(n, lpf_cutoff, 'low', hanning(n+1));
% Band Pass Filters
bpf_cutoffs = [27e3 54e3] / (fs/2);
bpf_hamming = fir1(n, bpf_cutoffs, 'bandpass', hamming(n+1));
bpf_hanning = fir1(n, bpf_cutoffs, 'bandpass', hanning(n+1));
% High Pass Filter
hpf_cutoff = 54e3 / (fs/2);
hpf_hamming = fir1(n, hpf_cutoff, 'high', hamming(n+1));
hpf_hanning = fir1(n, hpf_cutoff, 'high', hanning(n+1));
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Assemble %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sample signal
t = 0:1/fs:1-1/fs;
input_signal = sin(2*pi*1e3*t); % Example input signal
% Gain settings for each band
gain_lpf = 3.0; % Gain for low pass filter
gain_bpf = [1.0, 1.0, 2.0, 3.0, 1.0]; % Gains for band pass filters
gain_hpf = 1.0; % Gain for high pass filter
% Filter outputs
output_lpf = filter(lpf_hamming, 1, input_signal) * gain_lpf;
output_bpf = zeros(5, length(input_signal));
for i = 1:5
output_bpf(i, :) = filter(bpf_hamming, 1, input_signal) * gain_bpf(i);
end
output_hpf = filter(hpf_hamming, 1, input_signal) * gain_hpf;
% Combine all filter outputs
equalized_signal = output_lpf + sum(output_bpf, 1) + output_hpf;
figure
plot(t,input_signal)
xlim([0.45 0.5])
ylim([-1.5 1.5])
% Visualization
plot(t, equalized_signal);
xlabel('Time (s)');
ylabel('Amplitude');
title('Equalized Signal');
xlim([0.45 0.5])
ylim([-3 3])
Please refer to the following documentation links to learn more about fir1 and filter funciton.
Hope this helps!

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!