Low pass filter using firpm and freqz functions

1 次查看(过去 30 天)
Hello,
I've got an assignment, that requires to filter a Tuba from Picolo in an audiofile which is mp3 format.
So, first I extracted my audiofile from a directory it was saved, then I cut it to be able to hear only 25 to 30 seconds.
Now I need to design a low pass filter using functions fripm and freqz, and I stuck here.
Every help/hint will be highly appreciated.
Here is my code:
clc; clear all; close all;
% a:
[Y, FS]=audioread('ex01signal.mp3');
FS
% play audiofile %sound (Y, FS) %FS= 44100 Hz - sampling frequency
%%
% b:
% opens given audiofile
[y1,fs1]= audioread('ex01signal.mp3');
% load ex01signal.mp3
filename = 'ex01signal.flac';
% creates a new audiofile 25-30sec
% y1, fs1 - magnitude and sampling frequency of this file
audiowrite(filename,y1,fs1);
%Read only 25-30 seconds.
samples = [25*fs1,30*fs1];
clear y1 fs1 [y1,fs1] = audioread(filename,samples);
%Play the signal 25-30sec.
sound(y1,fs1);
% print out sampling frequency
fs1
% pwelch function calculates Power Spectrum Density at frequency's plane
% pwelch for full signal
[PSD,frequency] = pwelch(Y,[],[],[],FS);
% creating a plot of pwekch results (full signal)
figure;
subplot(2,1,1);
plot(frequency,db(PSD));
xlabel ('Frequency [Hz]');
ylabel ('PSD[dB/Hz]');
title('Complete Signal Spectrum');
hold on;
% plotting 25-30 seconds of the signal
subplot(2,1,2);
[PSD1,frequency1] = pwelch(y1,[],[],[],fs1);
plot(frequency1,db(PSD1));
xlabel ('Frequency [Hz]');
ylabel ('PSD[dB/Hz]');
title('25-30 seconds Signal Spectrum');
hold off;
%%
% c:
f=[44/FS 349/FS];
m=[1 0];
dev=[6 8];
[n, f0, m0, w]= firpmord(f, m,dev)
b=firpm(n, f0, m0)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by