Equalizers equations with GUI

1 view (last 30 days)
Hassan Bosha
Hassan Bosha on 28 Feb 2019
function C1_var_Callback(hObject, eventdata, handles)
% hObject handle to C1_var (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
global C;
C(1)=get(hObject,'value');
set(handles.C1_val,'string',num2str(C(1)));
function plot_H_Callback(hObject, eventdata, handles)
% hObject handle to plot_H (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global C Fs;
equalizer_plot();
function equalizer_plot()
global C Fs;
[a,b]=coef();
H=0;
for i=1:5
H=H+10^(C(i)/20)*abs(freqz(b{i},a{i},1024));
end
plot(1e-3*Fs*[0:1023]/2048,20*log10(H));
xlabel('Frequency [kHz]');
ylabel('Magnitude [dB]');
title('Audio equalizer feature');
axis([0 1e-3*Fs/2 -21 21]);
grid on;
function [a,b]=coef()
global Fs;
%Filtrul 1
Rp1=0.5;
Rs1=30;
Fp1=4.1e3/(Fs/2);
Fs1=4.5e3/(Fs/2);
n1=cheb1ord(Fp1,Fs1,Rp1,Rs1);
[b1,a1]=cheby1(n1,Rp1,Fp1,'low');
%Filtrul 2
Rp2=0.5;
Rs2=30;
Fp2=1e3*[4.25,8.75]/(Fs/2);
Fs2=1e3*[3.9,9.35]/(Fs/2);
n2=cheb1ord(Fp2,Fs2,Rp2,Rs2);
[b2,a2]=cheby1(n2,Rp2,Fp2);
Can anyone explain what is the purpose and what the equation refers to in such code
it's an digital audio equalizer

Answers (0)

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!