Matlab Audio Filter with changing Frequency
이전 댓글 표시
Dear Matlab Community, I am working on project where I need to be able to filter/extract a frequency band which should be „tuneable“ over time. For example: I am interested in the frequency range 220 to 240 for 0.5 seconds, then the range should gradually go up to 320 to 340 in 1 second. Ideal would be a solution similar to an envelope where time and frequency can be inserted. There is modern audio software, where it is possible to draw a selection and then export that as an audio file but I am looking for an automated solution since I need to do that many hundreds time. Any help is much appreciated thanks!
댓글 수: 2
Mathieu NOE
2022년 11월 30일
hello Hans and welcome back !
this code is the IIR filtering of a signal with fixed filter coefficients
now we could make the coefficients variable with time , this is my next step for tomorrow..
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% data
[x,Fs] = audioread('test_voice_mono.wav');
[samples,channels] = size(x);
dt = 1/Fs;
time = (0:samples-1)*dt;
%% IIR filter recursive equation
c1 = 8;
c2 = 2;
c3 = 7;
b0 = 0.05 * c1;
b1 = 0.03 * c2;
b2 = 0.02 * c3;
a1 = 0.5;
a2 = 0.5;
% manual for loop coding IIR filter
y(1) = b0*x(1) + 0 + 0 + 0 + 0; % 1st iteration
y(2) = b0*x(2) + b1*x(1) + 0 + a1*y(1) + 0; % 2nd iteration
for k = 3:samples % for iteration # 3 and after
y(k) = b0*x(k) + b1*x(k-1) + b2*x(k-2) + a1*y(k-1) + a2*y(k-2);
end
figure(1)
plot(time,x,time,y)
Hans Buchele
2022년 12월 1일
채택된 답변
추가 답변 (1개)
jibrahim
2022년 11월 30일
0 개 추천
Hi Hans,
Take a look at dsp.VariableBandwidthFIRFilter or dsp.VariableBandwidthIIRFIlter. They both support bandpass tunable filters.
카테고리
도움말 센터 및 File Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
