Red freq audio file

16 visualizzazioni (ultimi 30 giorni)
Blue MU
Blue MU il 19 Dic 2021
Modificato: Rena Berman il 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 Commenti
Rik
Rik il 21 Dic 2021
Reading audio file and finding spectrum
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('file_name.wav');
%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)));
Rena Berman
Rena Berman il 25 Gen 2022
Modificato: Rena Berman il 15 Feb 2022
(Answers Dev) Restored edit of post

Accedi per commentare.

Risposte (1)

William Rose
William Rose il 19 Dic 2021
Modificato: William Rose il 19 Dic 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 Commenti
Walter Roberson
Walter Roberson il 20 Dic 2021
Filtering by manipulating the discrete fourier transform results only works for limited size buffers, or for reading the entire signal at one time and processing it. If you work based on frames of limited size, then you can never get a "brick wall" response for frequencies outside the bins implied by the buffer size and sampling frequency.
William Rose
William Rose il 20 Dic 2021
Modificato: William Rose il 21 Dic 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.

Accedi per commentare.

Categorie

Scopri di più su Audio Processing Algorithm Design in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by