We must write a matlab code that will record a sound such as a piano key we will then perform a fft and determine the frequency of that sound. This should work for any sound we record it will be able to determine the frequency of the sound within a reasonable number.
CODE thus far:
close all; clear all; clc;
Fs = 8000;
recObj = audiorecorder(Fs,8,1);
disp('Start speaking:');
keyboard;
recordblocking(recObj, 5);
disp('End of Recording');
myRecording = getaudiodata(recObj);
figure, plot(myRecording), title('original time-domain voice
recording');
keyboard;
pdFFT = fft(myRecording);
figure, plot(abs(pdFFT)), title('abs of fft');
Code:
close all; clear all; clc;
Fs = 8000; // Sampling Frequncy
recObj = audiorecorder(Fs,8,1); // Starting Audio Recording
disp('Start speaking:');
keyboard; // Pause for Some Recording
recordblocking(recObj, 5); // End of Reconding
disp('End of Recording');
myRecording = getaudiodata(recObj); // Getting Audio Data from Object
figure, plot(myRecording), // Display Time domain Graph
title('original time-domain voice recording');
keyboard; // Pause
pdFFT = fft(myRecording); // Frequncy Domain Conversion
figure, plot(abs(pdFFT)), title('abs of fft'); // Frequncy Domain Plot of Reconding
Output:
Get Answers For Free
Most questions answered within 1 hours.