Red freq audio file

14 views (last 30 days)
Blue MU
Blue MU on 19 Dec 2021
Edited: Rena Berman on 15 Feb 2022
For a project, I have to do the following 2 requirements.
-Use Matlab to read the attached audio file, which has a sampling frequency Fs= 48 KHz. Find the spectrum of this signal (the signal in frequency domain). [audioread, fft , fftshift , plot]
-Using an ideal Filter, remove all frequencies greater than 4 KHz
I wrote this part so far and I don't know if it's right or not and I'm stuck. Any help would be appreciated!
[xn, fs]=audioread('eric.wav');
Error using audioread>readaudio (line 143)
The filename specified was not found in the MATLAB path.

Error in audioread (line 136)
[y, Fs] = readaudio (filename, range, datatype);
nf=1024; %number of point in DTFT
Y = fft(xn,nf);
f = fs/2*linspace(0,1,nf/2+1);
plot(f,abs(Y(1:nf/2+1)));
  2 Comments
Rena Berman
Rena Berman on 25 Jan 2022
(Answers Dev) Restored edit of post

Sign in to comment.

Answers (1)

William Rose
William Rose on 19 Dec 2021
Edited: William Rose on 19 Dec 2021
Sounds like a good project. Your code looks like a good first step. What happens when you run your code? Do you get an error message? If it runs without error, then evaluate the plot of abs(Y) versus frequency: does it look reasonable?
Please attach the audio file file_name.wav, and format your code as "code" in your posting, and run it, so that we can see the plot that you get.
Why do you limit the fft to 1024 points? How long (how many points) is xn? When you limit the fft to 1024 points, the input signal is trucated to 1024 points, if it is longer. This means you are analyzing only the first 1/48th of a second of sound, which is probably less than what you want.
Next step will be to implement the ideal filter, to remove frequencies above 4 kHz. Any ideas for how you could do that?
  4 Comments
William Rose
William Rose on 20 Dec 2021
@Walter Roberson is correct, of course. But you could do it in this case. Remember to manipulate the FFT symmetrically on either side of the Nyquist frequency.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by