Question

We must write a matlab code that will record a sound such as a piano key...

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');

Homework Answers

Answer #1

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:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Problem 3 you can use Matlab and also i give u the Problem 1 code its...
Problem 3 you can use Matlab and also i give u the Problem 1 code its on Matlab Using the same initial code fragment as in Problem 1, add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the impulse response of an IIR bandpass filter with band edge frequencies 750 Hz and 850 Hz and based on a 4th order Butterworth prototype. Name your program p3.sce this is the Problem 1 code and the solutin clear; clc;...
MATLAB FIR filter design. The audio file, covering the frequency range of roughly 0 to 3000...
MATLAB FIR filter design. The audio file, covering the frequency range of roughly 0 to 3000 Hz, is very badly corrupted with high?level noise. Your problem is to design a digital filter that will sufficiently attenuate the noise so that the audio speech is intelligible. (sorry but chegg doesn't allow me to attach the wav file) Here is the design template: clear, clc % clear all variables %% Read in the noisy audio signal from the file 'CapnJ.wav' using audioread...
Problem 1....... you can use Matlab The following Scilab code generates a 10-second “chirp” with discrete...
Problem 1....... you can use Matlab The following Scilab code generates a 10-second “chirp” with discrete frequencies ranging from 0 to 0.2 with a sampling frequency of 8 kHz. clear; Fs = 8000; Nbits = 16; tMax = 10; N = Fs*tMax+1; f = linspace(0.0,0.2,N); x = zeros(f); phi = 0; for n=0:N-1 x(n+1) = 0.8*sin(phi); phi = phi+2*%pi*f(n+1); end sound(x,Fs,Nbits); sleep(10000); //allows full sound to play Add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the...
For this homework, you will be filtering noise from a sound recording. The assignment is broken...
For this homework, you will be filtering noise from a sound recording. The assignment is broken into simple steps you can follow. Please follow instructions carefully and remember that you will only upload one workspace (*.mat) file. Make sure to name the clean_speech variable correctly. 1) Download the Matlab workspace from the link provided in Canvas. Move the downloaded file to the same folder as your script to make things simpler. 2) Load the downloaded workspace into Matlab. You can...
In this problem you will use the cursor tracker code from the previous homework assignment to...
In this problem you will use the cursor tracker code from the previous homework assignment to measure frequency responses to various sinusoidal inputs and then generate a Bode plot. Use the Matlab file track cursor.m provided on Blackboard for a proportional controller with K = 0.1. After the tracker equilibrates, generate a sinusoidal input by moving the cursor back and forth and determine the gain and phase. The gain is the ratio of the amplitude of the output sinusoid over...